Commit ade57c2b authored by Ivanq's avatar Ivanq

Repo: Add getIssue()

parent f112d42e
......@@ -169,6 +169,26 @@ class Repository {
};
});
}
getIssue(id, jsonId) {
return this.zeroDB.query("SELECT issues.*, json.cert_user_id FROM issues, json WHERE issues.json_id == json.json_id AND issues.json_id == :jsonId AND issues.id == :id", {
jsonId: jsonId,
id: id
})
.then(issue => {
return issue[0];
});
}
getIssueComments(id, jsonId) {
return this.zeroDB.query("\
SELECT issues.id AS issue_id, -1 AS id, issues.body AS body, issues.date_added AS date_added, issues.json_id AS json_id, json.cert_user_id AS cert_user_id FROM issues, json WHERE issues.json_id = json.json_id AND issues.json_id = :jsonId AND issues.id = :id\
UNION ALL\
SELECT issue_comments.*, json.cert_user_id AS cert_user_id FROM issue_comments, json WHERE issue_comments.json_id = json.json_id AND issue_comments.json_id = :jsonId AND issue_comments.issue_id = :id\
ORDER BY date_added ASC\
", {
jsonId: jsonId,
id: id
});
}
translateDate(date) {
date = new Date(date);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment