Skip to content

Commit

Permalink
fix: redis thrown an error as user not found (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
hudy9x authored May 26, 2024
1 parent 435ae34 commit a2247ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/be-gateway/src/services/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const serviceGetUserById = async (id: string) => {
if (cached) return cached

const result = await mdUserFindFirst({ id })
if (!result) {
console.log('User id not found: ', id)
return null;
}

await hset(key, result)

Expand All @@ -28,6 +32,11 @@ export const serviceGetUserByEmail = async (email: string) => {

const result = await mdUserFindEmail(email)

if (!result) {
console.log('Email not found: ', email)
return null;
}

await hset(key, result)

return result
Expand Down

0 comments on commit a2247ba

Please sign in to comment.