Skip to content

Commit

Permalink
Don't Lend Yourself money
Browse files Browse the repository at this point in the history
  • Loading branch information
preetjdp committed Mar 29, 2020
1 parent fea4887 commit c4b8fb0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/src/modules/Owe/NewOweResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export class NewOweResolver {
const userId = context.req.headers.authorization!
const userRef = firestore.collection('users').doc(userId)
const userSnapshot = await userRef.get()
//Throw error when IssuedToID === context user ID
if(issuedToID == userId) {
throw new Error("Can't Lend yourself money")
}
if (!userSnapshot.exists) {
throw Error("User Not Present")
}
Expand Down

0 comments on commit c4b8fb0

Please sign in to comment.