Skip to content

Commit

Permalink
fix getUser error
Browse files Browse the repository at this point in the history
  • Loading branch information
squi-ddy committed Oct 25, 2024
1 parent 39ab57f commit a2f652e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { sql } from "db"
import { UserDetails, UserTable, UserType } from "types/user"

export async function getUser(id: string): Promise<UserDetails> {
export async function getUser(id: string): Promise<UserDetails | null> {
const data = await sql<UserTable[]>`
SELECT * FROM Users WHERE uid = ${id}
`

if (data.length === 0) {
return null
}

return {
username: data[0].username,
Expand Down

0 comments on commit a2f652e

Please sign in to comment.