Compare commits
1 commit
5e9f8b59a4
...
a36ea0cb6b
Author | SHA1 | Date | |
---|---|---|---|
a36ea0cb6b |
2 changed files with 13 additions and 27 deletions
|
@ -229,23 +229,6 @@ export const PATCH = auth(async (req, { params }) => {
|
||||||
participants,
|
participants,
|
||||||
} = data.data;
|
} = data.data;
|
||||||
|
|
||||||
if (participants !== undefined)
|
|
||||||
for (const participant of participants) {
|
|
||||||
await prisma.meetingParticipant.upsert({
|
|
||||||
where: {
|
|
||||||
meeting_id_user_id: {
|
|
||||||
user_id: participant,
|
|
||||||
meeting_id: eventID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
create: {
|
|
||||||
user_id: participant,
|
|
||||||
meeting_id: eventID,
|
|
||||||
},
|
|
||||||
update: {},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedEvent = await prisma.meeting.update({
|
const updatedEvent = await prisma.meeting.update({
|
||||||
where: {
|
where: {
|
||||||
id: eventID,
|
id: eventID,
|
||||||
|
@ -257,16 +240,18 @@ export const PATCH = auth(async (req, { params }) => {
|
||||||
end_time,
|
end_time,
|
||||||
location,
|
location,
|
||||||
status,
|
status,
|
||||||
participants:
|
participants: !participants
|
||||||
participants !== undefined
|
? undefined
|
||||||
? {
|
: {
|
||||||
deleteMany: {
|
deleteMany: {
|
||||||
user_id: {
|
user_id: {
|
||||||
notIn: participants || [],
|
notIn: participants,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
create: participants.map((participant) => ({
|
||||||
: {},
|
user_id: participant,
|
||||||
|
})),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|
|
@ -113,6 +113,7 @@ export const createEventSchema = zod
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
export const updateEventSchema = zod
|
export const updateEventSchema = zod
|
||||||
.object({
|
.object({
|
||||||
|
id: eventIdSchema,
|
||||||
title: eventTitleSchema.optional(),
|
title: eventTitleSchema.optional(),
|
||||||
description: eventDescriptionSchema.optional(),
|
description: eventDescriptionSchema.optional(),
|
||||||
start_time: eventStartTimeSchema.optional(),
|
start_time: eventStartTimeSchema.optional(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue