fix: availability creation and expand/collapse settings (#882)
* fix: availability creation and expand/collapse settings * additional fixes * Update pages/api/availability/eventtype.ts Co-authored-by: Alex Johansson <[email protected]> * update branch * fix: more fixes Co-authored-by: Alex Johansson <[email protected]> Co-authored-by: Bailey Pumfleet <[email protected]> Co-authored-by: Mihai Colceriu <[email protected]>
This commit is contained in:
6 files changed
+45
-17
No files matched your search
@@ -144,6 +144,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
const openingHours = req.body.availability.openingHours || [];
|
||||
// const overrides = req.body.availability.dateOverrides || [];
|
||||
|
||||
const eventTypeId = +req.body.id;
|
||||
if (eventTypeId) {
|
||||
await prisma.availability.deleteMany({
|
||||
where: {
|
||||
eventTypeId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all(
|
||||
openingHours.map((schedule) =>
|
||||
prisma.availability.create({
|
||||
|
||||
Reference in new issue
Block a user