Skip to content

Commit

Permalink
filter pinned groups by active game
Browse files Browse the repository at this point in the history
  • Loading branch information
tudddorrr committed Oct 3, 2024
1 parent 246d72d commit ee4c022
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/services/player-group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,15 @@ export default class PlayerGroupService extends Service {
const em: EntityManager = req.ctx.em
const user = await getUserFromToken(req.ctx)

const pinnedGroups = await em.getRepository(UserPinnedGroup).find({ user }, { orderBy: { createdAt: 'desc' } })
const pinnedGroups = await em.getRepository(UserPinnedGroup).find({
user,
group: {
game: req.ctx.state.game
}
}, {
orderBy: { createdAt: 'desc' }
})

const groups = await Promise.all(pinnedGroups.map(({ group }) => this.groupWithCount(group)))

return {
Expand Down

0 comments on commit ee4c022

Please sign in to comment.