Supported public vs internal application comments, and moved some type dependencies to the shared lib
This commit is contained in:
@@ -90,15 +90,20 @@ export async function denyApplication(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getApplicationComments(appID: number): Promise<CommentRow[]> {
|
||||
export async function getApplicationComments(appID: number, admin: boolean = false): Promise<CommentRow[]> {
|
||||
const excludeAdmin = ' AND app.admin_only = false';
|
||||
|
||||
const whereClause = `WHERE app.application_id = ?${!admin ? excludeAdmin : ''}`;
|
||||
|
||||
return await pool.query(`SELECT app.id AS comment_id,
|
||||
app.post_content,
|
||||
app.poster_id,
|
||||
app.post_time,
|
||||
app.last_modified,
|
||||
app.admin_only,
|
||||
member.name AS poster_name
|
||||
FROM application_comments AS app
|
||||
INNER JOIN members AS member ON member.id = app.poster_id
|
||||
WHERE app.application_id = ?;`,
|
||||
${whereClause}`,
|
||||
[appID]);
|
||||
}
|
||||
Reference in New Issue
Block a user