Initial commit: teaching institution management API.
Express/MongoDB backend with JWT auth, RBAC, S3 uploads, notifications, and scheduled jobs.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// /components/contactInquiries/contactInquiryController.js
|
||||
|
||||
const catchAsync = require('../../utils/catchAsync');
|
||||
const contactInquiryService = require('./contactInquiryService');
|
||||
const { successResponse, listResponse } = require('../../utils/apiResponse');
|
||||
|
||||
exports.create = catchAsync(async (req, res) => {
|
||||
const inquiry = await contactInquiryService.createInquiry(req.body);
|
||||
return successResponse(res, 201, 'Contact inquiry submitted successfully', inquiry);
|
||||
});
|
||||
|
||||
exports.getAll = catchAsync(async (req, res) => {
|
||||
const { data, meta } = await contactInquiryService.getAllInquiries(req.query);
|
||||
return listResponse(res, 200, data, meta);
|
||||
});
|
||||
|
||||
exports.getOne = catchAsync(async (req, res) => {
|
||||
const inquiry = await contactInquiryService.getInquiryById(req.params.id);
|
||||
return successResponse(res, 200, 'Contact inquiry retrieved successfully', inquiry);
|
||||
});
|
||||
|
||||
exports.update = catchAsync(async (req, res) => {
|
||||
const inquiry = await contactInquiryService.updateInquiry(req.params.id, req.body);
|
||||
return successResponse(res, 200, 'Contact inquiry updated successfully', inquiry);
|
||||
});
|
||||
Reference in New Issue
Block a user