Use calendar deletion
parent
b376e9e5a4
commit
1e306ef1b0
|
@ -299,4 +299,4 @@ const deleteEvent = (credential, uid: String): Promise<any> => {
|
||||||
return Promise.resolve({});
|
return Promise.resolve({});
|
||||||
};
|
};
|
||||||
|
|
||||||
export {getBusyTimes, createEvent, CalendarEvent};
|
export {getBusyTimes, createEvent, updateEvent, deleteEvent, CalendarEvent};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import prisma from '../../lib/prisma';
|
import prisma from '../../lib/prisma';
|
||||||
|
import {createEvent, deleteEvent} from "../../lib/calendarClient";
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
if (req.method == "POST") {
|
if (req.method == "POST") {
|
||||||
|
@ -10,11 +11,14 @@ export default async function handler(req, res) {
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
user: true,
|
||||||
attendees: true,
|
attendees: true,
|
||||||
references: true
|
references: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await deleteEvent(bookingToDelete.user.credentials[0], uid);
|
||||||
|
|
||||||
await prisma.attendee.deleteMany({
|
await prisma.attendee.deleteMany({
|
||||||
where: {
|
where: {
|
||||||
bookingId: bookingToDelete.id
|
bookingId: bookingToDelete.id
|
||||||
|
|
Loading…
Reference in New Issue