updates to friend route, some changes to ui components, front end api tools

This commit is contained in:
Mikayla Dobson
2022-12-01 21:52:54 -06:00
parent 8a7eaa7db6
commit 2e48231dc5
10 changed files with 152 additions and 19 deletions

View File

@@ -123,6 +123,18 @@ export class User {
}
}
async getPendingFriendRequests(senderid: number | string) {
try {
const statement = `SELECT * FROM recipin.cmp_userfriendships WHERE pending = true AND senderid = $1`
const result = await pool.query(statement, [senderid]);
if (result.rows.length) return { ok: true, code: 200, result: result.rows }
return { ok: true, code: 200, result: "No pending friend requests found" }
} catch (e: any) {
throw new Error(e);
}
}
async addFriendship(userid: number | string, targetid: number | string) {
try {
const statement = `