reorg to domain and api
This commit is contained in:
1 parent
0fb210e9e1
commit
d022f7d849
190 files changed
+643
-830
No files matched your search
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { requireTeamId, requireUserEmail, requireUserId, requireUserRoles } from "@/controllers/controllerUtils.js";
|
import { requireTeamId, requireUserEmail, requireUserId, requireUserRoles } from "@/api/controllers/controllerUtils.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
registrationBodyValidation,
|
registrationBodyValidation,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
recoveryValidation,
|
recoveryValidation,
|
||||||
recoveryTokenBodyValidation,
|
recoveryTokenBodyValidation,
|
||||||
newPasswordValidation,
|
newPasswordValidation,
|
||||||
} from "@/validation/authValidation.js";
|
} from "@/api/validation/authValidation.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
editUserBodyValidation,
|
editUserBodyValidation,
|
||||||
@@ -18,8 +18,8 @@ import {
|
|||||||
editUserByIdBodyValidation,
|
editUserByIdBodyValidation,
|
||||||
editSuperadminUserByIdBodyValidation,
|
editSuperadminUserByIdBodyValidation,
|
||||||
editUserPasswordByIdBodyValidation,
|
editUserPasswordByIdBodyValidation,
|
||||||
} from "@/validation/userValidation.js";
|
} from "@/api/validation/userValidation.js";
|
||||||
import { IUserService } from "@/service/index.js";
|
import { IUserService } from "@/domain/users/user.service.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "authController";
|
const SERVICE_NAME = "authController";
|
||||||
|
|
||||||
+3
-3
@@ -6,9 +6,9 @@ import {
|
|||||||
getTeamChecksQueryValidation,
|
getTeamChecksQueryValidation,
|
||||||
getChecksSummaryByTeamIdQueryValidation,
|
getChecksSummaryByTeamIdQueryValidation,
|
||||||
deleteChecksParamValidation,
|
deleteChecksParamValidation,
|
||||||
} from "@/validation/checkValidation.js";
|
} from "@/api/validation/checkValidation.js";
|
||||||
import { ICheckService } from "@/service/index.js";
|
import { ICheckService } from "@/domain/checks/check.service.js";
|
||||||
import { requireTeamId } from "@/controllers/controllerUtils.js";
|
import { requireTeamId } from "@/api/controllers/controllerUtils.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "checkController";
|
const SERVICE_NAME = "checkController";
|
||||||
|
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { Monitor, type MonitorType, MonitorTypes, UserRole } from "@/types/index.js";
|
import { Monitor, MonitorTypes, type MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
|
import { UserRole } from "@/domain/users/user.type.js";
|
||||||
import sslChecker, { SSLDetails } from "ssl-checker";
|
import sslChecker, { SSLDetails } from "ssl-checker";
|
||||||
type SSLCheckerType = typeof sslChecker;
|
type SSLCheckerType = typeof sslChecker;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { IDiagnosticService } from "@/service/index.js";
|
import { IDiagnosticService } from "@/domain/diagnostics/diagnostic.service.js";
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
|
|
||||||
const SERVICE_NAME = "diagnosticController";
|
const SERVICE_NAME = "diagnosticController";
|
||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { getChecksParamValidation, getChecksQueryValidation } from "@/validation/checkValidation.js";
|
import { getChecksParamValidation, getChecksQueryValidation } from "@/api/validation/checkValidation.js";
|
||||||
import type { IGeoChecksService } from "@/service/business/geoChecksService.js";
|
import type { IGeoChecksService } from "@/domain/geo-checks/geo-check.service.js";
|
||||||
import { requireTeamId } from "./controllerUtils.js";
|
import { requireTeamId } from "./controllerUtils.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
|
||||||
|
|
||||||
const SERVICE_NAME = "geoCheckController";
|
const SERVICE_NAME = "geoCheckController";
|
||||||
|
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { requireTeamId, requireUserId, requireUserEmail, extractString } from "./controllerUtils.js";
|
import { requireTeamId, requireUserId, requireUserEmail, extractString } from "./controllerUtils.js";
|
||||||
import { IIncidentService } from "@/service/index.js";
|
import { IIncidentService } from "@/domain/incidents/incident.service.js";
|
||||||
import { getIncidentsByTeamQueryValidation, getIncidentSummaryQueryValidation } from "@/validation/incidentValidation.js";
|
import { getIncidentsByTeamQueryValidation, getIncidentSummaryQueryValidation } from "@/api/validation/incidentValidation.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "IncidentController";
|
const SERVICE_NAME = "IncidentController";
|
||||||
|
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { inviteBodyValidation, inviteVerificationBodyValidation } from "@/validation/authValidation.js";
|
import { inviteBodyValidation, inviteVerificationBodyValidation } from "@/api/validation/authValidation.js";
|
||||||
import { requireFirstName, requireTeamId, requireUserRoles } from "@/controllers/controllerUtils.js";
|
import { requireFirstName, requireTeamId, requireUserRoles } from "@/api/controllers/controllerUtils.js";
|
||||||
import { IInviteService } from "@/service/index.js";
|
import { IInviteService } from "@/domain/invites/invite.service.js";
|
||||||
const SERVICE_NAME = "inviteController";
|
const SERVICE_NAME = "inviteController";
|
||||||
|
|
||||||
export interface IInviteController {
|
export interface IInviteController {
|
||||||
File renamed without changes.
+3
-3
@@ -7,9 +7,9 @@ import {
|
|||||||
getMaintenanceWindowsByMonitorIdParamValidation,
|
getMaintenanceWindowsByMonitorIdParamValidation,
|
||||||
getMaintenanceWindowsByTeamIdQueryValidation,
|
getMaintenanceWindowsByTeamIdQueryValidation,
|
||||||
deleteMaintenanceWindowByIdParamValidation,
|
deleteMaintenanceWindowByIdParamValidation,
|
||||||
} from "@/validation/maintenanceWindowValidation.js";
|
} from "@/api/validation/maintenanceWindowValidation.js";
|
||||||
import { requireTeamId } from "@/controllers/controllerUtils.js";
|
import { requireTeamId } from "@/api/controllers/controllerUtils.js";
|
||||||
import { IMaintenanceWindowService } from "@/service/index.js";
|
import { IMaintenanceWindowService } from "@/domain/maintenance-windows/maintenance-window.service.js";
|
||||||
|
|
||||||
export interface IMaintenanceWindowController {
|
export interface IMaintenanceWindowController {
|
||||||
createMaintenanceWindows: (req: Request, res: Response, next: NextFunction) => Promise<Response | void>;
|
createMaintenanceWindows: (req: Request, res: Response, next: NextFunction) => Promise<Response | void>;
|
||||||
+5
-4
@@ -1,5 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { updateNotificationsValidation } from "@/validation/notificationValidation.js";
|
import { updateNotificationsValidation } from "@/api/validation/notificationValidation.js";
|
||||||
import {
|
import {
|
||||||
getMonitorByIdParamValidation,
|
getMonitorByIdParamValidation,
|
||||||
getMonitorByIdQueryValidation,
|
getMonitorByIdQueryValidation,
|
||||||
@@ -15,11 +15,12 @@ import {
|
|||||||
getUptimeDetailsByIdQueryValidation,
|
getUptimeDetailsByIdQueryValidation,
|
||||||
importMonitorsBodyValidation,
|
importMonitorsBodyValidation,
|
||||||
bulkPauseMonitorBodyValidation,
|
bulkPauseMonitorBodyValidation,
|
||||||
} from "@/validation/monitorValidation.js";
|
} from "@/api/validation/monitorValidation.js";
|
||||||
import sslChecker from "ssl-checker";
|
import sslChecker from "ssl-checker";
|
||||||
import { fetchMonitorCertificate, requireTeamId, requireUserId } from "@/controllers/controllerUtils.js";
|
import { fetchMonitorCertificate, requireTeamId, requireUserId } from "@/api/controllers/controllerUtils.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { IMonitorService, INotificationsService } from "@/service/index.js";
|
import { IMonitorService } from "@/domain/monitors/monitor.service.js";
|
||||||
|
import { INotificationsService } from "@/domain/notifications/notification.service.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "monitorController";
|
const SERVICE_NAME = "monitorController";
|
||||||
|
|
||||||
+3
-3
@@ -7,11 +7,11 @@ import {
|
|||||||
testNotificationBodyValidation,
|
testNotificationBodyValidation,
|
||||||
editNotificationParamValidation,
|
editNotificationParamValidation,
|
||||||
testAllNotificationsBodyValidation,
|
testAllNotificationsBodyValidation,
|
||||||
} from "@/validation/notificationValidation.js";
|
} from "@/api/validation/notificationValidation.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { INotificationsService } from "@/service/index.js";
|
import { INotificationsService } from "@/domain/notifications/notification.service.js";
|
||||||
import { requireTeamId, requireUserId } from "./controllerUtils.js";
|
import { requireTeamId, requireUserId } from "./controllerUtils.js";
|
||||||
import { IMonitorsRepository } from "@/repositories/index.js";
|
import { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "NotificationController";
|
const SERVICE_NAME = "NotificationController";
|
||||||
|
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { IJobQueue } from "@/service/index.js";
|
import { IJobQueue } from "@/service/job-queues/job-queue.interface.js";
|
||||||
import { getQueueJobsQueryValidation } from "@/validation/queueValidation.js";
|
import { getQueueJobsQueryValidation } from "@/api/validation/queueValidation.js";
|
||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
|
|
||||||
const SERVICE_NAME = "JobQueueController";
|
const SERVICE_NAME = "JobQueueController";
|
||||||
+5
-4
@@ -1,9 +1,10 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { updateAppSettingsBodyValidation } from "@/validation/settingsValidation.js";
|
import { updateAppSettingsBodyValidation } from "@/api/validation/settingsValidation.js";
|
||||||
import { sendTestEmailBodyValidation } from "@/validation/notificationValidation.js";
|
import { sendTestEmailBodyValidation } from "@/api/validation/notificationValidation.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { IEmailService, ISettingsService } from "@/service/index.js";
|
import { ISettingsService } from "@/domain/app-settings/app-settings.service.js";
|
||||||
import { Settings } from "@/types/settings.js";
|
import { IEmailService } from "@/service/emailService.js";
|
||||||
|
import { Settings } from "@/domain/app-settings/app-settings.type.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "SettingsController";
|
const SERVICE_NAME = "SettingsController";
|
||||||
|
|
||||||
+5
-5
@@ -5,12 +5,12 @@ import {
|
|||||||
getStatusPageParamValidation,
|
getStatusPageParamValidation,
|
||||||
getStatusPageQueryValidation,
|
getStatusPageQueryValidation,
|
||||||
imageValidation,
|
imageValidation,
|
||||||
} from "@/validation/statusPageValidation.js";
|
} from "@/api/validation/statusPageValidation.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { requireTeamId, requireUserId } from "@/controllers/controllerUtils.js";
|
import { requireTeamId, requireUserId } from "@/api/controllers/controllerUtils.js";
|
||||||
import { IStatusPageService } from "@/service/business/statusPageService.js";
|
import { IStatusPageService } from "@/domain/status-pages/status-page.service.js";
|
||||||
import { IMonitorsRepository } from "@/repositories/index.js";
|
import { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
import { ISettingsService } from "@/service/system/settingsService.js";
|
import { ISettingsService } from "@/domain/app-settings/app-settings.service.js";
|
||||||
import { NormalizeData } from "@/utils/dataUtils.js";
|
import { NormalizeData } from "@/utils/dataUtils.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "statusPageController";
|
const SERVICE_NAME = "statusPageController";
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { DEFAULT_STATUS_PAGE_THEME, DEFAULT_STATUS_PAGE_THEME_MODE, type StatusPage } from "@/types/statusPage.js";
|
import { DEFAULT_STATUS_PAGE_THEME, DEFAULT_STATUS_PAGE_THEME_MODE, type StatusPage } from "@/domain/status-pages/status-page.type.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When STATUS_PAGE_THEMES_ENABLED is false, the controller drops incoming
|
* When STATUS_PAGE_THEMES_ENABLED is false, the controller drops incoming
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { Request, Response, NextFunction } from "express";
|
import { Request, Response, NextFunction } from "express";
|
||||||
import { ITagsService } from "@/service/index.js";
|
import { ITagsService } from "@/domain/tags/tag.service.js";
|
||||||
import { requireTeamId } from "./controllerUtils.js";
|
import { requireTeamId } from "./controllerUtils.js";
|
||||||
import {
|
import {
|
||||||
createTagBodyValidation,
|
createTagBodyValidation,
|
||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
getTagByIdParamValidation,
|
getTagByIdParamValidation,
|
||||||
editTagParamValidation,
|
editTagParamValidation,
|
||||||
deleteTagParamValidation,
|
deleteTagParamValidation,
|
||||||
} from "@/validation/index.js";
|
} from "@/api/validation/index.js";
|
||||||
|
|
||||||
export interface ITagsController {
|
export interface ITagsController {
|
||||||
createTag: (req: Request, res: Response, next: NextFunction) => Promise<Response | void>;
|
createTag: (req: Request, res: Response, next: NextFunction) => Promise<Response | void>;
|
||||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
|||||||
import type { Request, Response, NextFunction } from "express";
|
import type { Request, Response, NextFunction } from "express";
|
||||||
const SERVICE_NAME = "allowedRoles";
|
const SERVICE_NAME = "allowedRoles";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import type { UserRole } from "@/types/index.js";
|
import type { UserRole } from "@/domain/users/user.type.js";
|
||||||
|
|
||||||
const isAllowed = (allowedRoles: UserRole[]) => {
|
const isAllowed = (allowedRoles: UserRole[]) => {
|
||||||
return (req: Request, res: Response, next: NextFunction) => {
|
return (req: Request, res: Response, next: NextFunction) => {
|
||||||
File renamed without changes.
File renamed without changes.
@@ -2,8 +2,8 @@ import { NextFunction, Request, Response } from "express";
|
|||||||
|
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import type { ISettingsService } from "@/service/system/settingsService.js";
|
import type { ISettingsService } from "@/domain/app-settings/app-settings.service.js";
|
||||||
import type { User } from "@/types/user.js";
|
import type { User } from "@/domain/users/user.type.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "verifyJWT";
|
const SERVICE_NAME = "verifyJWT";
|
||||||
const TOKEN_PREFIX = "Bearer ";
|
const TOKEN_PREFIX = "Bearer ";
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { NextFunction, Request, RequestHandler, Response } from "express";
|
import { NextFunction, Request, RequestHandler, Response } from "express";
|
||||||
import { IStatusPagesRepository } from "@/repositories/index.js";
|
import { IStatusPagesRepository } from "@/domain/status-pages/status-page-repository.interface.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
export const createVerifyStatusPageAccess = (statusPagesRepository: IStatusPagesRepository, verifyJWT: RequestHandler) => {
|
export const createVerifyStatusPageAccess = (statusPagesRepository: IStatusPagesRepository, verifyJWT: RequestHandler) => {
|
||||||
Executable → Regular
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { Router, RequestHandler } from "express";
|
import { Router, RequestHandler } from "express";
|
||||||
import { isAllowed } from "../middleware/isAllowed.js";
|
import { isAllowed } from "../middleware/isAllowed.js";
|
||||||
import multer from "multer";
|
import multer from "multer";
|
||||||
import { IAuthController } from "@/controllers/authController.js";
|
import { IAuthController } from "@/api/controllers/authController.js";
|
||||||
|
|
||||||
const upload = multer();
|
const upload = multer();
|
||||||
|
|
||||||
Executable → Regular
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
|
|
||||||
import { isAllowed } from "../middleware/isAllowed.js";
|
import { isAllowed } from "../middleware/isAllowed.js";
|
||||||
import { ICheckController } from "@/controllers/checkController.js";
|
import { ICheckController } from "@/api/controllers/checkController.js";
|
||||||
|
|
||||||
class CheckRoutes {
|
class CheckRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
Executable → Regular
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { RequestHandler, Router } from "express";
|
import { RequestHandler, Router } from "express";
|
||||||
import { isAllowed } from "../middleware/isAllowed.js";
|
import { isAllowed } from "../middleware/isAllowed.js";
|
||||||
import { IDiagnosticController } from "@/controllers/diagnosticController.js";
|
import { IDiagnosticController } from "@/api/controllers/diagnosticController.js";
|
||||||
|
|
||||||
class DiagnosticRoutes {
|
class DiagnosticRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IGeoCheckController } from "@/controllers/geoCheckController.js";
|
import { IGeoCheckController } from "@/api/controllers/geoCheckController.js";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
|
|
||||||
class GeoCheckRoutes {
|
class GeoCheckRoutes {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import { isAllowed } from "../middleware/isAllowed.js";
|
import { isAllowed } from "../middleware/isAllowed.js";
|
||||||
import { IIncidentController } from "@/controllers/incidentController.js";
|
import { IIncidentController } from "@/api/controllers/incidentController.js";
|
||||||
|
|
||||||
class IncidentRoutes {
|
class IncidentRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
Executable → Regular
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { RequestHandler, Router } from "express";
|
import { RequestHandler, Router } from "express";
|
||||||
import { isAllowed } from "../middleware/isAllowed.js";
|
import { isAllowed } from "../middleware/isAllowed.js";
|
||||||
import { IInviteController } from "@/controllers/inviteController.js";
|
import { IInviteController } from "@/api/controllers/inviteController.js";
|
||||||
|
|
||||||
class InviteRoutes {
|
class InviteRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
Executable → Regular
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import { isAllowed } from "@/middleware/isAllowed.js";
|
import { isAllowed } from "@/api/middleware/isAllowed.js";
|
||||||
import { ILogController } from "@/controllers/logController.js";
|
import { ILogController } from "@/api/controllers/logController.js";
|
||||||
class LogRoutes {
|
class LogRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
private logController: ILogController;
|
private logController: ILogController;
|
||||||
Executable → Regular
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { IMaintenanceWindowController } from "@/controllers/maintenanceWindowController.js";
|
import { IMaintenanceWindowController } from "@/api/controllers/maintenanceWindowController.js";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
|
|
||||||
class MaintenanceWindowRoutes {
|
class MaintenanceWindowRoutes {
|
||||||
Executable → Regular
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import { isAllowed } from "@/middleware/isAllowed.js";
|
import { isAllowed } from "@/api/middleware/isAllowed.js";
|
||||||
import { IMonitorController } from "@/controllers/monitorController.js";
|
import { IMonitorController } from "@/api/controllers/monitorController.js";
|
||||||
|
|
||||||
class MonitorRoutes {
|
class MonitorRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
Executable → Regular
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { INotificationController } from "@/controllers/notificationController.js";
|
import { INotificationController } from "@/api/controllers/notificationController.js";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
class NotificationRoutes {
|
class NotificationRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
Executable → Regular
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import { isAllowed } from "@/middleware/isAllowed.js";
|
import { isAllowed } from "@/api/middleware/isAllowed.js";
|
||||||
import { IJobQueueController } from "@/controllers/queueController.js";
|
import { IJobQueueController } from "@/api/controllers/queueController.js";
|
||||||
class QueueRoutes {
|
class QueueRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
private queueController: IJobQueueController;
|
private queueController: IJobQueueController;
|
||||||
Executable → Regular
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
import { isAllowed } from "../middleware/isAllowed.js";
|
import { isAllowed } from "../middleware/isAllowed.js";
|
||||||
import { ISettingsController } from "@/controllers/settingsController.js";
|
import { ISettingsController } from "@/api/controllers/settingsController.js";
|
||||||
|
|
||||||
class SettingsRoutes {
|
class SettingsRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
Executable → Regular
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { IStatusPageController } from "@/controllers/statusPageController.js";
|
import { IStatusPageController } from "@/api/controllers/statusPageController.js";
|
||||||
import { RequestHandler, Router } from "express";
|
import { RequestHandler, Router } from "express";
|
||||||
import multer from "multer";
|
import multer from "multer";
|
||||||
const upload = multer();
|
const upload = multer();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ITagsController } from "@/controllers/tagController.js";
|
import { ITagsController } from "@/api/controllers/tagController.js";
|
||||||
import { Router } from "express";
|
import { Router } from "express";
|
||||||
class TagRoutes {
|
class TagRoutes {
|
||||||
private router: Router;
|
private router: Router;
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { passwordPattern, nameValidation, lowercaseEmailValidation } from "./shared.js";
|
import { passwordPattern, nameValidation, lowercaseEmailValidation } from "./shared.js";
|
||||||
import { UserRoles } from "@/types/user.js";
|
import { UserRoles } from "@/domain/users/user.type.js";
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// Auth Validations
|
// Auth Validations
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { booleanCoercion } from "./shared.js";
|
import { booleanCoercion } from "./shared.js";
|
||||||
import { GeoContinents } from "@/types/geoCheck.js";
|
import { GeoContinents } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
import { MonitorTypes } from "@/types/monitor.js";
|
import { MonitorTypes } from "@/domain/monitors/monitor.types.js";
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// Check Validations
|
// Check Validations
|
||||||
File renamed without changes.
@@ -9,7 +9,7 @@
|
|||||||
export * from "./shared.js";
|
export * from "./shared.js";
|
||||||
|
|
||||||
// Environment validation
|
// Environment validation
|
||||||
export * from "./envValidation.js";
|
export * from "@/config/envValidation.js";
|
||||||
|
|
||||||
// Domain-specific validations
|
// Domain-specific validations
|
||||||
export * from "./authValidation.js";
|
export * from "./authValidation.js";
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { booleanCoercion } from "./shared.js";
|
import { booleanCoercion } from "./shared.js";
|
||||||
import { DurationUnits } from "@/types/maintenanceWindow.js";
|
import { DurationUnits } from "@/domain/maintenance-windows/maintenance-window.type.js";
|
||||||
|
|
||||||
const dateToString = z.coerce.date().transform((d) => d.toISOString());
|
const dateToString = z.coerce.date().transform((d) => d.toISOString());
|
||||||
|
|
||||||
+9
-2
@@ -1,7 +1,14 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { booleanCoercion, dnsHostnameRegex, dnsServerValidation } from "./shared.js";
|
import { booleanCoercion, dnsHostnameRegex, dnsServerValidation } from "./shared.js";
|
||||||
import { GeoContinents } from "@/types/geoCheck.js";
|
import { GeoContinents } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
import { DnsRecordTypes, HttpStatusCodeSet, MonitorMatchMethods, MonitorStatuses, MonitorTypes, PageSpeedStrategies } from "@/types/monitor.js";
|
import {
|
||||||
|
DnsRecordTypes,
|
||||||
|
HttpStatusCodeSet,
|
||||||
|
MonitorMatchMethods,
|
||||||
|
MonitorStatuses,
|
||||||
|
MonitorTypes,
|
||||||
|
PageSpeedStrategies,
|
||||||
|
} from "@/domain/monitors/monitor.types.js";
|
||||||
|
|
||||||
const httpStatusCode = z.number().refine((code) => HttpStatusCodeSet.has(code), { message: "Must be a valid HTTP status code" });
|
const httpStatusCode = z.number().refine((code) => HttpStatusCodeSet.has(code), { message: "Must be a valid HTTP status code" });
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { CHECK_TTL_SENTINEL } from "@/types/check.js";
|
import { CHECK_TTL_SENTINEL } from "@/domain/checks/check.type.js";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type UserRole } from "@/types/user.js";
|
import { type UserRole } from "@/domain/users/user.type.js";
|
||||||
|
|
||||||
export const passwordPattern =
|
export const passwordPattern =
|
||||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/])[A-Za-z0-9!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/]+$/;
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/])[A-Za-z0-9!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/]+$/;
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { booleanCoercion } from "./shared.js";
|
import { booleanCoercion } from "./shared.js";
|
||||||
import { StatusPageTypes, StatusPageThemes, StatusPageThemeModes } from "@/types/statusPage.js";
|
import { StatusPageTypes, StatusPageThemes, StatusPageThemeModes } from "@/domain/status-pages/status-page.type.js";
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// Status Page Validations
|
// Status Page Validations
|
||||||
File renamed without changes.
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { UserRoles } from "@/types/user.js";
|
import { UserRoles } from "@/domain/users/user.type.js";
|
||||||
import { nameValidation, lowercaseEmailValidation, passwordValidation } from "./shared.js";
|
import { nameValidation, lowercaseEmailValidation, passwordValidation } from "./shared.js";
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
+4
-4
@@ -5,13 +5,13 @@ import helmet from "helmet";
|
|||||||
import compression from "compression";
|
import compression from "compression";
|
||||||
import cookieParser from "cookie-parser";
|
import cookieParser from "cookie-parser";
|
||||||
import swaggerUi, { type JsonObject } from "swagger-ui-express";
|
import swaggerUi, { type JsonObject } from "swagger-ui-express";
|
||||||
import { handleErrors } from "@/middleware/handleErrors.js";
|
import { handleErrors } from "@/api/middleware/handleErrors.js";
|
||||||
import { generalApiLimiter } from "@/middleware/rateLimiter.js";
|
import { generalApiLimiter } from "@/api/middleware/rateLimiter.js";
|
||||||
import { sanitizeBody, sanitizeQuery } from "@/middleware/sanitization.js";
|
import { sanitizeBody, sanitizeQuery } from "@/api/middleware/sanitization.js";
|
||||||
import { setupRoutes } from "@/config/routes.js";
|
import { setupRoutes } from "@/config/routes.js";
|
||||||
import { InitializedServices } from "@/config/services.js";
|
import { InitializedServices } from "@/config/services.js";
|
||||||
import { InitializedControllers } from "@/config/controllers.js";
|
import { InitializedControllers } from "@/config/controllers.js";
|
||||||
import { EnvConfig } from "@/service/system/settingsService.js";
|
import { EnvConfig } from "@/domain/app-settings/app-settings.service.js";
|
||||||
|
|
||||||
export const createApp = ({
|
export const createApp = ({
|
||||||
services,
|
services,
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import MonitorController from "../controllers/monitorController.js";
|
import MonitorController from "../api/controllers/monitorController.js";
|
||||||
import AuthController from "../controllers/authController.js";
|
import AuthController from "../api/controllers/authController.js";
|
||||||
import SettingsController from "../controllers/settingsController.js";
|
import SettingsController from "../api/controllers/settingsController.js";
|
||||||
import CheckController from "../controllers/checkController.js";
|
import CheckController from "../api/controllers/checkController.js";
|
||||||
import GeoCheckController from "../controllers/geoCheckController.js";
|
import GeoCheckController from "../api/controllers/geoCheckController.js";
|
||||||
import InviteController from "../controllers/inviteController.js";
|
import InviteController from "../api/controllers/inviteController.js";
|
||||||
import MaintenanceWindowController from "../controllers/maintenanceWindowController.js";
|
import MaintenanceWindowController from "../api/controllers/maintenanceWindowController.js";
|
||||||
import QueueController from "../controllers/queueController.js";
|
import QueueController from "../api/controllers/queueController.js";
|
||||||
import LogController from "../controllers/logController.js";
|
import LogController from "../api/controllers/logController.js";
|
||||||
import StatusPageController from "../controllers/statusPageController.js";
|
import StatusPageController from "../api/controllers/statusPageController.js";
|
||||||
import NotificationController from "../controllers/notificationController.js";
|
import NotificationController from "../api/controllers/notificationController.js";
|
||||||
import TagsController from "../controllers/tagController.js";
|
import TagsController from "../api/controllers/tagController.js";
|
||||||
import DiagnosticController from "../controllers/diagnosticController.js";
|
import DiagnosticController from "../api/controllers/diagnosticController.js";
|
||||||
import IncidentController from "../controllers/incidentController.js";
|
import IncidentController from "../api/controllers/incidentController.js";
|
||||||
import type { InitializedServices } from "@/config/services.js";
|
import type { InitializedServices } from "@/config/services.js";
|
||||||
|
|
||||||
export interface InitializedControllers {
|
export interface InitializedControllers {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { DbTypes, QueueTypes, QueueModes } from "@/types/settings.js";
|
import { DbTypes, QueueTypes, QueueModes } from "@/domain/app-settings/app-settings.type.js";
|
||||||
import { booleanCoercion } from "./shared.js";
|
import { booleanCoercion } from "@/api/validation/shared.js";
|
||||||
|
|
||||||
const envSchema = z.object({
|
const envSchema = z.object({
|
||||||
// Server Configuration
|
// Server Configuration
|
||||||
+17
-17
@@ -1,25 +1,25 @@
|
|||||||
import type { Application } from "express";
|
import type { Application } from "express";
|
||||||
import { createVerifyJWT } from "../middleware/verifyJWT.js";
|
import { createVerifyJWT } from "../api/middleware/verifyJWT.js";
|
||||||
import { createVerifyStatusPageAccess } from "../middleware/verifyStatusPageAccess.js";
|
import { createVerifyStatusPageAccess } from "../api/middleware/verifyStatusPageAccess.js";
|
||||||
import { authApiLimiter } from "../middleware/rateLimiter.js";
|
import { authApiLimiter } from "../api/middleware/rateLimiter.js";
|
||||||
import type { InitializedControllers } from "./controllers.js";
|
import type { InitializedControllers } from "./controllers.js";
|
||||||
import type { InitializedServices } from "./services.js";
|
import type { InitializedServices } from "./services.js";
|
||||||
|
|
||||||
import AuthRoutes from "../routes/authRoute.js";
|
import AuthRoutes from "../api/routes/authRoute.js";
|
||||||
import InviteRoutes from "../routes/inviteRoute.js";
|
import InviteRoutes from "../api/routes/inviteRoute.js";
|
||||||
import MonitorRoutes from "../routes/monitorRoute.js";
|
import MonitorRoutes from "../api/routes/monitorRoute.js";
|
||||||
import CheckRoutes from "../routes/checkRoute.js";
|
import CheckRoutes from "../api/routes/checkRoute.js";
|
||||||
import GeoCheckRoutes from "../routes/geoCheckRoutes.js";
|
import GeoCheckRoutes from "../api/routes/geoCheckRoutes.js";
|
||||||
import SettingsRoutes from "../routes/settingsRoute.js";
|
import SettingsRoutes from "../api/routes/settingsRoute.js";
|
||||||
import MaintenanceWindowRoutes from "../routes/maintenanceWindowRoute.js";
|
import MaintenanceWindowRoutes from "../api/routes/maintenanceWindowRoute.js";
|
||||||
import StatusPageRoutes from "../routes/statusPageRoute.js";
|
import StatusPageRoutes from "../api/routes/statusPageRoute.js";
|
||||||
import QueueRoutes from "../routes/queueRoute.js";
|
import QueueRoutes from "../api/routes/queueRoute.js";
|
||||||
import LogRoutes from "../routes/logRoutes.js";
|
import LogRoutes from "../api/routes/logRoutes.js";
|
||||||
import DiagnosticRoutes from "../routes/diagnosticRoute.js";
|
import DiagnosticRoutes from "../api/routes/diagnosticRoute.js";
|
||||||
import NotificationRoutes from "../routes/notificationRoute.js";
|
import NotificationRoutes from "../api/routes/notificationRoute.js";
|
||||||
import TagRoutes from "../routes/tagRoutes.js";
|
import TagRoutes from "../api/routes/tagRoutes.js";
|
||||||
|
|
||||||
import IncidentRoutes from "../routes/incidentRoute.js";
|
import IncidentRoutes from "../api/routes/incidentRoute.js";
|
||||||
|
|
||||||
export const setupRoutes = (app: Application, controllers: InitializedControllers, services: InitializedServices) => {
|
export const setupRoutes = (app: Application, controllers: InitializedControllers, services: InitializedServices) => {
|
||||||
const verifyJWT = createVerifyJWT(services.settingsService);
|
const verifyJWT = createVerifyJWT(services.settingsService);
|
||||||
|
|||||||
+76
-101
@@ -1,75 +1,52 @@
|
|||||||
import { Mongoose } from "mongoose";
|
import { Mongoose } from "mongoose";
|
||||||
import MongoDB from "../db/MongoDB.js";
|
import MongoDB from "../db/db.mongo.js";
|
||||||
import { IDb } from "@/db/IDb.js";
|
import { IDb } from "@/db/db.interface.js";
|
||||||
import {
|
import { EnvConfig, ISettingsService, SettingsService } from "@/domain/app-settings/app-settings.service.js";
|
||||||
// Service classes
|
import { CheckService, ICheckService } from "@/domain/checks/check.service.js";
|
||||||
NetworkService,
|
import { DiagnosticService, IDiagnosticService } from "@/domain/diagnostics/diagnostic.service.js";
|
||||||
EmailService,
|
import { GeoChecksService, IGeoChecksService } from "@/domain/geo-checks/geo-check.service.js";
|
||||||
BufferService,
|
import { IIncidentService, IncidentService } from "@/domain/incidents/incident.service.js";
|
||||||
GlobalPingService,
|
import { IInviteService, InviteService } from "@/domain/invites/invite.service.js";
|
||||||
LessSimpleQueue,
|
import { IMaintenanceWindowService, MaintenanceWindowService } from "@/domain/maintenance-windows/maintenance-window.service.js";
|
||||||
SuperSimpleQueue,
|
import { IMonitorService, MonitorService } from "@/domain/monitors/monitor.service.js";
|
||||||
QueueHelper,
|
import { INotificationMessageBuilder, NotificationMessageBuilder } from "@/domain/notifications/notification.message-builder.js";
|
||||||
NotificationsService,
|
import { INotificationsService, NotificationsService } from "@/domain/notifications/notification.service.js";
|
||||||
TagsService,
|
import { DiscordProvider } from "@/domain/notifications/providers/discord.js";
|
||||||
StatusService,
|
import { EmailProvider } from "@/domain/notifications/providers/email.js";
|
||||||
NotificationMessageBuilder,
|
import { MatrixProvider } from "@/domain/notifications/providers/matrix.js";
|
||||||
MonitorService,
|
import { NtfyProvider } from "@/domain/notifications/providers/ntfy.js";
|
||||||
StatusPageService,
|
import { PagerDutyProvider } from "@/domain/notifications/providers/pagerduty.js";
|
||||||
UserService,
|
import { PushoverProvider } from "@/domain/notifications/providers/pushover.js";
|
||||||
CheckService,
|
import { SlackProvider } from "@/domain/notifications/providers/slack.js";
|
||||||
GeoChecksService,
|
import { TeamsProvider } from "@/domain/notifications/providers/teams.js";
|
||||||
DiagnosticService,
|
import { TelegramProvider } from "@/domain/notifications/providers/telegram.js";
|
||||||
InviteService,
|
import { TwilioProvider } from "@/domain/notifications/providers/twilio.js";
|
||||||
MaintenanceWindowService,
|
import { WebhookProvider } from "@/domain/notifications/providers/webhook.js";
|
||||||
IncidentService,
|
import { IStatusPageService, StatusPageService } from "@/domain/status-pages/status-page.service.js";
|
||||||
// Notification providers
|
import { ITagsService, TagsService } from "@/domain/tags/tag.service.js";
|
||||||
WebhookProvider,
|
import { IUserService, UserService } from "@/domain/users/user.service.js";
|
||||||
SlackProvider,
|
import { BufferService, IBufferService } from "@/service/bufferService.js";
|
||||||
EmailProvider,
|
import { EmailService, IEmailService } from "@/service/emailService.js";
|
||||||
DiscordProvider,
|
import { GlobalPingService } from "@/service/globalPingService.js";
|
||||||
PagerDutyProvider,
|
import { QueueHelper } from "@/service/job-queues/job-queue.helper.js";
|
||||||
MatrixProvider,
|
import { IJobQueue } from "@/service/job-queues/job-queue.interface.js";
|
||||||
TeamsProvider,
|
import { LessSimpleQueue } from "@/service/job-queues/job-queue.less-simple.js";
|
||||||
TelegramProvider,
|
import { SuperSimpleQueue } from "@/service/job-queues/job-queue.sumper-simple.js";
|
||||||
PushoverProvider,
|
import { INetworkService, NetworkService } from "@/service/networkService.js";
|
||||||
TwilioProvider,
|
import { IStatusService, StatusService } from "@/service/statusService.js";
|
||||||
NtfyProvider,
|
|
||||||
// Interfaces
|
|
||||||
INetworkService,
|
|
||||||
IEmailService,
|
|
||||||
IBufferService,
|
|
||||||
IJobQueue,
|
|
||||||
INotificationsService,
|
|
||||||
ITagsService,
|
|
||||||
IStatusService,
|
|
||||||
IMonitorService,
|
|
||||||
IUserService,
|
|
||||||
ICheckService,
|
|
||||||
IGeoChecksService,
|
|
||||||
IDiagnosticService,
|
|
||||||
IInviteService,
|
|
||||||
IMaintenanceWindowService,
|
|
||||||
IStatusPageService,
|
|
||||||
IIncidentService,
|
|
||||||
INotificationMessageBuilder,
|
|
||||||
ISettingsService,
|
|
||||||
SettingsService,
|
|
||||||
EnvConfig,
|
|
||||||
} from "@/service/index.js";
|
|
||||||
|
|
||||||
// Network providers
|
// Network providers
|
||||||
import { PingProvider } from "@/service/infrastructure/network/PingProvider.js";
|
import { PingProvider } from "@/service/network/PingProvider.js";
|
||||||
import { HttpProvider } from "@/service/infrastructure/network/HttpProvider.js";
|
import { HttpProvider } from "@/service/network/HttpProvider.js";
|
||||||
import { AdvancedMatcher } from "@/service/infrastructure/network/AdvancedMatcher.js";
|
import { AdvancedMatcher } from "@/service/network/AdvancedMatcher.js";
|
||||||
import { PageSpeedProvider } from "@/service/infrastructure/network/PageSpeedProvider.js";
|
import { PageSpeedProvider } from "@/service/network/PageSpeedProvider.js";
|
||||||
import { HardwareProvider } from "@/service/infrastructure/network/HardwareProvider.js";
|
import { HardwareProvider } from "@/service/network/HardwareProvider.js";
|
||||||
import { DockerProvider } from "@/service/infrastructure/network/DockerProvider.js";
|
import { DockerProvider } from "@/service/network/DockerProvider.js";
|
||||||
import { PortProvider } from "@/service/infrastructure/network/PortProvider.js";
|
import { PortProvider } from "@/service/network/PortProvider.js";
|
||||||
import { GameProvider } from "@/service/infrastructure/network/GameProvider.js";
|
import { GameProvider } from "@/service/network/GameProvider.js";
|
||||||
import { GrpcProvider } from "@/service/infrastructure/network/GrpcProvider.js";
|
import { GrpcProvider } from "@/service/network/GrpcProvider.js";
|
||||||
import { WebSocketProvider } from "@/service/infrastructure/network/WebSocketProvider.js";
|
import { WebSocketProvider } from "@/service/network/WebSocketProvider.js";
|
||||||
import { DNSProvider } from "@/service/infrastructure/network/DNSProvider.js";
|
import { DNSProvider } from "@/service/network/DNSProvider.js";
|
||||||
|
|
||||||
// Third-party
|
// Third-party
|
||||||
import { Resolver } from "dns/promises";
|
import { Resolver } from "dns/promises";
|
||||||
@@ -93,40 +70,38 @@ import * as protoLoader from "@grpc/proto-loader";
|
|||||||
import WebSocket from "ws";
|
import WebSocket from "ws";
|
||||||
|
|
||||||
// Repositories
|
// Repositories
|
||||||
import {
|
import { ISettingsRepository } from "@/domain/app-settings/app-settings-repository.interface.js";
|
||||||
MongoMonitorsRepository,
|
import MongoSettingsRepository from "@/domain/app-settings/app-settings.repository.mongo.js";
|
||||||
MongoChecksRepository,
|
import { IChecksRepository } from "@/domain/checks/check.repository.interface.js";
|
||||||
MongoGeoChecksRepository,
|
import MongoChecksRepository from "@/domain/checks/check.repository.mongo.js";
|
||||||
MongoMonitorStatsRepository,
|
import { IGeoChecksRepository } from "@/domain/geo-checks/geo-check.repository.interface.js";
|
||||||
MongoStatusPagesRepository,
|
import MongoGeoChecksRepository from "@/domain/geo-checks/geo-check.repository.mongo.js";
|
||||||
MongoUsersRepository,
|
import { IIncidentsRepository } from "@/domain/incidents/incident.repository.interface.js";
|
||||||
MongoInvitesRepository,
|
import MongoIncidentsRepository from "@/domain/incidents/incident.repository.mongo.js";
|
||||||
MongoRecoveryTokensRepository,
|
import { IInvitesRepository } from "@/domain/invites/invite.repository.interface.js";
|
||||||
MongoNotificationsRepository,
|
import MongoInvitesRepository from "@/domain/invites/invite.repository.mongo.js";
|
||||||
MongoTagsRepository,
|
import { IMaintenanceWindowsRepository } from "@/domain/maintenance-windows/maintenance-window.repository.interface.js";
|
||||||
MongoIncidentsRepository,
|
import MongoMaintenanceWindowsRepository from "@/domain/maintenance-windows/maintenance-window.repository.mongo.js";
|
||||||
MongoTeamsRepository,
|
import { IMonitorStatsRepository } from "@/domain/monitor-stats/monitor-stats.repository.interface.js";
|
||||||
MongoMaintenanceWindowsRepository,
|
import MongoMonitorStatsRepository from "@/domain/monitor-stats/monitor-stats.repository.mongo.js";
|
||||||
MongoSettingsRepository,
|
import { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
MongoQueueWorkersRepository,
|
import MongoMonitorsRepository from "@/domain/monitors/monitor.repository.mongo.js";
|
||||||
IMonitorsRepository,
|
import { INotificationsRepository } from "@/domain/notifications/notification.repository.interface.js";
|
||||||
IChecksRepository,
|
import MongoNotificationsRepository from "@/domain/notifications/notification.repository.mongo.js";
|
||||||
IGeoChecksRepository,
|
import MongoQueueWorkersRepository from "@/domain/queue-workers/queue-worker.repository.mongo.js";
|
||||||
IMonitorStatsRepository,
|
import { IRecoveryTokensRepository } from "@/domain/recovery-tokens/recovery-token.repository.interface.js";
|
||||||
IStatusPagesRepository,
|
import MongoRecoveryTokensRepository from "@/domain/recovery-tokens/recovery-token.repository.mongo.js";
|
||||||
IUsersRepository,
|
import { IStatusPagesRepository } from "@/domain/status-pages/status-page-repository.interface.js";
|
||||||
IInvitesRepository,
|
import MongoStatusPagesRepository from "@/domain/status-pages/status-page-repository.mongo.js";
|
||||||
IRecoveryTokensRepository,
|
import { ITagsRepository } from "@/domain/tags/tag.repository.interface.js";
|
||||||
ISettingsRepository,
|
import MongoTagsRepository from "@/domain/tags/tag.repository.mongo.js";
|
||||||
INotificationsRepository,
|
import { ITeamsRepository } from "@/domain/teams/team.repository.interface.js";
|
||||||
ITagsRepository,
|
import MongoTeamsRepository from "@/domain/teams/team.repository.model.js";
|
||||||
IIncidentsRepository,
|
import { IUsersRepository } from "@/domain/users/user.repository.interface.js";
|
||||||
ITeamsRepository,
|
import MongoUsersRepository from "@/domain/users/user.repository.mongo.js";
|
||||||
IMaintenanceWindowsRepository,
|
|
||||||
} from "@/repositories/index.js";
|
|
||||||
import { ILogger } from "@/utils/logger.js";
|
import { ILogger } from "@/utils/logger.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { type QueueMode } from "@/types/settings.js";
|
import { type QueueMode } from "@/domain/app-settings/app-settings.type.js";
|
||||||
|
|
||||||
export type InitializedServices = {
|
export type InitializedServices = {
|
||||||
settingsService: ISettingsService;
|
settingsService: ISettingsService;
|
||||||
|
|||||||
File renamed without changes.
@@ -1,11 +1,11 @@
|
|||||||
import { Mongoose } from "mongoose";
|
import { Mongoose } from "mongoose";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import AppSettings from "@/db/models/AppSettings.js";
|
import AppSettings from "@/domain/app-settings/app-settings.model.js";
|
||||||
import { runMigrations } from "@/db/migration/index.js";
|
import { runMigrations } from "@/db/migration/index.js";
|
||||||
import { ILogger } from "@/utils/logger.js";
|
import { ILogger } from "@/utils/logger.js";
|
||||||
import { EnvConfig } from "@/service/system/settingsService.js";
|
import { EnvConfig } from "@/domain/app-settings/app-settings.service.js";
|
||||||
const SERVICE_NAME = "MongoDB";
|
const SERVICE_NAME = "MongoDB";
|
||||||
import { IDb } from "@/db/IDb.js";
|
import { IDb } from "@/db/db.interface.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
class MongoDB implements IDb<Mongoose> {
|
class MongoDB implements IDb<Mongoose> {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Monitor from "@/db/models/Monitor.js";
|
import Monitor from "@/domain/monitors/monitor.model.js";
|
||||||
async function migrateStatusWindowThreshold() {
|
async function migrateStatusWindowThreshold() {
|
||||||
const monitors = await Monitor.find({ statusWindowThreshold: { $lt: 1 } });
|
const monitors = await Monitor.find({ statusWindowThreshold: { $lt: 1 } });
|
||||||
for (const monitor of monitors) {
|
for (const monitor of monitors) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MonitorStatsModel } from "../models/MonitorStats.js";
|
import { MonitorStatsModel } from "../../domain/monitor-stats/monitor-stats.model.js";
|
||||||
import { logger } from "@/utils/logger.js";
|
import { logger } from "@/utils/logger.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MonitorModel } from "../models/Monitor.js";
|
import { MonitorModel } from "../../domain/monitors/monitor.model.js";
|
||||||
import { logger } from "@/utils/logger.js";
|
import { logger } from "@/utils/logger.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { logger } from "@/utils/logger.js";
|
import { logger } from "@/utils/logger.js";
|
||||||
import StatusPageModel from "../models/StatusPage.js";
|
import StatusPageModel from "../../domain/status-pages/status-page.model.js";
|
||||||
|
|
||||||
export async function migrateStatusPageTypeToArray(): Promise<void> {
|
export async function migrateStatusPageTypeToArray(): Promise<void> {
|
||||||
const SERVICE_NAME = "Migration:MigrateStatusPageTypeToArray";
|
const SERVICE_NAME = "Migration:MigrateStatusPageTypeToArray";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { MonitorStatsModel } from "../models/MonitorStats.js";
|
import { MonitorStatsModel } from "../../domain/monitor-stats/monitor-stats.model.js";
|
||||||
import { logger } from "@/utils/logger.js";
|
import { logger } from "@/utils/logger.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import type { AnyBulkWriteOperation, Document } from "mongodb";
|
import type { AnyBulkWriteOperation, Document } from "mongodb";
|
||||||
import { logger } from "@/utils/logger.js";
|
import { logger } from "@/utils/logger.js";
|
||||||
import MaintenanceWindowModel from "../models/MaintenanceWindow.js";
|
import MaintenanceWindowModel from "../../domain/maintenance-windows/maintenance-window.model.js";
|
||||||
|
|
||||||
type GroupResult = {
|
type GroupResult = {
|
||||||
_id: {
|
_id: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { migrateStatusWindowThreshold } from "./0001_migrateStatusWindowThreshol
|
|||||||
import { convertChecksToTimeSeries } from "./0002_convertChecksToTimeSeries.js";
|
import { convertChecksToTimeSeries } from "./0002_convertChecksToTimeSeries.js";
|
||||||
import { cleanupDuplicateMonitorStats } from "./0003_cleanupDuplicateMonitorStats.js";
|
import { cleanupDuplicateMonitorStats } from "./0003_cleanupDuplicateMonitorStats.js";
|
||||||
import { fixInfrastructureThresholds } from "./0004_fixInfrastructureThresholds.js";
|
import { fixInfrastructureThresholds } from "./0004_fixInfrastructureThresholds.js";
|
||||||
import MigrationModel from "../models/Migration.js";
|
import MigrationModel from "../../domain/migrations/migration.model.js";
|
||||||
import { migrateStatusPageTypeToArray } from "./0005_migrateStatusPageTypeToArray.js";
|
import { migrateStatusPageTypeToArray } from "./0005_migrateStatusPageTypeToArray.js";
|
||||||
import { cleanupDuplicateMonitorStatsForUniqueIndex } from "./0006_cleanupDuplicateMonitorStatsForUniqueIndex.js";
|
import { cleanupDuplicateMonitorStatsForUniqueIndex } from "./0006_cleanupDuplicateMonitorStatsForUniqueIndex.js";
|
||||||
import { migrateMaintenanceWindowMonitorIdToArray } from "./0007_migrateMaintenanceWindowMonitorIdToArray.js";
|
import { migrateMaintenanceWindowMonitorIdToArray } from "./0007_migrateMaintenanceWindowMonitorIdToArray.js";
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
export * from "@/db/models/Monitor.js";
|
|
||||||
export { default as MonitorModel } from "@/db/models/Monitor.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/Check.js";
|
|
||||||
export { default as CheckModel } from "@/db/models/Check.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/MonitorStats.js";
|
|
||||||
export { default as MonitorStatsModel } from "@/db/models/MonitorStats.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/StatusPage.js";
|
|
||||||
export { default as StatusPageModel } from "@/db/models/StatusPage.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/User.js";
|
|
||||||
export { default as UserModel } from "@/db/models/User.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/Invite.js";
|
|
||||||
export { default as InviteModel } from "@/db/models/Invite.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/AppSettings.js";
|
|
||||||
export { default as AppSettingsModel } from "@/db/models/AppSettings.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/RecoveryToken.js";
|
|
||||||
export { default as RecoveryTokenModel } from "@/db/models/RecoveryToken.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/Notification.js";
|
|
||||||
export { default as NotificationModel } from "@/db/models/Notification.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/Incident.js";
|
|
||||||
export { default as IncidentModel } from "@/db/models/Incident.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/Team.js";
|
|
||||||
export { default as TeamModel } from "@/db/models/Team.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/MaintenanceWindow.js";
|
|
||||||
export { default as MaintenanceWindowModel } from "@/db/models/MaintenanceWindow.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/GeoCheck.js";
|
|
||||||
export { default as GeoCheckModel } from "@/db/models/GeoCheck.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/DLQItem.js";
|
|
||||||
export { default as DLQItemModel } from "@/db/models/DLQItem.js";
|
|
||||||
export * from "@/db/models/Tag.js";
|
|
||||||
export { default as TagModel } from "@/db/models/Tag.js";
|
|
||||||
|
|
||||||
export * from "@/db/models/QueueWorker.js";
|
|
||||||
export { default as QueueWorkerModel } from "@/db/models/QueueWorker.js";
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { Settings, SettingsUpdate } from "@/types/index.js";
|
import type { Settings, SettingsUpdate } from "@/domain/app-settings/app-settings.type.js";
|
||||||
export interface ISettingsRepository {
|
export interface ISettingsRepository {
|
||||||
// create
|
// create
|
||||||
create(settings: Partial<Settings>): Promise<Settings>;
|
create(settings: Partial<Settings>): Promise<Settings>;
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Schema, model, type Types } from "mongoose";
|
import { Schema, model, type Types } from "mongoose";
|
||||||
import type { Settings, SettingsThresholds } from "@/types/settings.js";
|
import type { Settings, SettingsThresholds } from "@/domain/app-settings/app-settings.type.js";
|
||||||
|
|
||||||
interface AppSettingsDocument extends Omit<Settings, "id" | "createdAt" | "updatedAt"> {
|
interface AppSettingsDocument extends Omit<Settings, "id" | "createdAt" | "updatedAt"> {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import mongoose, { type UpdateQuery } from "mongoose";
|
import mongoose, { type UpdateQuery } from "mongoose";
|
||||||
import { ISettingsRepository } from "@/repositories/settings/ISettingsRepository.js";
|
import { ISettingsRepository } from "@/domain/app-settings/app-settings-repository.interface.js";
|
||||||
import type { Settings, SettingsUpdate } from "@/types/index.js";
|
import type { Settings, SettingsUpdate } from "@/domain/app-settings/app-settings.type.js";
|
||||||
import { AppSettingsModel, type AppSettingsDocument } from "@/db/models/index.js";
|
import { AppSettingsModel, type AppSettingsDocument } from "@/domain/app-settings/app-settings.model.js";
|
||||||
|
|
||||||
class MongoSettingsRepository implements ISettingsRepository {
|
class MongoSettingsRepository implements ISettingsRepository {
|
||||||
private toStringId = (value?: mongoose.Types.ObjectId | string | null): string => {
|
private toStringId = (value?: mongoose.Types.ObjectId | string | null): string => {
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { ISettingsRepository } from "@/repositories/index.js";
|
import { ISettingsRepository } from "@/domain/app-settings/app-settings-repository.interface.js";
|
||||||
import { type DbType, type QueueType, type QueueMode, Settings, SettingsUpdate } from "@/types/index.js";
|
import { Settings, SettingsUpdate, type DbType, type QueueMode, type QueueType } from "@/domain/app-settings/app-settings.type.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { ValidatedEnv } from "@/validation/envValidation.js";
|
import { ValidatedEnv } from "@/config/envValidation.js";
|
||||||
import type { StringValue } from "ms";
|
import type { StringValue } from "ms";
|
||||||
const SERVICE_NAME = "SettingsService";
|
const SERVICE_NAME = "SettingsService";
|
||||||
|
|
||||||
@@ -7,12 +7,6 @@ export type QueueType = (typeof QueueTypes)[number];
|
|||||||
export const QueueModes = ["primary", "worker"] as const;
|
export const QueueModes = ["primary", "worker"] as const;
|
||||||
export type QueueMode = (typeof QueueModes)[number];
|
export type QueueMode = (typeof QueueModes)[number];
|
||||||
|
|
||||||
export type QueueWorker = {
|
|
||||||
workerId: string; // hostname:pid:uuid
|
|
||||||
mode: QueueMode;
|
|
||||||
lastSeenAt: number; // epoch ms of the last heartbeat
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface SettingsThresholds {
|
export interface SettingsThresholds {
|
||||||
cpu?: number;
|
cpu?: number;
|
||||||
memory?: number;
|
memory?: number;
|
||||||
@@ -50,3 +44,20 @@ export interface Settings {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type EmailTransportConfig = Pick<
|
||||||
|
Settings,
|
||||||
|
| "systemEmailHost"
|
||||||
|
| "systemEmailPort"
|
||||||
|
| "systemEmailAddress"
|
||||||
|
| "systemEmailDisplayName"
|
||||||
|
| "systemEmailPassword"
|
||||||
|
| "systemEmailUser"
|
||||||
|
| "systemEmailConnectionHost"
|
||||||
|
| "systemEmailTLSServername"
|
||||||
|
| "systemEmailSecure"
|
||||||
|
| "systemEmailPool"
|
||||||
|
| "systemEmailIgnoreTLS"
|
||||||
|
| "systemEmailRequireTLS"
|
||||||
|
| "systemEmailRejectUnauthorized"
|
||||||
|
>;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Schema, model, Types } from "mongoose";
|
import { Schema, model, Types } from "mongoose";
|
||||||
import { MonitorTypes, type MonitorType } from "@/types/monitor.js";
|
import { MonitorTypes, type MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
import type {
|
import type {
|
||||||
Check,
|
Check,
|
||||||
CheckAudits,
|
CheckAudits,
|
||||||
@@ -13,7 +13,7 @@ import type {
|
|||||||
CheckNetworkInterfaceInfo,
|
CheckNetworkInterfaceInfo,
|
||||||
GotTimings,
|
GotTimings,
|
||||||
ILighthouseAudit,
|
ILighthouseAudit,
|
||||||
} from "@/types/check.js";
|
} from "@/domain/checks/check.type.js";
|
||||||
|
|
||||||
type CheckMetadataDocument = Omit<CheckMetadata, "monitorId" | "teamId"> & {
|
type CheckMetadataDocument = Omit<CheckMetadata, "monitorId" | "teamId"> & {
|
||||||
monitorId: Types.ObjectId;
|
monitorId: Types.ObjectId;
|
||||||
+4
-4
@@ -2,12 +2,12 @@ import type {
|
|||||||
Check,
|
Check,
|
||||||
ChecksQueryResult,
|
ChecksQueryResult,
|
||||||
ChecksSummary,
|
ChecksSummary,
|
||||||
MonitorType,
|
|
||||||
PageSpeedChecksResult,
|
|
||||||
HardwareChecksResult,
|
HardwareChecksResult,
|
||||||
|
PageSpeedChecksResult,
|
||||||
UptimeChecksResult,
|
UptimeChecksResult,
|
||||||
} from "@/types/index.js";
|
} from "@/domain/checks/check.type.js";
|
||||||
import type { LatestChecksMap } from "@/repositories/checks/MongoChecksRepistory.js";
|
import type { MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
|
import type { LatestChecksMap } from "@/domain/checks/check.repository.mongo.js";
|
||||||
|
|
||||||
export interface IChecksRepository {
|
export interface IChecksRepository {
|
||||||
// create
|
// create
|
||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
import { IChecksRepository } from "@/repositories/index.js";
|
import { IChecksRepository } from "@/domain/checks/check.repository.interface.js";
|
||||||
import type {
|
import type {
|
||||||
Check,
|
Check,
|
||||||
CheckAudits,
|
CheckAudits,
|
||||||
@@ -11,9 +11,9 @@ import type {
|
|||||||
CheckMetadata,
|
CheckMetadata,
|
||||||
CheckNetworkInterfaceInfo,
|
CheckNetworkInterfaceInfo,
|
||||||
GotTimings,
|
GotTimings,
|
||||||
MonitorType,
|
} from "@/domain/checks/check.type.js";
|
||||||
} from "@/types/index.js";
|
import type { MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
import { CheckModel, type CheckDocument } from "@/db/models/index.js";
|
import { CheckModel, type CheckDocument } from "@/domain/checks/check.model.js";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { getDateForRange } from "@/utils/dataUtils.js";
|
import { getDateForRange } from "@/utils/dataUtils.js";
|
||||||
import { ILogger } from "@/utils/logger.js";
|
import { ILogger } from "@/utils/logger.js";
|
||||||
+4
-10
@@ -1,14 +1,8 @@
|
|||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { IChecksRepository, IMonitorsRepository } from "@/repositories/index.js";
|
import { IChecksRepository } from "@/domain/checks/check.repository.interface.js";
|
||||||
import type {
|
import { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
MonitorStatusResponse,
|
import type { Check, CheckErrorInfo, ChecksQueryResult, ChecksSummary, ILighthouseAudit } from "@/domain/checks/check.type.js";
|
||||||
CheckErrorInfo,
|
import type { MonitorPayloadMap, MonitorStatusResponse } from "@/types/network.js";
|
||||||
Check,
|
|
||||||
ILighthouseAudit,
|
|
||||||
ChecksQueryResult,
|
|
||||||
ChecksSummary,
|
|
||||||
MonitorPayloadMap,
|
|
||||||
} from "@/types/index.js";
|
|
||||||
import type { HardwareStatusPayload, PageSpeedStatusPayload } from "@/types/network.js";
|
import type { HardwareStatusPayload, PageSpeedStatusPayload } from "@/types/network.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { ILogger } from "@/utils/logger.js";
|
import { ILogger } from "@/utils/logger.js";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { MonitorType } from "@/types/index.js";
|
import type { MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
import type { Response } from "got";
|
import type { Response } from "got";
|
||||||
|
|
||||||
export const CHECK_TTL_SENTINEL = 366;
|
export const CHECK_TTL_SENTINEL = 366;
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import v8 from "v8";
|
import v8 from "v8";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import { IDb } from "@/db/IDb.js";
|
import { IDb } from "@/db/db.interface.js";
|
||||||
import { Mongoose } from "mongoose";
|
import { Mongoose } from "mongoose";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Schema, model, type Types } from "mongoose";
|
import { Schema, model, type Types } from "mongoose";
|
||||||
import { DLQItemTypes, DLQItemStatuses, type DLQItem } from "@/types/dlqItem.js";
|
import { DLQItemTypes, DLQItemStatuses, type DLQItem } from "@/domain/dlq/dlq.type.js";
|
||||||
|
|
||||||
export interface DLQItemDocument extends Omit<DLQItem, "id" | "monitorId" | "teamId" | "nextRetryAt" | "createdAt" | "updatedAt"> {
|
export interface DLQItemDocument extends Omit<DLQItem, "id" | "monitorId" | "teamId" | "nextRetryAt" | "createdAt" | "updatedAt"> {
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { DLQItem, DLQItemType, DLQItemStatus } from "@/types/index.js";
|
import type { DLQItem, DLQItemStatus, DLQItemType } from "@/domain/dlq/dlq.type.js";
|
||||||
|
|
||||||
export interface DLQQueryFilters {
|
export interface DLQQueryFilters {
|
||||||
type?: DLQItemType;
|
type?: DLQItemType;
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
import { DLQItemModel } from "@/db/models/index.js";
|
import { DLQItemModel } from "@/domain/dlq/dlq.model.js";
|
||||||
import type { DLQItemDocument } from "@/db/models/DLQItem.js";
|
import type { DLQItemDocument } from "@/domain/dlq/dlq.model.js";
|
||||||
import type { DLQItem } from "@/types/index.js";
|
import type { DLQItem } from "@/domain/dlq/dlq.type.js";
|
||||||
import type { IDLQRepository, DLQQueryFilters, DLQStatusCount } from "@/repositories/dlq/IDLQRepository.js";
|
import type { IDLQRepository, DLQQueryFilters, DLQStatusCount } from "@/domain/dlq/dlq.repository.interface.js";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
File renamed without changes.
@@ -1,6 +1,6 @@
|
|||||||
import { Schema, model, Types } from "mongoose";
|
import { Schema, model, Types } from "mongoose";
|
||||||
import { MonitorTypes, type MonitorType } from "@/types/monitor.js";
|
import { MonitorTypes, type MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
import type { GeoCheck, GeoCheckLocation, GeoCheckMetadata, GeoCheckResult, GeoCheckTimings } from "@/types/geoCheck.js";
|
import type { GeoCheck, GeoCheckLocation, GeoCheckMetadata, GeoCheckResult, GeoCheckTimings } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
|
|
||||||
type GeoCheckMetadataDocument = Omit<GeoCheckMetadata, "monitorId" | "teamId"> & {
|
type GeoCheckMetadataDocument = Omit<GeoCheckMetadata, "monitorId" | "teamId"> & {
|
||||||
monitorId: Types.ObjectId;
|
monitorId: Types.ObjectId;
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import type { GeoCheck, GroupedGeoCheck } from "@/types/geoCheck.js";
|
import type { GeoCheck, GroupedGeoCheck } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
import type { GeoContinent, FlatGeoCheck } from "@/types/geoCheck.js";
|
import type { GeoContinent, FlatGeoCheck } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
|
|
||||||
export interface GeoChecksQueryResult {
|
export interface GeoChecksQueryResult {
|
||||||
geoChecksCount: number;
|
geoChecksCount: number;
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
import { IGeoChecksRepository } from "./IGeoChecksRepository.js";
|
import { IGeoChecksRepository } from "./geo-check.repository.interface.js";
|
||||||
import type { GeoCheck, GeoCheckMetadata, GeoCheckResult, GroupedGeoCheck, GeoContinent, FlatGeoCheck } from "@/types/geoCheck.js";
|
import type { GeoCheck, GeoCheckMetadata, GeoCheckResult, GroupedGeoCheck, GeoContinent, FlatGeoCheck } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
import type { FlatGeoChecksQueryResult } from "./IGeoChecksRepository.js";
|
import type { FlatGeoChecksQueryResult } from "./geo-check.repository.interface.js";
|
||||||
import { GeoCheckMetadataDocument, GeoCheckModel, type GeoCheckDocument } from "@/db/models/index.js";
|
import { GeoCheckMetadataDocument, GeoCheckModel, type GeoCheckDocument } from "@/domain/geo-checks/geo-check.model.js";
|
||||||
import mongoose, { PipelineStage } from "mongoose";
|
import mongoose, { PipelineStage } from "mongoose";
|
||||||
import { getDateForRange } from "@/utils/dataUtils.js";
|
import { getDateForRange } from "@/utils/dataUtils.js";
|
||||||
import { ILogger } from "@/utils/logger.js";
|
import { ILogger } from "@/utils/logger.js";
|
||||||
+6
-5
@@ -1,9 +1,10 @@
|
|||||||
import type { Monitor, GeoCheck } from "@/types/index.js";
|
import type { GeoCheck } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
import type { GeoCheckResult, GeoContinent } from "@/types/geoCheck.js";
|
import type { Monitor } from "@/domain/monitors/monitor.types.js";
|
||||||
|
import type { GeoCheckResult, GeoContinent } from "@/domain/geo-checks/geo-check.type.js";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import type { FlatGeoChecksQueryResult, IGeoChecksRepository } from "@/repositories/index.js";
|
import type { FlatGeoChecksQueryResult, IGeoChecksRepository } from "@/domain/geo-checks/geo-check.repository.interface.js";
|
||||||
import type { IMonitorsRepository } from "@/repositories/index.js";
|
import type { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
import type { IGlobalPingService } from "@/service/infrastructure/globalPingService.js";
|
import type { IGlobalPingService } from "@/service/globalPingService.js";
|
||||||
import type { ILogger } from "@/utils/logger.js";
|
import type { ILogger } from "@/utils/logger.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { MonitorType } from "@/types/index.js";
|
import type { MonitorType } from "@/domain/monitors/monitor.types.js";
|
||||||
|
|
||||||
export const GeoContinents = ["EU", "NA", "AS", "SA", "AF", "OC"] as const;
|
export const GeoContinents = ["EU", "NA", "AS", "SA", "AF", "OC"] as const;
|
||||||
export type GeoContinent = (typeof GeoContinents)[number];
|
export type GeoContinent = (typeof GeoContinents)[number];
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Schema, model, type Types } from "mongoose";
|
import { Schema, model, type Types } from "mongoose";
|
||||||
import { IncidentResolutionTypes, type Incident } from "@/types/incident.js";
|
import { IncidentResolutionTypes, type Incident } from "@/domain/incidents/incident.type.js";
|
||||||
|
|
||||||
type IncidentDocumentBase = Omit<Incident, "id" | "monitorId" | "teamId" | "resolvedBy" | "startTime" | "endTime" | "createdAt" | "updatedAt"> & {
|
type IncidentDocumentBase = Omit<Incident, "id" | "monitorId" | "teamId" | "resolvedBy" | "startTime" | "endTime" | "createdAt" | "updatedAt"> & {
|
||||||
monitorId: Types.ObjectId;
|
monitorId: Types.ObjectId;
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import type { Incident } from "@/types/index.js";
|
import type { Incident } from "@/domain/incidents/incident.type.js";
|
||||||
import type { IncidentSummary } from "@/types/index.js";
|
import type { IncidentSummary } from "@/domain/incidents/incident.type.js";
|
||||||
export interface IIncidentsRepository {
|
export interface IIncidentsRepository {
|
||||||
// create
|
// create
|
||||||
create(incident: Partial<Incident>): Promise<Incident>;
|
create(incident: Partial<Incident>): Promise<Incident>;
|
||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
import { IncidentModel } from "@/db/models/index.js";
|
import { IncidentModel } from "@/domain/incidents/incident.model.js";
|
||||||
import type { IncidentDocument } from "@/db/models/Incident.js";
|
import type { IncidentDocument } from "@/domain/incidents/incident.model.js";
|
||||||
import type { Incident, IncidentSummary } from "@/types/index.js";
|
import type { Incident, IncidentSummary } from "@/domain/incidents/incident.type.js";
|
||||||
import type { IIncidentsRepository } from "@/repositories/index.js";
|
import type { IIncidentsRepository } from "@/domain/incidents/incident.repository.interface.js";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
+8
-5
@@ -1,12 +1,15 @@
|
|||||||
const SERVICE_NAME = "incidentService";
|
const SERVICE_NAME = "incidentService";
|
||||||
import type { Monitor } from "@/types/monitor.js";
|
import type { Monitor } from "@/domain/monitors/monitor.types.js";
|
||||||
import type { MonitorStatusResponse } from "@/types/network.js";
|
import type { MonitorStatusResponse } from "@/types/network.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { getDateForRange } from "@/utils/dataUtils.js";
|
import { getDateForRange } from "@/utils/dataUtils.js";
|
||||||
import type { IIncidentsRepository, IMonitorsRepository, IUsersRepository } from "@/repositories/index.js";
|
import type { IIncidentsRepository } from "@/domain/incidents/incident.repository.interface.js";
|
||||||
import type { Incident, IncidentSummary, User } from "@/types/index.js";
|
import type { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
import type { MonitorActionDecision } from "@/service/infrastructure/JobQueues/QueueHelper.js";
|
import type { IUsersRepository } from "@/domain/users/user.repository.interface.js";
|
||||||
import type { INotificationMessageBuilder } from "@/service/infrastructure/notificationMessageBuilder.js";
|
import type { Incident, IncidentSummary } from "@/domain/incidents/incident.type.js";
|
||||||
|
import type { User } from "@/domain/users/user.type.js";
|
||||||
|
import type { MonitorActionDecision } from "@/service/job-queues/job-queue.helper.js";
|
||||||
|
import type { INotificationMessageBuilder } from "@/domain/notifications/notification.message-builder.js";
|
||||||
import type { ILogger } from "@/utils/logger.js";
|
import type { ILogger } from "@/utils/logger.js";
|
||||||
|
|
||||||
export interface IIncidentService {
|
export interface IIncidentService {
|
||||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
|||||||
import { Schema, model, type Types } from "mongoose";
|
import { Schema, model, type Types } from "mongoose";
|
||||||
import type { Invite } from "@/types/invite.js";
|
import type { Invite } from "@/domain/invites/invite.type.js";
|
||||||
|
|
||||||
type InviteDocumentBase = Omit<Invite, "id" | "teamId" | "createdAt" | "updatedAt" | "expiry"> & {
|
type InviteDocumentBase = Omit<Invite, "id" | "teamId" | "createdAt" | "updatedAt" | "expiry"> & {
|
||||||
teamId: Types.ObjectId;
|
teamId: Types.ObjectId;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { Invite } from "@/types/index.js";
|
import type { Invite } from "@/domain/invites/invite.type.js";
|
||||||
|
|
||||||
export interface IInvitesRepository {
|
export interface IInvitesRepository {
|
||||||
// create
|
// create
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
import { IInvitesRepository } from "@/repositories/index.js";
|
import { IInvitesRepository } from "@/domain/invites/invite.repository.interface.js";
|
||||||
import type { Invite } from "@/types/index.js";
|
import type { Invite } from "@/domain/invites/invite.type.js";
|
||||||
import { type InviteDocument, InviteModel } from "@/db/models/index.js";
|
import { type InviteDocument, InviteModel } from "@/domain/invites/invite.model.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
+6
-5
@@ -1,9 +1,10 @@
|
|||||||
import type { Invite, UserRole } from "@/types/index.js";
|
import type { Invite } from "@/domain/invites/invite.type.js";
|
||||||
import { canManageRole } from "@/types/user.js";
|
import type { UserRole } from "@/domain/users/user.type.js";
|
||||||
import type { IInvitesRepository } from "@/repositories/index.js";
|
import { canManageRole } from "@/domain/users/user.type.js";
|
||||||
|
import type { IInvitesRepository } from "@/domain/invites/invite.repository.interface.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { ISettingsService } from "../system/settingsService.js";
|
import { ISettingsService } from "../app-settings/app-settings.service.js";
|
||||||
import { IEmailService } from "../infrastructure/emailService.js";
|
import { IEmailService } from "@/service/emailService.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "inviteService";
|
const SERVICE_NAME = "inviteService";
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { UserRole } from "@/types/user.js";
|
import type { UserRole } from "@/domain/users/user.type.js";
|
||||||
|
|
||||||
export interface Invite {
|
export interface Invite {
|
||||||
id: string;
|
id: string;
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Schema, model, type Types } from "mongoose";
|
import { Schema, model, type Types } from "mongoose";
|
||||||
import { DurationUnits, type MaintenanceWindow } from "@/types/maintenanceWindow.js";
|
import { DurationUnits, type MaintenanceWindow } from "@/domain/maintenance-windows/maintenance-window.type.js";
|
||||||
|
|
||||||
type MaintenanceWindowDocumentBase = Omit<MaintenanceWindow, "id" | "monitorIds" | "teamId" | "start" | "end" | "createdAt" | "updatedAt"> & {
|
type MaintenanceWindowDocumentBase = Omit<MaintenanceWindow, "id" | "monitorIds" | "teamId" | "start" | "end" | "createdAt" | "updatedAt"> & {
|
||||||
monitorIds: Types.ObjectId[];
|
monitorIds: Types.ObjectId[];
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { MaintenanceWindow } from "@/types/index.js";
|
import type { MaintenanceWindow } from "@/domain/maintenance-windows/maintenance-window.type.js";
|
||||||
export interface IMaintenanceWindowsRepository {
|
export interface IMaintenanceWindowsRepository {
|
||||||
// create
|
// create
|
||||||
create(data: Partial<MaintenanceWindow>): Promise<MaintenanceWindow>;
|
create(data: Partial<MaintenanceWindow>): Promise<MaintenanceWindow>;
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
import type { MaintenanceWindow } from "@/types/index.js";
|
import type { MaintenanceWindow } from "@/domain/maintenance-windows/maintenance-window.type.js";
|
||||||
import { type MaintenanceWindowDocument, MaintenanceWindowModel } from "@/db/models/index.js";
|
import { type MaintenanceWindowDocument, MaintenanceWindowModel } from "@/domain/maintenance-windows/maintenance-window.model.js";
|
||||||
import { IMaintenanceWindowsRepository } from "./IMaintenanceWindowsRepository.js";
|
import { IMaintenanceWindowsRepository } from "./maintenance-window.repository.interface.js";
|
||||||
import mongoose, { SortOrder } from "mongoose";
|
import mongoose, { SortOrder } from "mongoose";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
|
|
||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
import { IMaintenanceWindowsRepository, IMonitorsRepository } from "@/repositories/index.js";
|
import { IMaintenanceWindowsRepository } from "@/domain/maintenance-windows/maintenance-window.repository.interface.js";
|
||||||
import type { DurationUnit, MaintenanceWindow } from "@/types/index.js";
|
import { IMonitorsRepository } from "@/domain/monitors/monitor.repository.interface.js";
|
||||||
|
import type { DurationUnit, MaintenanceWindow } from "@/domain/maintenance-windows/maintenance-window.type.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { isWindowActive } from "@/utils/maintenanceWindow.js";
|
import { isWindowActive } from "@/utils/maintenanceWindow.js";
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
Loaded 100 of 190 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user