This commit is contained in:
Ken
2026-01-19 09:33:35 +07:00
parent 374dc12b2d
commit 70838a4bc1
103 changed files with 16929 additions and 2 deletions

73
routes/schoolRoutes.js Normal file
View 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;