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";
|
} from "@/api/validation/userValidation.js";
|
||||||
import { IUserService } from "@/domain/users/user.service.js";
|
import { IUserService } from "@/domain/users/user.service.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "authController";
|
|
||||||
|
|
||||||
export interface IAuthController {
|
export interface IAuthController {
|
||||||
registerUser: RequestHandler;
|
registerUser: RequestHandler;
|
||||||
createUser: RequestHandler;
|
createUser: RequestHandler;
|
||||||
@@ -42,8 +40,6 @@ export interface IAuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AuthController implements IAuthController {
|
class AuthController implements IAuthController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
|
|
||||||
private userService: IUserService;
|
private userService: IUserService;
|
||||||
|
|
||||||
constructor(userService: IUserService) {
|
constructor(userService: IUserService) {
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import {
|
|||||||
import { ICheckService } from "@/domain/checks/check.service.js";
|
import { ICheckService } from "@/domain/checks/check.service.js";
|
||||||
import { requireTeamId } from "@/api/controllers/controllerUtils.js";
|
import { requireTeamId } from "@/api/controllers/controllerUtils.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "checkController";
|
|
||||||
|
|
||||||
export interface ICheckController {
|
export interface ICheckController {
|
||||||
getChecksByMonitor: RequestHandler;
|
getChecksByMonitor: RequestHandler;
|
||||||
getChecksByTeam: RequestHandler;
|
getChecksByTeam: RequestHandler;
|
||||||
@@ -22,8 +20,6 @@ export interface ICheckController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CheckController implements ICheckController {
|
class CheckController implements ICheckController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
|
|
||||||
private checkService: ICheckService;
|
private checkService: ICheckService;
|
||||||
constructor(checkService: ICheckService) {
|
constructor(checkService: ICheckService) {
|
||||||
this.checkService = checkService;
|
this.checkService = checkService;
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ import { IDiagnosticService } from "@/domain/diagnostics/diagnostic.service.js";
|
|||||||
import { Request, Response, RequestHandler } from "express";
|
import { Request, Response, RequestHandler } from "express";
|
||||||
import { catchAsync } from "@/utils/catchAsync.js";
|
import { catchAsync } from "@/utils/catchAsync.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "diagnosticController";
|
|
||||||
|
|
||||||
export interface IDiagnosticController {
|
export interface IDiagnosticController {
|
||||||
getSystemStats: RequestHandler;
|
getSystemStats: RequestHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DiagnosticController implements IDiagnosticController {
|
class DiagnosticController implements IDiagnosticController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
|
|
||||||
private diagnosticService: IDiagnosticService;
|
private diagnosticService: IDiagnosticService;
|
||||||
|
|
||||||
constructor(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 type { IGeoChecksService } from "@/domain/geo-checks/geo-check.service.js";
|
||||||
import { requireTeamId } from "./controllerUtils.js";
|
import { requireTeamId } from "./controllerUtils.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "geoCheckController";
|
|
||||||
|
|
||||||
export interface IGeoCheckController {
|
export interface IGeoCheckController {
|
||||||
getGeoChecksByMonitor: RequestHandler;
|
getGeoChecksByMonitor: RequestHandler;
|
||||||
}
|
}
|
||||||
class GeoCheckController implements IGeoCheckController {
|
class GeoCheckController implements IGeoCheckController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
|
|
||||||
private geoChecksService: IGeoChecksService;
|
private geoChecksService: IGeoChecksService;
|
||||||
constructor(geoChecksService: IGeoChecksService) {
|
constructor(geoChecksService: IGeoChecksService) {
|
||||||
this.geoChecksService = geoChecksService;
|
this.geoChecksService = geoChecksService;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { catchAsync } from "@/utils/catchAsync.js";
|
|||||||
import { inviteBodyValidation, inviteVerificationBodyValidation } from "@/api/validation/authValidation.js";
|
import { inviteBodyValidation, inviteVerificationBodyValidation } from "@/api/validation/authValidation.js";
|
||||||
import { requireFirstName, requireTeamId, requireUserRoles } from "@/api/controllers/controllerUtils.js";
|
import { requireFirstName, requireTeamId, requireUserRoles } from "@/api/controllers/controllerUtils.js";
|
||||||
import { IInviteService } from "@/domain/invites/invite.service.js";
|
import { IInviteService } from "@/domain/invites/invite.service.js";
|
||||||
const SERVICE_NAME = "inviteController";
|
|
||||||
|
|
||||||
export interface IInviteController {
|
export interface IInviteController {
|
||||||
getInviteToken: RequestHandler;
|
getInviteToken: RequestHandler;
|
||||||
@@ -12,7 +11,6 @@ export interface IInviteController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class InviteController implements IInviteController {
|
class InviteController implements IInviteController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
private inviteService: IInviteService;
|
private inviteService: IInviteService;
|
||||||
constructor(inviteService: IInviteService) {
|
constructor(inviteService: IInviteService) {
|
||||||
this.inviteService = inviteService;
|
this.inviteService = inviteService;
|
||||||
|
|||||||
@@ -2,14 +2,11 @@ import { ILogger } from "@/utils/logger.js";
|
|||||||
import { Request, Response, RequestHandler } from "express";
|
import { Request, Response, RequestHandler } from "express";
|
||||||
import { catchAsync } from "@/utils/catchAsync.js";
|
import { catchAsync } from "@/utils/catchAsync.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "LogController";
|
|
||||||
|
|
||||||
export interface ILogController {
|
export interface ILogController {
|
||||||
getLogs: RequestHandler;
|
getLogs: RequestHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
class LogController {
|
class LogController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
private logger: ILogger;
|
private logger: ILogger;
|
||||||
constructor(logger: ILogger) {
|
constructor(logger: ILogger) {
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ import { AppError } from "@/utils/AppError.js";
|
|||||||
import { IMonitorService } from "@/domain/monitors/monitor.service.js";
|
import { IMonitorService } from "@/domain/monitors/monitor.service.js";
|
||||||
import { INotificationsService } from "@/domain/notifications/notification.service.js";
|
import { INotificationsService } from "@/domain/notifications/notification.service.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "monitorController";
|
|
||||||
|
|
||||||
export interface IMonitorController {
|
export interface IMonitorController {
|
||||||
getMonitorCertificate: RequestHandler;
|
getMonitorCertificate: RequestHandler;
|
||||||
getUptimeDetailsById: RequestHandler;
|
getUptimeDetailsById: RequestHandler;
|
||||||
@@ -47,8 +45,6 @@ export interface IMonitorController {
|
|||||||
updateNotifications: RequestHandler;
|
updateNotifications: RequestHandler;
|
||||||
}
|
}
|
||||||
class MonitorController implements IMonitorController {
|
class MonitorController implements IMonitorController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
|
|
||||||
private monitorService: IMonitorService;
|
private monitorService: IMonitorService;
|
||||||
private notificationsService: INotificationsService;
|
private notificationsService: INotificationsService;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { getQueueJobsQueryValidation } from "@/api/validation/queueValidation.js
|
|||||||
import { Request, Response, RequestHandler } from "express";
|
import { Request, Response, RequestHandler } from "express";
|
||||||
import { catchAsync } from "@/utils/catchAsync.js";
|
import { catchAsync } from "@/utils/catchAsync.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "JobQueueController";
|
|
||||||
|
|
||||||
export interface IJobQueueController {
|
export interface IJobQueueController {
|
||||||
getMetrics: RequestHandler;
|
getMetrics: RequestHandler;
|
||||||
getJobs: RequestHandler;
|
getJobs: RequestHandler;
|
||||||
@@ -13,7 +11,6 @@ export interface IJobQueueController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class JobQueueController implements IJobQueueController {
|
class JobQueueController implements IJobQueueController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
constructor(private scheduler: IJobScheduler) {}
|
constructor(private scheduler: IJobScheduler) {}
|
||||||
|
|
||||||
getMetrics = catchAsync(async (req: Request, res: Response) => {
|
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 { IEmailService } from "@/service/emailService.js";
|
||||||
import { Settings } from "@/domain/app-settings/app-settings.type.js";
|
import { Settings } from "@/domain/app-settings/app-settings.type.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "SettingsController";
|
|
||||||
|
|
||||||
export interface ISettingsController {
|
export interface ISettingsController {
|
||||||
getAppSettings: RequestHandler;
|
getAppSettings: RequestHandler;
|
||||||
updateAppSettings: RequestHandler;
|
updateAppSettings: RequestHandler;
|
||||||
@@ -16,7 +14,6 @@ export interface ISettingsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SettingsController implements ISettingsController {
|
class SettingsController implements ISettingsController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
private settingsService: ISettingsService;
|
private settingsService: ISettingsService;
|
||||||
private emailService: IEmailService;
|
private emailService: IEmailService;
|
||||||
constructor(settingsService: ISettingsService, 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 { IStatusPageService } from "@/domain/status-pages/status-page.service.js";
|
||||||
import { resolveStatusPageDomainFromRequest } from "@/utils/statusPageDomain.js";
|
import { resolveStatusPageDomainFromRequest } from "@/utils/statusPageDomain.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "statusPageController";
|
|
||||||
|
|
||||||
export interface IStatusPageController {
|
export interface IStatusPageController {
|
||||||
createStatusPage: RequestHandler;
|
createStatusPage: RequestHandler;
|
||||||
updateStatusPage: RequestHandler;
|
updateStatusPage: RequestHandler;
|
||||||
@@ -25,7 +23,6 @@ export interface IStatusPageController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class StatusPageController implements IStatusPageController {
|
class StatusPageController implements IStatusPageController {
|
||||||
static SERVICE_NAME = SERVICE_NAME;
|
|
||||||
private statusPageService: IStatusPageService;
|
private statusPageService: IStatusPageService;
|
||||||
constructor(statusPageService: IStatusPageService) {
|
constructor(statusPageService: IStatusPageService) {
|
||||||
this.statusPageService = statusPageService;
|
this.statusPageService = statusPageService;
|
||||||
|
|||||||
@@ -90,14 +90,14 @@ describe("EmailService", () => {
|
|||||||
it("loads all expected templates on construction", () => {
|
it("loads all expected templates on construction", () => {
|
||||||
const { mockFs } = createService();
|
const { mockFs } = createService();
|
||||||
|
|
||||||
// 6 templates loaded
|
// 5 templates loaded
|
||||||
expect(mockFs.readFileSync).toHaveBeenCalledTimes(6);
|
expect(mockFs.readFileSync).toHaveBeenCalledTimes(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("compiles each loaded template", () => {
|
it("compiles each loaded template", () => {
|
||||||
const { compile } = createService();
|
const { compile } = createService();
|
||||||
|
|
||||||
expect(compile).toHaveBeenCalledTimes(6);
|
expect(compile).toHaveBeenCalledTimes(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logs error when a template file is not found", () => {
|
it("logs error when a template file is not found", () => {
|
||||||
@@ -141,7 +141,7 @@ describe("EmailService", () => {
|
|||||||
|
|
||||||
service.init();
|
service.init();
|
||||||
|
|
||||||
expect(mockFs.readFileSync).toHaveBeenCalledTimes(initialCalls + 6);
|
expect(mockFs.readFileSync).toHaveBeenCalledTimes(initialCalls + 5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ const createService = (envOverrides?: Partial<ValidatedEnv>) => {
|
|||||||
// ── Tests ────────────────────────────────────────────────────────────────────
|
// ── Tests ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe("SettingsService", () => {
|
describe("SettingsService", () => {
|
||||||
// ── loadSettings ────────────────────────────────────────────────────────
|
// ── getSettings ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe("loadSettings", () => {
|
describe("getSettings", () => {
|
||||||
it("returns env config mapped from constructor", () => {
|
it("returns env config mapped from constructor", () => {
|
||||||
const { service } = createService();
|
const { service } = createService();
|
||||||
const settings = service.loadSettings();
|
const settings = service.getSettings();
|
||||||
|
|
||||||
expect(settings).toEqual({
|
expect(settings).toEqual({
|
||||||
jwtSecret: "test-secret",
|
jwtSecret: "test-secret",
|
||||||
@@ -82,7 +82,7 @@ describe("SettingsService", () => {
|
|||||||
CLIENT_CONFIG_LOG_LEVEL: "warn",
|
CLIENT_CONFIG_LOG_LEVEL: "warn",
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(service.loadSettings().clientConfig).toEqual({
|
expect(service.getSettings().clientConfig).toEqual({
|
||||||
apiBaseUrl: "https://api.example.com/api/v1",
|
apiBaseUrl: "https://api.example.com/api/v1",
|
||||||
logLevel: "warn",
|
logLevel: "warn",
|
||||||
});
|
});
|
||||||
@@ -90,23 +90,13 @@ describe("SettingsService", () => {
|
|||||||
|
|
||||||
it("reflects custom env values", () => {
|
it("reflects custom env values", () => {
|
||||||
const { service } = createService({ NODE_ENV: "production", LOG_LEVEL: "error" });
|
const { service } = createService({ NODE_ENV: "production", LOG_LEVEL: "error" });
|
||||||
const settings = service.loadSettings();
|
const settings = service.getSettings();
|
||||||
|
|
||||||
expect(settings.nodeEnv).toBe("production");
|
expect(settings.nodeEnv).toBe("production");
|
||||||
expect(settings.logLevel).toBe("error");
|
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 ──────────────────────────────────────────
|
// ── areStatusPageThemesEnabled ──────────────────────────────────────────
|
||||||
|
|
||||||
describe("areStatusPageThemesEnabled", () => {
|
describe("areStatusPageThemesEnabled", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user