Update pages/api/availability/_get.ts

add select: availabilitUserSelect

Co-authored-by: Omar López <zomars@me.com>
This commit is contained in:
Agusti Fernandez Pardo
2022-07-05 20:35:30 +02:00
committed by GitHub
co-authored by Omar López
parent 5dbb2066e0
commit 2263e04217
+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" });