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:
5 files changed
+40
-2
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user