Update pages/api/availability/_get.ts
improve error message team no members Co-authored-by: Omar López <zomars@me.com>pull/9078/head
parent
f6faa8bc46
commit
a72fbfa093
|
@ -37,7 +37,7 @@ async function handler(req: NextApiRequest) {
|
|||
select: { members: true },
|
||||
});
|
||||
if (!team) throw new HttpError({ statusCode: 404, message: "teamId not found" });
|
||||
if (!team.members) throw new HttpError({ statusCode: 404, message: "teamId not found" });
|
||||
if (!team.members) throw new HttpError({ statusCode: 404, message: "team has no members" });
|
||||
const allMemberIds = team.members.map((membership) => membership.userId);
|
||||
const members = await prisma.user.findMany({
|
||||
where: { id: { in: allMemberIds } },
|
||||
|
|
Loading…
Reference in New Issue