Indent payload overrides in import endpoint under data

This commit is contained in:
rijkvanzanten
2020-09-21 13:19:39 -04:00
parent 5330e346a2
commit b3101b85ad

View File

@@ -117,6 +117,7 @@ router.post(
const importSchema = Joi.object({
url: Joi.string().required(),
data: Joi.object()
});
router.post(
@@ -142,11 +143,9 @@ router.post(
storage: (env.STORAGE_LOCATIONS as string).split(',')[0].trim(),
type: fileResponse.headers['content-type'],
title: formatTitle(filename),
...req.body,
...(req.body.data || {}),
};
delete payload.url;
const primaryKey = await service.upload(fileResponse.data, payload);
const record = await service.readByKey(primaryKey, req.sanitizedQuery);
res.locals.payload = { data: record || null };