get all accessible recipes

This commit is contained in:
Mikayla Dobson
2022-12-17 14:22:24 -06:00
parent 9a43f58ee3
commit 6c3f835b25
10 changed files with 54 additions and 18 deletions

View File

@@ -128,10 +128,10 @@ export class User {
}
}
async getPendingFriendRequests(senderid: number | string) {
async getPendingFriendRequests(recipient: number | string) {
try {
const statement = `SELECT * FROM recipin.cmp_userfriendships WHERE pending = true AND senderid = $1`
const result = await pool.query(statement, [senderid]);
const statement = `SELECT * FROM recipin.cmp_userfriendships WHERE pending = true AND targetid = $1`
const result = await pool.query(statement, [recipient]);
if (result.rows.length) return { ok: true, code: StatusCode.OK, result: result.rows }
return { ok: true, code: StatusCode.NotFound, result: "No pending friend requests found" }