Skip to content

Commit

Permalink
user og now returning stars count
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Jan 17, 2025
1 parent 7870e50 commit 40e5801
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ export class UserService {
const user = await this._getUserByNickname(username, null);
const current_discord = await this.getCurrentData(user.discordId);

const starred_bandages = await this.prisma.bandage.findMany({
where: { userId: user.id, stars: { some: {} } },
include: { stars: true }
});
const stars_count = starred_bandages.reduce((acc, current_val) => acc + current_val.stars.length, 0);

return {
discordID: user.discordId,
username: user.username,
Expand All @@ -312,6 +318,7 @@ export class UserService {
`${process.env.DOMAIN}/icon.png`,
banner_color: current_discord.banner_color,
works_count: user.Bandage.length,
stars_count: stars_count
}
}

Expand Down

0 comments on commit 40e5801

Please sign in to comment.