remove unused static vars
This commit is contained in:
1 parent
4949acac1c
commit
80d4e818f1
12 files changed
+9
-53
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -56,12 +56,12 @@ const createService = (envOverrides?: Partial<ValidatedEnv>) => {
|
||||
// ── 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", () => {
|
||||
|
||||
Reference in new issue
Block a user