Update pages/api/availability/_get.ts

add select: availabilitUserSelect

Co-authored-by: Omar López <[email protected]>
This commit is contained in:
Agusti Fernandez PardoandOmar López authored and GitHub committed 2022-07-05 20:35:30 +02:00
1 parent 5dbb2066e0
commit 2263e04217
1 file changed
+1 -1
+1 -1
View File
@@ -31,7 +31,7 @@ async function handler(req: NextApiRequest) {
eventTypeId,
userId,
});
const team = await prisma.team.findUnique({ where: { id: teamId }, select: { members: true } });
const team = await prisma.team.findUnique({ where: { id: teamId }, select: { members: { select: availabilityUserSelect } } });
if (!team) throw new HttpError({ statusCode: 404, message: "teamId not found" });
if (!team.members) throw new HttpError({ statusCode: 404, message: "teamId not found" });
if (!isAdmin) throw new HttpError({ statusCode: 401, message: "Unauthorized" });