-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jessica Ho
authored and
Jessica Ho
committed
Feb 15, 2024
1 parent
816ea23
commit 0b557c9
Showing
24 changed files
with
539 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import FriendRequestRepository from '$lib/server/repository/FriendRequest'; | ||
import { error } from '@sveltejs/kit'; | ||
|
||
export default async function deleteFriendReq(reqId: number, phone: string) { | ||
const friendReq = await FriendRequestRepository.findOne({ id: reqId }); | ||
if (!friendReq || friendReq.targetPhone !== phone) { | ||
throw error(401, { | ||
message: "Can't delete friend request not issued to you" | ||
}); | ||
} | ||
return await FriendRequestRepository.delete({ | ||
id: reqId | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import HouseholdInviteRepository from '$lib/server/repository/HouseholdInvite'; | ||
import { error } from '@sveltejs/kit'; | ||
|
||
export default async function deleteHouseholdInvite(reqId: number, phone: string) { | ||
const invite = await HouseholdInviteRepository.findOne({ id: reqId }); | ||
if (!invite || invite.targetPhone !== phone) { | ||
throw error(401, { | ||
message: "You can't delete a household invite that wasn't issued to you" | ||
}); | ||
} | ||
|
||
await HouseholdInviteRepository.delete({ id: reqId }); | ||
} |
Oops, something went wrong.