event type custom input WIP
This commit is contained in:
1 parent
49cb191254
commit
76b72f64d8
4 files changed
+182
-4
No files matched your search
@@ -18,6 +18,27 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
length: parseInt(req.body.length),
|
||||
hidden: req.body.hidden,
|
||||
locations: req.body.locations,
|
||||
customInputs: !req.body.customInputs
|
||||
? undefined
|
||||
: {
|
||||
createMany: {
|
||||
data: req.body.customInputs.filter(input => !input.id).map(input => ({
|
||||
type: input.type,
|
||||
label: input.label,
|
||||
required: input.required
|
||||
}))
|
||||
},
|
||||
update: req.body.customInputs.filter(input => !!input.id).map(input => ({
|
||||
data: {
|
||||
type: input.type,
|
||||
label: input.label,
|
||||
required: input.required
|
||||
},
|
||||
where: {
|
||||
id: input.id
|
||||
}
|
||||
}))
|
||||
},
|
||||
};
|
||||
|
||||
if (req.method == "POST") {
|
||||
@@ -50,4 +71,4 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
res.status(200).json({message: 'Event deleted successfully'});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user