organize general routes
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
const express = require('express'),
|
||||
router = express.Router(),
|
||||
checkAuth = require('../middleware/check-auth');
|
||||
|
||||
const donor = require('../controllers/donor/donor.controller.js');
|
||||
const grant = require('../controllers/donor/grant.controller.js');
|
||||
|
||||
// Signup route
|
||||
router.post('/', donor.create);
|
||||
|
||||
// Retrieve all Donors
|
||||
router.get('/', checkAuth, donor.findAll);
|
||||
|
||||
// Retrieve grants with causes and regions and charities details by donor_id
|
||||
router.get('/grants/:donor_id', checkAuth, grant.findByDonorId);
|
||||
|
||||
/** Create grants with following body:
|
||||
* - list of id's of selected causes and regions
|
||||
* - FINAL list of id's of selected organizations
|
||||
* - donor_id
|
||||
* */
|
||||
router.post('/grants/:donor_id', checkAuth, grant.create);
|
||||
|
||||
// Delete a grant of a donor
|
||||
router.delete('/grants/:grant_id', checkAuth, grant.delete);
|
||||
|
||||
// // Retrieve a single Donor by Id
|
||||
// router.get('/:donor_id', donor.findById);
|
||||
|
||||
// // Delete a Donor with Id
|
||||
// router.delete('/:donor_id', donor.delete);
|
||||
|
||||
// // Update a Donor with Id
|
||||
// router.put('/api/donors/:donor_id', donor.update);
|
||||
|
||||
module.exports = router;
|
||||
@@ -1,36 +0,0 @@
|
||||
const express = require('express'),
|
||||
router = express.Router(),
|
||||
checkAuth = require('../middleware/check-auth');
|
||||
|
||||
const donors = require('../controllers/donors/donors.controller.js');
|
||||
const grants = require('../controllers/donors/grants.controller.js');
|
||||
|
||||
// Signup route
|
||||
router.post('/', donors.create);
|
||||
|
||||
// Retrieve all Donors
|
||||
router.get('/', checkAuth, donors.findAll);
|
||||
|
||||
// Retrieve grants with causes and regions and charities details by donor_id
|
||||
router.get('/grants/:donor_id', checkAuth, grants.findByDonorId);
|
||||
|
||||
/** Create grants with following body:
|
||||
* - list of id's of selected causes and regions
|
||||
* - FINAL list of id's of selected organizations
|
||||
* - donor_id
|
||||
* */
|
||||
router.post('/grants/:donor_id', checkAuth, grants.create);
|
||||
|
||||
// Delete a grant of a donor
|
||||
router.delete('/grants/:grant_id', checkAuth, grants.delete);
|
||||
|
||||
// // Retrieve a single Donor by Id
|
||||
// router.get('/:donor_id', donors.findById);
|
||||
|
||||
// // Delete a Donor with Id
|
||||
// router.delete('/:donor_id', donors.delete);
|
||||
|
||||
// // Update a Donor with Id
|
||||
// router.put('/api/donors/:donor_id', donors.update);
|
||||
|
||||
module.exports = router;
|
||||
@@ -0,0 +1,15 @@
|
||||
const express = require('express'),
|
||||
router = express.Router();
|
||||
|
||||
const controllers = require('../controllers/general');
|
||||
|
||||
// Retrieve all causes
|
||||
router.get('/causes', controllers.cause.findAll);
|
||||
|
||||
// Retrieve all regions
|
||||
router.get('/regions', controllers.region.findAll);
|
||||
|
||||
// Retrieve all organizations
|
||||
router.get('/organizations', controllers.organization.findAll);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user