fix: include participants in getManageableTournaments query
This commit is contained in:
@@ -178,6 +178,7 @@ describe('Tournament Permissions', () => {
|
|||||||
expect(result).toEqual(mockTournaments);
|
expect(result).toEqual(mockTournaments);
|
||||||
expect(prisma.event.findMany).toHaveBeenCalledWith({
|
expect(prisma.event.findMany).toHaveBeenCalledWith({
|
||||||
where: { eventType: 'tournament' },
|
where: { eventType: 'tournament' },
|
||||||
|
include: { participants: true },
|
||||||
orderBy: { createdAt: 'desc' }
|
orderBy: { createdAt: 'desc' }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -201,6 +202,7 @@ describe('Tournament Permissions', () => {
|
|||||||
eventType: 'tournament',
|
eventType: 'tournament',
|
||||||
ownerId: 'tour-admin-1'
|
ownerId: 'tour-admin-1'
|
||||||
},
|
},
|
||||||
|
include: { participants: true },
|
||||||
orderBy: { createdAt: 'desc' }
|
orderBy: { createdAt: 'desc' }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -224,6 +226,7 @@ describe('Tournament Permissions', () => {
|
|||||||
eventType: 'tournament',
|
eventType: 'tournament',
|
||||||
status: { not: 'draft' }
|
status: { not: 'draft' }
|
||||||
},
|
},
|
||||||
|
include: { participants: true },
|
||||||
orderBy: { createdAt: 'desc' }
|
orderBy: { createdAt: 'desc' }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ export async function getManageableTournaments() {
|
|||||||
// Club admins can see all tournaments
|
// Club admins can see all tournaments
|
||||||
return prisma.event.findMany({
|
return prisma.event.findMany({
|
||||||
where: { eventType: 'tournament' },
|
where: { eventType: 'tournament' },
|
||||||
|
include: { participants: true },
|
||||||
orderBy: { createdAt: 'desc' }
|
orderBy: { createdAt: 'desc' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -205,6 +206,7 @@ export async function getManageableTournaments() {
|
|||||||
eventType: 'tournament',
|
eventType: 'tournament',
|
||||||
ownerId: userId
|
ownerId: userId
|
||||||
},
|
},
|
||||||
|
include: { participants: true },
|
||||||
orderBy: { createdAt: 'desc' }
|
orderBy: { createdAt: 'desc' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -212,6 +214,7 @@ export async function getManageableTournaments() {
|
|||||||
// Regular players can only view tournaments (not manage them)
|
// Regular players can only view tournaments (not manage them)
|
||||||
return prisma.event.findMany({
|
return prisma.event.findMany({
|
||||||
where: { eventType: 'tournament', status: { not: 'draft' } },
|
where: { eventType: 'tournament', status: { not: 'draft' } },
|
||||||
|
include: { participants: true },
|
||||||
orderBy: { createdAt: 'desc' }
|
orderBy: { createdAt: 'desc' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user