Skip to content

Commit

Permalink
added user updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Sep 28, 2024
1 parent 9328eac commit 1d2b498
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ export class UserService {
}
}

const updated_user = await this.prisma.user.update({
where: { id: user.id },
data: { name: current_discord.global_name || current_discord.username }
});

const bandages = await this.prisma.bandage.findMany({
where: { userId: user.id, access_level: can_view ? undefined : 2, categories: can_view ? undefined : { none: { only_admins: true } } },
include: { categories: true, stars: true, User: { include: { UserSettings: true } } }
Expand All @@ -241,8 +246,8 @@ export class UserService {
statusCode: 200,
userID: user.id,
discordID: user.discordId,
username: user.username,
name: user.reserved_name || user.name,
username: updated_user.username,
name: updated_user.reserved_name || updated_user.name,
joined_at: user.joined_at,
avatar: current_discord.avatar ?
`https://cdn.discordapp.com/avatars/${current_discord.id}/${current_discord.avatar}` :
Expand Down

0 comments on commit 1d2b498

Please sign in to comment.