Update pages/api/availability/_get.ts

add select: availabilitUserSelect

Co-authored-by: Omar López <zomars@me.com>
pull/9078/head
Agusti Fernandez Pardo 2022-07-05 20:35:30 +02:00 committed by GitHub
parent 5dbb2066e0
commit 2263e04217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

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" });