feat: CustomEventType placeholder and API fixes (#446)

* feat: add optional placeholder for text/multi-line text custom inputs on event types

* fix: delete associations of event type first

* fix: remove unneeded check

* fix: minor tweak

Co-authored-by: mihaic195 <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
authored and GitHub committed 2021-08-22 14:06:26 +01:00
1 parent 44e0af9641
commit 3894ee12d1
5 files changed
+40 -2

No files matched your search

+9
View File
@@ -35,6 +35,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
type: input.type,
label: input.label,
required: input.required,
placeholder: input.placeholder,
})),
},
update: req.body.customInputs
@@ -44,6 +45,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
type: input.type,
label: input.label,
required: input.required,
placeholder: input.placeholder,
},
where: {
id: input.id,
@@ -107,6 +109,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
if (req.method == "DELETE") {
// Delete associations first
await prisma.eventTypeCustomInput.deleteMany({
where: {
eventTypeId: req.body.id,
},
});
await prisma.eventType.delete({
where: {
id: req.body.id,