add an error service, base controller

This commit is contained in:
Alex Holliday committed 2025-07-24 15:06:46 -07:00
1 parent 0cfe9d60fb
commit ddf3e8251d
20 files changed
+412 -301

No files matched your search

+7 -5
View File
@@ -1,6 +1,5 @@
import { asyncHandler } from "../utils/errorUtils.js";
const SERVICE_NAME = "diagnosticController";
import BaseController from "./baseController.js";
/**
* Diagnostic Controller
*
@@ -10,15 +9,18 @@ const SERVICE_NAME = "diagnosticController";
* @class DiagnosticController
* @description Manages system diagnostics and performance monitoring
*/
class DiagnosticController {
class DiagnosticController extends BaseController {
/**
* Creates an instance of DiagnosticController.
*
* @param {Object} dependencies - The dependencies required by the controller
* @param {Object} dependencies.diagnosticService - Service for system diagnostics and monitoring
* @param {Object} dependencies.errorService - Service for error handling
*/
constructor({ diagnosticService }) {
constructor({ diagnosticService, errorService }) {
super();
this.diagnosticService = diagnosticService;
this.errorService = errorService;
}
/**
@@ -41,7 +43,7 @@ class DiagnosticController {
* // - Database connection status
* // - Active processes/connections
*/
getSystemStats = asyncHandler(
getSystemStats = this.asyncHandler(
async (req, res) => {
const diagnostics = await this.diagnosticService.getSystemStats();
return res.success({