Remove batch delete for fields/collections

It's too destructive
This commit is contained in:
rijkvanzanten
2021-02-04 11:19:32 -05:00
parent fbd6a4a6b2
commit a0fb2abbe9
2 changed files with 0 additions and 55 deletions

View File

@@ -99,24 +99,6 @@ router.patch(
respond
);
router.delete(
'/',
asyncHandler(async (req, res, next) => {
if (!req.body || Array.isArray(req.body) === false) {
throw new InvalidPayloadException(`Body has to be an array of primary keys`);
}
const collectionsService = new CollectionsService({
accountability: req.accountability,
schema: req.schema,
});
await collectionsService.delete(req.body as string[]);
return next();
}),
respond
);
router.delete(
'/:collection',
asyncHandler(async (req, res, next) => {

View File

@@ -112,43 +112,6 @@ router.post(
respond
);
router.patch(
'/:collection',
validateCollection,
asyncHandler(async (req, res, next) => {
const service = new FieldsService({
accountability: req.accountability,
schema: req.schema,
});
if (Array.isArray(req.body) === false) {
throw new InvalidPayloadException('Submitted body has to be an array.');
}
for (const field of req.body) {
await service.updateField(req.params.collection, field);
}
try {
let results: any = [];
for (const field of req.body) {
const updatedField = await service.readOne(req.params.collection, field.field);
results.push(updatedField);
res.locals.payload = { data: results || null };
}
} catch (error) {
if (error instanceof ForbiddenException) {
return next();
}
throw error;
}
return next();
}),
respond
);
router.patch(
'/:collection/:field',
validateCollection,