Add static name exports to all services

This commit is contained in:
Alex Holliday committed 2024-12-24 11:58:26 -08:00
1 parent 7c1442e32f
commit 8b0af64761
6 files changed
+17 -4

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ const SERVICE_NAME = "EmailService";
* Represents an email service that can load templates, build, and send emails. * Represents an email service that can load templates, build, and send emails.
*/ */
class EmailService { class EmailService {
static SERVICE_NAME = SERVICE_NAME;
/** /**
* Constructs an instance of the EmailService, initializing template loaders and the email transporter. * Constructs an instance of the EmailService, initializing template loaders and the email transporter.
* @param {Object} settingsService - The settings service to get email configuration. * @param {Object} settingsService - The settings service to get email configuration.
+3 -1
View File
@@ -1,7 +1,8 @@
const QUEUE_NAME = "monitors"; const QUEUE_NAME = "monitors";
const JOBS_PER_WORKER = 5; const JOBS_PER_WORKER = 5;
import { errorMessages, successMessages } from "../utils/messages.js";
const SERVICE_NAME = "JobQueue"; const SERVICE_NAME = "JobQueue";
import { errorMessages, successMessages } from "../utils/messages.js";
/** /**
* JobQueue * JobQueue
* *
@@ -10,6 +11,7 @@ const SERVICE_NAME = "JobQueue";
* It scales the number of workers based on the number of jobs/worker * It scales the number of workers based on the number of jobs/worker
*/ */
class JobQueue { class JobQueue {
static SERVICE_NAME = SERVICE_NAME;
/** /**
* @class JobQueue * @class JobQueue
* @classdesc Manages job queue and workers. * @classdesc Manages job queue and workers.
+4 -1
View File
@@ -1,4 +1,6 @@
import { errorMessages, successMessages } from "../utils/messages.js"; import { errorMessages, successMessages } from "../utils/messages.js";
const SERVICE_NAME = "NetworkService";
/** /**
* Constructs a new NetworkService instance. * Constructs a new NetworkService instance.
* *
@@ -8,13 +10,14 @@ import { errorMessages, successMessages } from "../utils/messages.js";
* @param {Object} http - The HTTP utility for network operations. * @param {Object} http - The HTTP utility for network operations.
*/ */
class NetworkService { class NetworkService {
static SERVICE_NAME = SERVICE_NAME;
constructor(axios, ping, logger, http, Docker) { constructor(axios, ping, logger, http, Docker) {
this.TYPE_PING = "ping"; this.TYPE_PING = "ping";
this.TYPE_HTTP = "http"; this.TYPE_HTTP = "http";
this.TYPE_PAGESPEED = "pagespeed"; this.TYPE_PAGESPEED = "pagespeed";
this.TYPE_HARDWARE = "hardware"; this.TYPE_HARDWARE = "hardware";
this.TYPE_DOCKER = "docker"; this.TYPE_DOCKER = "docker";
this.SERVICE_NAME = "NetworkService"; this.SERVICE_NAME = SERVICE_NAME;
this.NETWORK_ERROR = 5000; this.NETWORK_ERROR = 5000;
this.PING_ERROR = 5001; this.PING_ERROR = 5001;
this.axios = axios; this.axios = axios;
+4 -1
View File
@@ -1,4 +1,7 @@
const SERVICE_NAME = "NotificationService";
class NotificationService { class NotificationService {
static SERVICE_NAME = SERVICE_NAME;
/** /**
* Creates an instance of NotificationService. * Creates an instance of NotificationService.
* *
@@ -7,7 +10,7 @@ class NotificationService {
* @param {Object} logger - The logger instance for logging activities. * @param {Object} logger - The logger instance for logging activities.
*/ */
constructor(emailService, db, logger) { constructor(emailService, db, logger) {
this.SERVICE_NAME = "NotificationService"; this.SERVICE_NAME = SERVICE_NAME;
this.emailService = emailService; this.emailService = emailService;
this.db = db; this.db = db;
this.logger = logger; this.logger = logger;
+1
View File
@@ -25,6 +25,7 @@ const envConfig = {
* from the database if they are not set in the environment. * from the database if they are not set in the environment.
*/ */
class SettingsService { class SettingsService {
static SERVICE_NAME = SERVICE_NAME;
/** /**
* Constructs a new SettingsService * Constructs a new SettingsService
* @constructor * @constructor
+4 -1
View File
@@ -1,4 +1,7 @@
const SERVICE_NAME = "StatusService";
class StatusService { class StatusService {
static SERVICE_NAME = SERVICE_NAME;
/** /**
* Creates an instance of StatusService. * Creates an instance of StatusService.
* *
@@ -8,7 +11,7 @@ class StatusService {
constructor(db, logger) { constructor(db, logger) {
this.db = db; this.db = db;
this.logger = logger; this.logger = logger;
this.SERVICE_NAME = "StatusService"; this.SERVICE_NAME = SERVICE_NAME;
} }
getStatusString = (status) => { getStatusString = (status) => {