Fix errors

This commit is contained in:
2024-10-21 11:04:29 -05:00
parent 4c3688b065
commit fc8f26dd0b
4 changed files with 20 additions and 10 deletions

View File

@@ -226,6 +226,10 @@ export const updateRelationshipStatus = async (
throw new Error('Relationship not found');
}
const relationship = relationships[0] as Relationship;
// Everything above is just getting info
if (userId === relationship.requestorId) {
throw new Error('The requestor cannot accept the relationship they requested.');
}
if (status === 'accepted') {
await db.update(schema.relationships)
.set({ isAccepted: true })