diff --git a/server/src/api/controllers/authController.ts b/server/src/api/controllers/authController.ts index 59afd4cc8..ab8d1fc61 100755 --- a/server/src/api/controllers/authController.ts +++ b/server/src/api/controllers/authController.ts @@ -22,8 +22,6 @@ import { } from "@/api/validation/userValidation.js"; import { IUserService } from "@/domain/users/user.service.js"; -const SERVICE_NAME = "authController"; - export interface IAuthController { registerUser: RequestHandler; createUser: RequestHandler; @@ -42,8 +40,6 @@ export interface IAuthController { } class AuthController implements IAuthController { - static SERVICE_NAME = SERVICE_NAME; - private userService: IUserService; constructor(userService: IUserService) { diff --git a/server/src/api/controllers/checkController.ts b/server/src/api/controllers/checkController.ts index 525a00080..7b69c7047 100755 --- a/server/src/api/controllers/checkController.ts +++ b/server/src/api/controllers/checkController.ts @@ -11,8 +11,6 @@ import { import { ICheckService } from "@/domain/checks/check.service.js"; import { requireTeamId } from "@/api/controllers/controllerUtils.js"; -const SERVICE_NAME = "checkController"; - export interface ICheckController { getChecksByMonitor: RequestHandler; getChecksByTeam: RequestHandler; @@ -22,8 +20,6 @@ export interface ICheckController { } class CheckController implements ICheckController { - static SERVICE_NAME = SERVICE_NAME; - private checkService: ICheckService; constructor(checkService: ICheckService) { this.checkService = checkService; diff --git a/server/src/api/controllers/diagnosticController.ts b/server/src/api/controllers/diagnosticController.ts index 382b4349a..9d70304d4 100755 --- a/server/src/api/controllers/diagnosticController.ts +++ b/server/src/api/controllers/diagnosticController.ts @@ -2,15 +2,11 @@ import { IDiagnosticService } from "@/domain/diagnostics/diagnostic.service.js"; import { Request, Response, RequestHandler } from "express"; import { catchAsync } from "@/utils/catchAsync.js"; -const SERVICE_NAME = "diagnosticController"; - export interface IDiagnosticController { getSystemStats: RequestHandler; } class DiagnosticController implements IDiagnosticController { - static SERVICE_NAME = SERVICE_NAME; - private diagnosticService: IDiagnosticService; constructor(diagnosticService: IDiagnosticService) { diff --git a/server/src/api/controllers/geoCheckController.ts b/server/src/api/controllers/geoCheckController.ts index 0c7f62260..24caef382 100644 --- a/server/src/api/controllers/geoCheckController.ts +++ b/server/src/api/controllers/geoCheckController.ts @@ -4,14 +4,10 @@ import { getChecksParamValidation, getChecksQueryValidation } from "@/api/valida import type { IGeoChecksService } from "@/domain/geo-checks/geo-check.service.js"; import { requireTeamId } from "./controllerUtils.js"; -const SERVICE_NAME = "geoCheckController"; - export interface IGeoCheckController { getGeoChecksByMonitor: RequestHandler; } class GeoCheckController implements IGeoCheckController { - static SERVICE_NAME = SERVICE_NAME; - private geoChecksService: IGeoChecksService; constructor(geoChecksService: IGeoChecksService) { this.geoChecksService = geoChecksService; diff --git a/server/src/api/controllers/inviteController.ts b/server/src/api/controllers/inviteController.ts index 5af172dfb..511145b7b 100755 --- a/server/src/api/controllers/inviteController.ts +++ b/server/src/api/controllers/inviteController.ts @@ -3,7 +3,6 @@ import { catchAsync } from "@/utils/catchAsync.js"; import { inviteBodyValidation, inviteVerificationBodyValidation } from "@/api/validation/authValidation.js"; import { requireFirstName, requireTeamId, requireUserRoles } from "@/api/controllers/controllerUtils.js"; import { IInviteService } from "@/domain/invites/invite.service.js"; -const SERVICE_NAME = "inviteController"; export interface IInviteController { getInviteToken: RequestHandler; @@ -12,7 +11,6 @@ export interface IInviteController { } class InviteController implements IInviteController { - static SERVICE_NAME = SERVICE_NAME; private inviteService: IInviteService; constructor(inviteService: IInviteService) { this.inviteService = inviteService; diff --git a/server/src/api/controllers/logController.ts b/server/src/api/controllers/logController.ts index bbbeef2a9..316d03788 100644 --- a/server/src/api/controllers/logController.ts +++ b/server/src/api/controllers/logController.ts @@ -2,14 +2,11 @@ import { ILogger } from "@/utils/logger.js"; import { Request, Response, RequestHandler } from "express"; import { catchAsync } from "@/utils/catchAsync.js"; -const SERVICE_NAME = "LogController"; - export interface ILogController { getLogs: RequestHandler; } class LogController { - static SERVICE_NAME = SERVICE_NAME; private logger: ILogger; constructor(logger: ILogger) { this.logger = logger; diff --git a/server/src/api/controllers/monitorController.ts b/server/src/api/controllers/monitorController.ts index f81e64f4a..664a78f45 100644 --- a/server/src/api/controllers/monitorController.ts +++ b/server/src/api/controllers/monitorController.ts @@ -23,8 +23,6 @@ import { AppError } from "@/utils/AppError.js"; import { IMonitorService } from "@/domain/monitors/monitor.service.js"; import { INotificationsService } from "@/domain/notifications/notification.service.js"; -const SERVICE_NAME = "monitorController"; - export interface IMonitorController { getMonitorCertificate: RequestHandler; getUptimeDetailsById: RequestHandler; @@ -47,8 +45,6 @@ export interface IMonitorController { updateNotifications: RequestHandler; } class MonitorController implements IMonitorController { - static SERVICE_NAME = SERVICE_NAME; - private monitorService: IMonitorService; private notificationsService: INotificationsService; diff --git a/server/src/api/controllers/queueController.ts b/server/src/api/controllers/queueController.ts index 09e0474e5..03204167c 100755 --- a/server/src/api/controllers/queueController.ts +++ b/server/src/api/controllers/queueController.ts @@ -3,8 +3,6 @@ import { getQueueJobsQueryValidation } from "@/api/validation/queueValidation.js import { Request, Response, RequestHandler } from "express"; import { catchAsync } from "@/utils/catchAsync.js"; -const SERVICE_NAME = "JobQueueController"; - export interface IJobQueueController { getMetrics: RequestHandler; getJobs: RequestHandler; @@ -13,7 +11,6 @@ export interface IJobQueueController { } class JobQueueController implements IJobQueueController { - static SERVICE_NAME = SERVICE_NAME; constructor(private scheduler: IJobScheduler) {} getMetrics = catchAsync(async (req: Request, res: Response) => { diff --git a/server/src/api/controllers/settingsController.ts b/server/src/api/controllers/settingsController.ts index a3237d92b..3cb032e93 100644 --- a/server/src/api/controllers/settingsController.ts +++ b/server/src/api/controllers/settingsController.ts @@ -7,8 +7,6 @@ import { ISettingsService } from "@/domain/app-settings/app-settings.service.js" import { IEmailService } from "@/service/emailService.js"; import { Settings } from "@/domain/app-settings/app-settings.type.js"; -const SERVICE_NAME = "SettingsController"; - export interface ISettingsController { getAppSettings: RequestHandler; updateAppSettings: RequestHandler; @@ -16,7 +14,6 @@ export interface ISettingsController { } class SettingsController implements ISettingsController { - static SERVICE_NAME = SERVICE_NAME; private settingsService: ISettingsService; private emailService: IEmailService; constructor(settingsService: ISettingsService, emailService: IEmailService) { diff --git a/server/src/api/controllers/statusPageController.ts b/server/src/api/controllers/statusPageController.ts index 5ba1cf527..038ddb423 100644 --- a/server/src/api/controllers/statusPageController.ts +++ b/server/src/api/controllers/statusPageController.ts @@ -13,8 +13,6 @@ import { requireTeamId, requireUserId } from "@/api/controllers/controllerUtils. import { IStatusPageService } from "@/domain/status-pages/status-page.service.js"; import { resolveStatusPageDomainFromRequest } from "@/utils/statusPageDomain.js"; -const SERVICE_NAME = "statusPageController"; - export interface IStatusPageController { createStatusPage: RequestHandler; updateStatusPage: RequestHandler; @@ -25,7 +23,6 @@ export interface IStatusPageController { } class StatusPageController implements IStatusPageController { - static SERVICE_NAME = SERVICE_NAME; private statusPageService: IStatusPageService; constructor(statusPageService: IStatusPageService) { this.statusPageService = statusPageService; diff --git a/server/test/unit/services/emailService.test.ts b/server/test/unit/services/emailService.test.ts index c49d525b1..971c712da 100644 --- a/server/test/unit/services/emailService.test.ts +++ b/server/test/unit/services/emailService.test.ts @@ -90,14 +90,14 @@ describe("EmailService", () => { it("loads all expected templates on construction", () => { const { mockFs } = createService(); - // 6 templates loaded - expect(mockFs.readFileSync).toHaveBeenCalledTimes(6); + // 5 templates loaded + expect(mockFs.readFileSync).toHaveBeenCalledTimes(5); }); it("compiles each loaded template", () => { const { compile } = createService(); - expect(compile).toHaveBeenCalledTimes(6); + expect(compile).toHaveBeenCalledTimes(5); }); it("logs error when a template file is not found", () => { @@ -141,7 +141,7 @@ describe("EmailService", () => { service.init(); - expect(mockFs.readFileSync).toHaveBeenCalledTimes(initialCalls + 6); + expect(mockFs.readFileSync).toHaveBeenCalledTimes(initialCalls + 5); }); }); diff --git a/server/test/unit/services/settingsService.test.ts b/server/test/unit/services/settingsService.test.ts index e46472fac..063a64f6d 100644 --- a/server/test/unit/services/settingsService.test.ts +++ b/server/test/unit/services/settingsService.test.ts @@ -56,12 +56,12 @@ const createService = (envOverrides?: Partial) => { // ── Tests ──────────────────────────────────────────────────────────────────── describe("SettingsService", () => { - // ── loadSettings ──────────────────────────────────────────────────────── + // ── getSettings ───────────────────────────────────────────────────────── - describe("loadSettings", () => { + describe("getSettings", () => { it("returns env config mapped from constructor", () => { const { service } = createService(); - const settings = service.loadSettings(); + const settings = service.getSettings(); expect(settings).toEqual({ jwtSecret: "test-secret", @@ -82,7 +82,7 @@ describe("SettingsService", () => { CLIENT_CONFIG_LOG_LEVEL: "warn", }); - expect(service.loadSettings().clientConfig).toEqual({ + expect(service.getSettings().clientConfig).toEqual({ apiBaseUrl: "https://api.example.com/api/v1", logLevel: "warn", }); @@ -90,23 +90,13 @@ describe("SettingsService", () => { it("reflects custom env values", () => { const { service } = createService({ NODE_ENV: "production", LOG_LEVEL: "error" }); - const settings = service.loadSettings(); + const settings = service.getSettings(); expect(settings.nodeEnv).toBe("production"); expect(settings.logLevel).toBe("error"); }); }); - // ── getSettings ───────────────────────────────────────────────────────── - - describe("getSettings", () => { - it("returns the same config as loadSettings", () => { - const { service } = createService(); - - expect(service.getSettings()).toEqual(service.loadSettings()); - }); - }); - // ── areStatusPageThemesEnabled ────────────────────────────────────────── describe("areStatusPageThemesEnabled", () => {