fix: #16041 team eventtype create from api (#16058)

* update for teameventType creation from api

* update to set userid null for team event
This commit is contained in:
Vijay
2024-08-06 13:48:01 +02:00
committed by GitHub
parent 3078423848
commit 7f1e20fe19
+3 -3
View File
@@ -278,8 +278,8 @@ async function postHandler(req: NextApiRequest) {
let data: Prisma.EventTypeCreateArgs["data"] = {
...parsedBody,
userId,
users: { connect: { id: userId } },
userId: !!parsedBody.teamId ? null : userId,
users: !!parsedBody.teamId ? undefined : { connect: { id: userId } },
bookingLimits: bookingLimits === null ? Prisma.DbNull : bookingLimits,
durationLimits: durationLimits === null ? Prisma.DbNull : durationLimits,
};
@@ -291,7 +291,7 @@ async function postHandler(req: NextApiRequest) {
await checkUserMembership(req);
}
if (isSystemWideAdmin && parsedBody.userId) {
if (isSystemWideAdmin && parsedBody.userId && !parsedBody.teamId) {
data = { ...parsedBody, users: { connect: { id: parsedBody.userId } } };
}