Backend: minor fixes + Added people media folder auto creating & mutler upload function
This commit is contained in:
1 parent
d3dbd7c3e3
commit
f1cd3f9167
4 files changed
+29
-14
No files matched your search
@@ -92,10 +92,13 @@ entryRouter.put('/:entryId/media/:mediaId', upload, async (req, res) => {
|
||||
return res.status(404).json({ message: 'Media not found' });
|
||||
}
|
||||
|
||||
// ? setting all other media to not selected
|
||||
// ? to not have multiple selected media of the same type
|
||||
await Media.update(
|
||||
{ isSelected: false },
|
||||
{
|
||||
where: {
|
||||
mediaable: 'entry',
|
||||
mediaableId: entryId,
|
||||
type: media.type
|
||||
}
|
||||
@@ -103,7 +106,6 @@ entryRouter.put('/:entryId/media/:mediaId', upload, async (req, res) => {
|
||||
);
|
||||
|
||||
const updatedMedia = await media.update({ isSelected: true });
|
||||
|
||||
return res.status(200).json(updatedMedia);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user