associations and adding more routes and structure

This commit is contained in:
Arjun Patel
2019-01-15 22:08:54 -08:00
parent b453c78c00
commit a4e4394329
11 changed files with 100 additions and 19 deletions
+17 -6
View File
@@ -2,7 +2,8 @@ const express = require('express'),
router = express.Router(),
checkAuth = require('../middleware/check-auth');
const donors = require('../controllers/donors.controller.js');
const donors = require('../controllers/donors/donors.controller.js');
const grants = require('../controllers/donors/grants.controller.js');
// Signup route
router.post('/', donors.create);
@@ -10,13 +11,23 @@ router.post('/', donors.create);
// Retrieve all Donors
router.get('/', checkAuth, donors.findAll);
// Retrieve a single Donor by Id
router.get('/:DonorId', donors.findById);
// Retrieve grants with cause and region and charity details by donor_id
router.get('/grants/:donor_id', checkAuth, grants.findByDonorId);
// Delete a Donor with Id
router.delete('/:DonorId', donors.delete);
/** Create grants with following body:
* - list of id's selected causes and regions
* - FINAL list of id's of selected organizations
* - donor_id
* */
router.post('/grants/:donor_id', checkAuth, grants.create);
// // 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/:DonorId', donors.update);
// router.put('/api/donors/:donor_id', donors.update);
module.exports = router;