diff --git a/api/src/services/applicationService.ts b/api/src/services/applicationService.ts index 85615bc..5692b4c 100644 --- a/api/src/services/applicationService.ts +++ b/api/src/services/applicationService.ts @@ -31,7 +31,7 @@ export async function getApplicationByID(appID: number): Promise return app[0]; } -export async function getApplicationList(): Promise { +export async function getApplicationList(page: number = 1, pageSize: number = 25): Promise { const sql = `SELECT member.name AS member_name, app.id, @@ -40,9 +40,11 @@ export async function getApplicationList(): Promise { app.app_status FROM applications AS app 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; }