system settings

This commit is contained in:
Alex Holliday committed 2025-11-19 00:00:08 +00:00
1 parent 986e8b926a
commit f40667615e
14 files changed
+244 -1

No files matched your search

@@ -0,0 +1,41 @@
import { Request, Response, NextFunction } from "express";
import ApiError from "@/utils/ApiError.js";
import SettingsService from "@/services/system/SettingsService.js";
export interface ISettingsController {
get: (req: Request, res: Response, next: NextFunction) => void;
update: (req: Request, res: Response, next: NextFunction) => void;
}
class SettingsController implements ISettingsController {
private settingsService: SettingsService;
constructor(settingsService: SettingsService) {
this.settingsService = settingsService;
}
get = async (req: Request, res: Response, next: NextFunction) => {
try {
const settings = await this.settingsService.get();
res.status(200).json({
message: "Settings retrieved successfully",
data: settings,
});
} catch (error) {
next(error);
}
};
update = async (req: Request, res: Response, next: NextFunction) => {
try {
const updatedSettings = await this.settingsService.update(req.body);
res.status(200).json({
message: "Settings updated successfully",
data: updatedSettings,
});
} catch (error) {
next(error);
}
};
}
export default SettingsController;
+1
View File
@@ -13,3 +13,4 @@ export { default as DiagnosticController } from "./DiagnosticController.js";
export { default as RecoveryController } from "./RecoveryController.js";
export { default as ProfileController } from "./ProfileController.js";
export { default as IncidentsController } from "./IncidentsController.js";
export { default as SettingsController } from "./SettingsController.js";