Tweaked application sorting method Close #79

This commit is contained in:
2025-12-15 13:31:04 -05:00
parent 618c290318
commit 1dfdb6bd0e

View File

@@ -31,7 +31,7 @@ export async function getApplicationByID(appID: number): Promise<ApplicationRow>
return app[0]; return app[0];
} }
export async function getApplicationList(): Promise<ApplicationListRow[]> { export async function getApplicationList(page: number = 1, pageSize: number = 25): Promise<ApplicationListRow[]> {
const sql = `SELECT const sql = `SELECT
member.name AS member_name, member.name AS member_name,
app.id, app.id,
@@ -40,9 +40,11 @@ export async function getApplicationList(): Promise<ApplicationListRow[]> {
app.app_status app.app_status
FROM applications AS app FROM applications AS app
LEFT JOIN members AS member LEFT JOIN members AS member
ON member.id = app.member_id;` ON member.id = app.member_id
ORDER BY app.submitted_at DESC
LIMIT ? OFFSET ?;`
const rows: ApplicationListRow[] = await pool.query(sql); const rows: ApplicationListRow[] = await pool.query(sql, [pageSize, page]);
return rows; return rows;
} }