Files
gameno-api/components/contactInquiries/contactInquiryController.js
T
kavehhn f04c797be6 Initial commit: teaching institution management API.
Express/MongoDB backend with JWT auth, RBAC, S3 uploads, notifications, and scheduled jobs.
2026-08-09 04:18:08 +02:00

26 lines
1.1 KiB
JavaScript

// /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);
});