mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-20 08:39:43 -06:00
fix: use new structure
This commit is contained in:
@@ -160,6 +160,11 @@ const startApp = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const networkService = new NetworkService(axios, ping, logger, http, Docker, net);
|
||||
const translationService = new TranslationService(logger, networkService);
|
||||
const stringService = new StringService(translationService);
|
||||
ServiceRegistry.register(StringService.SERVICE_NAME, stringService);
|
||||
|
||||
// Create DB
|
||||
const db = new MongoDB();
|
||||
await db.connect();
|
||||
@@ -176,11 +181,9 @@ const startApp = async () => {
|
||||
nodemailer,
|
||||
logger
|
||||
);
|
||||
const networkService = new NetworkService(axios, ping, logger, http, Docker, net);
|
||||
const statusService = new StatusService(db, logger);
|
||||
const notificationService = new NotificationService(emailService, db, logger);
|
||||
const translationService = new TranslationService(logger, networkService);
|
||||
const stringService = new StringService(translationService);
|
||||
|
||||
|
||||
const jobQueue = new JobQueue(
|
||||
db,
|
||||
@@ -202,7 +205,6 @@ const startApp = async () => {
|
||||
ServiceRegistry.register(StatusService.SERVICE_NAME, statusService);
|
||||
ServiceRegistry.register(NotificationService.SERVICE_NAME, notificationService);
|
||||
ServiceRegistry.register(TranslationService.SERVICE_NAME, translationService);
|
||||
ServiceRegistry.register(StringService.SERVICE_NAME, stringService);
|
||||
|
||||
await translationService.initialize();
|
||||
|
||||
|
||||
@@ -31,11 +31,9 @@ class NetworkService {
|
||||
this.http = http;
|
||||
this.Docker = Docker;
|
||||
this.net = net;
|
||||
this.stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||
|
||||
this.apiToken = process.env.POEDITOR_API_TOKEN;
|
||||
this.projectId = process.env.POEDITOR_PROJECT_ID;
|
||||
this.stringService = ServiceRegistry.get(StringService.SERVICE_NAME);
|
||||
|
||||
if (!this.apiToken || !this.projectId) {
|
||||
this.logger.error({
|
||||
@@ -101,13 +99,13 @@ class NetworkService {
|
||||
if (error) {
|
||||
pingResponse.status = false;
|
||||
pingResponse.code = this.PING_ERROR;
|
||||
pingResponse.message = this.stringService.pingCannotResolve;
|
||||
pingResponse.message = "No response";
|
||||
return pingResponse;
|
||||
}
|
||||
|
||||
pingResponse.code = 200;
|
||||
pingResponse.status = response.alive;
|
||||
pingResponse.message = this.stringService.pingSuccess;
|
||||
pingResponse.message = "Success";
|
||||
return pingResponse;
|
||||
} catch (error) {
|
||||
error.service = this.SERVICE_NAME;
|
||||
@@ -271,12 +269,12 @@ class NetworkService {
|
||||
if (error) {
|
||||
dockerResponse.status = false;
|
||||
dockerResponse.code = error.statusCode || this.NETWORK_ERROR;
|
||||
dockerResponse.message = error.reason || this.stringService.dockerFail;
|
||||
dockerResponse.message = error.reason || "Failed to fetch Docker container information";
|
||||
return dockerResponse;
|
||||
}
|
||||
dockerResponse.status = response?.State?.Status === "running" ? true : false;
|
||||
dockerResponse.code = 200;
|
||||
dockerResponse.message = this.stringService.dockerSuccess;
|
||||
dockerResponse.message = "Docker container status fetched successfully";
|
||||
return dockerResponse;
|
||||
} catch (error) {
|
||||
error.service = this.SERVICE_NAME;
|
||||
|
||||
Reference in New Issue
Block a user