Initial commit: teaching institution management API.

Express/MongoDB backend with JWT auth, RBAC, S3 uploads, notifications, and scheduled jobs.
This commit is contained in:
2026-08-09 04:18:08 +02:00
commit f04c797be6
107 changed files with 9190 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
// /components/auth/authController.js
const catchAsync = require('../../utils/catchAsync');
const authService = require('./authService');
const { successResponse } = require('../../utils/apiResponse');
exports.login = catchAsync(async (req, res, next) => {
const { username, password } = req.body;
const result = await authService.login(username, password);
return successResponse(res, 200, 'Login successful', result);
});
exports.refresh = catchAsync(async (req, res, next) => {
const { refreshToken } = req.body;
const result = await authService.refreshToken(refreshToken);
return successResponse(res, 200, 'Tokens refreshed successfully', result);
});
exports.logout = catchAsync(async (req, res, next) => {
const { refreshToken } = req.body;
const userId = req.user?._id;
await authService.logout(userId, refreshToken);
return successResponse(res, 200, 'Logout successful');
});