update
This commit is contained in:
73
routes/schoolRoutes.js
Normal file
73
routes/schoolRoutes.js
Normal file
@@ -0,0 +1,73 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const schoolController = require('../controllers/schoolController');
|
||||
// const { authenticate, authorize } = require('../middleware/auth'); // Auth middleware
|
||||
|
||||
/**
|
||||
* School Routes
|
||||
* Base path: /api/schools
|
||||
*/
|
||||
|
||||
/**
|
||||
* @route GET /api/schools/datatypes/schema
|
||||
* @desc Get school data types
|
||||
* @access Protected
|
||||
*/
|
||||
router.get('/datatypes/schema', schoolController.getSchoolDatatypes);
|
||||
|
||||
/**
|
||||
* @route GET /api/schools
|
||||
* @desc Get all schools with pagination
|
||||
* @query page, limit, type, city, is_active
|
||||
* @access Public (or Protected based on requirements)
|
||||
*/
|
||||
router.get('/', schoolController.getAllSchools);
|
||||
|
||||
/**
|
||||
* @route GET /api/schools/:id
|
||||
* @desc Get school by ID
|
||||
* @access Public
|
||||
*/
|
||||
router.get('/:id', schoolController.getSchoolById);
|
||||
|
||||
/**
|
||||
* @route GET /api/schools/:id/stats
|
||||
* @desc Get school statistics
|
||||
* @access Protected
|
||||
*/
|
||||
router.get('/:id/stats', schoolController.getSchoolStats);
|
||||
|
||||
/**
|
||||
* @route POST /api/schools
|
||||
* @desc Create new school
|
||||
* @access Protected - Admin only
|
||||
*/
|
||||
router.post('/',
|
||||
// authenticate,
|
||||
// authorize(['system_admin', 'center_manager']),
|
||||
schoolController.createSchool
|
||||
);
|
||||
|
||||
/**
|
||||
* @route PUT /api/schools/:id
|
||||
* @desc Update school
|
||||
* @access Protected - Admin only
|
||||
*/
|
||||
router.put('/:id',
|
||||
// authenticate,
|
||||
// authorize(['system_admin', 'center_manager']),
|
||||
schoolController.updateSchool
|
||||
);
|
||||
|
||||
/**
|
||||
* @route DELETE /api/schools/:id
|
||||
* @desc Delete (soft delete) school
|
||||
* @access Protected - System Admin only
|
||||
*/
|
||||
router.delete('/:id',
|
||||
// authenticate,
|
||||
// authorize(['system_admin']),
|
||||
schoolController.deleteSchool
|
||||
);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user