Skip to content

Commit

Permalink
fix: Update user service to handle missing username
Browse files Browse the repository at this point in the history
The code changes in the user service file fix an issue where the username was not being properly handled. If the user's name is not available, the login name is now used instead. Additionally, the default permission value is set to 0. This ensures that the user object is correctly populated before querying the database.
  • Loading branch information
OXeu committed Jun 7, 2024
1 parent cf54f48 commit 73c1edc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/services/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export const UserService = (db: DB, env: Env) => new Elysia({ aot: false })
permission: number | null;
} = {
openid: user.id,
username: user.name,
username: user.name || user.login,
avatar: user.avatar_url,
permission: null
permission: 0
};
await db.query.users.findFirst({ where: eq(users.openid, profile.openid) })
.then(async (user) => {
Expand Down

0 comments on commit 73c1edc

Please sign in to comment.