Files
gameno-api/components/financialReports/financialReportController.js
T
kavehhn 22b57eeae2 Add professor share calculation and financial reporting feature
Introduces per-class payout configuration (percentage or hourly rate,
plus an optional per-session expense allowance), pure calculation
utilities for professor payout/net profit/receivables, and a new
financial-reports API surface with per-class, per-session, and
date-range/monthly reports. Also adds full CRUD for institutional
expenses used in the range report, and wires up the new permissions
and roles. Fixes a pre-existing ReferenceError (missing
parseImportDate import) in paymentService that blocked creating
payments with dated transactions.
2026-08-21 12:19:09 +03:30

22 lines
980 B
JavaScript

// /components/financialReports/financialReportController.js
'use strict';
const catchAsync = require('../../utils/catchAsync');
const financialReportService = require('./financialReportService');
const { successResponse } = require('../../utils/apiResponse');
exports.getClassReport = catchAsync(async (req, res) => {
const report = await financialReportService.getClassReport(req.params.classId);
return successResponse(res, 200, 'Class financial report retrieved successfully', report);
});
exports.getSessionReport = catchAsync(async (req, res) => {
const report = await financialReportService.getSessionReport(req.params.sessionId);
return successResponse(res, 200, 'Session financial report retrieved successfully', report);
});
exports.getRangeReport = catchAsync(async (req, res) => {
const report = await financialReportService.getRangeReport(req.query);
return successResponse(res, 200, 'Date-range financial report retrieved successfully', report);
});