Major Backend SI Update part 2: added controllers
This commit is contained in:
1 parent
a51e207707
commit
dbb00fdb61
38 files changed
+2129
-1231
No files matched your search
@@ -0,0 +1,45 @@
|
||||
const express = require('express');
|
||||
const collectionRouter = express.Router();
|
||||
|
||||
const collectionController = require('../controllers/collectionController');
|
||||
const { collectionPicturesUpload } = require('../services/mutlerStorageLocations');
|
||||
|
||||
// ! /collections
|
||||
// * GET - ALL COLLECTIONS
|
||||
collectionRouter.get('/', collectionController.getCollections);
|
||||
|
||||
// * GET - COLLECTION BY ID
|
||||
collectionRouter.get('/:id', collectionController.getCollectionById);
|
||||
|
||||
// * POST - CREATE COLLECTION
|
||||
collectionRouter.post('/', collectionController.createCollection);
|
||||
|
||||
// * PUT - UPDATE COLLECTION
|
||||
const upload = collectionPicturesUpload.fields([
|
||||
{ name: 'poster', maxCount: 1 },
|
||||
{ name: 'backdrop', maxCount: 1 }
|
||||
]);
|
||||
collectionRouter.put('/:id', upload, collectionController.updateCollection);
|
||||
|
||||
// * PUT - REFRESH COLLECTION
|
||||
collectionRouter.put('/:id/refresh', collectionController.refrechCollection);
|
||||
|
||||
// * PUT - GET COLLECTION PARTS
|
||||
collectionRouter.put('/:id/parts', collectionController.getCollectionParts);
|
||||
|
||||
// * DELETE - DELETE COLLECTION
|
||||
collectionRouter.delete('/:id', collectionController.deleteCollection);
|
||||
|
||||
// * POST - ADD ENTRY TO A COLLECTION
|
||||
collectionRouter.post('/:collectionId/entries/:entryId', collectionController.addEntryToCollection);
|
||||
|
||||
// * PATCH - UPDATE ENTRY ORDER IN COLLECTION
|
||||
collectionRouter.patch('/:collectionId/entries/:entryId', collectionController.updateCollectionEntryOrder);
|
||||
|
||||
// * DELETE - REMOVE AN ENTRY FROM A COLLECTION
|
||||
collectionRouter.delete('/:collectionId/entries/:entryId', collectionController.removeEntryFromCollection);
|
||||
|
||||
// * POST - CREATE COLLECTION WITH ENTRY
|
||||
collectionRouter.post('/collection-with-entry', collectionController.createCollectionWithEntry);
|
||||
|
||||
module.exports = collectionRouter;
|
||||
Reference in new issue
Block a user