return UserNotFound error if user does not exist in delete account trx

This commit is contained in:
Satindar Dhillon
2022-07-06 09:49:01 -07:00
parent 7d7b51500c
commit e5d6386b96

View File

@ -368,7 +368,13 @@ export const deleteAccountResolver = authorized<
>(async (_, { userID }, { models, claims, log, authTrx }) => {
const user = await models.user.get(userID)
if (!user || user.id !== claims.uid) {
if (!user) {
return {
errorCodes: [DeleteAccountErrorCode.UserNotFound],
}
}
if (user.id !== claims.uid) {
return {
errorCodes: [DeleteAccountErrorCode.Unauthorized],
}