add an error service, base controller
This commit is contained in:
1 parent
0cfe9d60fb
commit
ddf3e8251d
20 files changed
+412
-301
No files matched your search
@@ -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({
|
||||
|
||||
Reference in new issue
Block a user