Files
Checkmate/server/src/controllers/diagnosticController.ts
T

37 lines
963 B
TypeScript
Raw Normal View History

2026-03-11 10:50:10 -07:00
import { IDiagnosticService } from "@/service/index.js";
2026-01-09 15:46:30 -08:00
import { Request, Response, NextFunction } from "express";
const SERVICE_NAME = "diagnosticController";
2026-03-20 11:51:54 -07:00
export interface IDiagnosticController {
getSystemStats: (req: Request, res: Response, next: NextFunction) => Promise<Response | void>;
}
class DiagnosticController implements IDiagnosticController {
2026-01-09 15:46:30 -08:00
static SERVICE_NAME = SERVICE_NAME;
2026-03-11 10:50:10 -07:00
private diagnosticService: IDiagnosticService;
2026-01-09 15:46:30 -08:00
2026-03-11 10:50:10 -07:00
constructor(diagnosticService: IDiagnosticService) {
2026-01-09 15:46:30 -08:00
this.diagnosticService = diagnosticService;
}
get serviceName() {
return DiagnosticController.SERVICE_NAME;
}
getSystemStats = async (req: Request, res: Response, next: NextFunction) => {
try {
const diagnostics = await this.diagnosticService.getSystemStats();
return res.status(200).json({
success: true,
msg: "OK",
data: diagnostics,
});
} catch (error) {
next(error);
}
};
}
export default DiagnosticController;