diff --git a/src/application/sim-controller.ts b/src/application/monitor-controller.ts similarity index 80% rename from src/application/sim-controller.ts rename to src/application/monitor-controller.ts index 343da21..e69ecff 100644 --- a/src/application/sim-controller.ts +++ b/src/application/monitor-controller.ts @@ -1,10 +1,10 @@ import { type Request, type Response, type NextFunction } from 'express'; -import { SimUsecases } from './sim-usecases.js'; +import { MonitorUsecases } from './monitor-usecases.js'; import ejs from 'ejs'; import path from 'path'; -export class SimController { - constructor(private usecases: SimUsecases) {} +export class MonitorController { + constructor(private usecases: MonitorUsecases) {} renderDashboard = async (_req: Request, res: Response, next: NextFunction) => { try { diff --git a/src/application/sim-usecases.ts b/src/application/monitor-usecases.ts similarity index 98% rename from src/application/sim-usecases.ts rename to src/application/monitor-usecases.ts index 936cd0f..e098c22 100644 --- a/src/application/sim-usecases.ts +++ b/src/application/monitor-usecases.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import { type Pool } from 'pg'; import { type Proyecto, RepositoryError } from '../domain/common.js'; -export class SimUsecases { +export class MonitorUsecases { constructor(private db: Pool) {} async checkAllProjectsHealth(): Promise { diff --git a/src/index.ts b/src/index.ts index 55fd278..88da15e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ import express from "express"; import type { Request, Response, NextFunction } from "express"; import path from "path"; -import { createRouter } from "./infrastructure/sim-routes-http.js"; -import { SimUsecases } from "./application/sim-usecases.js"; +import { createRouter } from "./infrastructure/monitor-routes-http.js"; +import { MonitorUsecases } from "./application/monitor-usecases.js"; import { pool } from "./config/postgreConfig.js"; import { AppError } from "./domain/common.js"; @@ -14,7 +14,7 @@ app.use(express.json()); app.set("view engine", "ejs"); app.set("views", path.join(process.cwd(), "src/views")); -const monitorJob = new SimUsecases(pool); +const monitorJob = new MonitorUsecases(pool); app.use("/", createRouter(monitorJob)); @@ -49,4 +49,4 @@ app.use((err: Error, req: Request, res: Response, _next: NextFunction) => { app.listen(port, () => { console.log(`Server is running on port ${port}`); -}); \ No newline at end of file +}); diff --git a/src/infrastructure/monitor-routes-http.ts b/src/infrastructure/monitor-routes-http.ts new file mode 100644 index 0000000..2ff66f6 --- /dev/null +++ b/src/infrastructure/monitor-routes-http.ts @@ -0,0 +1,10 @@ +import { Router } from 'express'; +import { MonitorController } from '../application/monitor-controller.js'; +import { MonitorUsecases } from '../application/monitor-usecases.js'; + +export function createRouter(usecases: MonitorUsecases): Router { + const router = Router(); + const controller = new MonitorController(usecases); + router.get('/', controller.renderDashboard); + return router; +} diff --git a/src/infrastructure/sim-routes-http.ts b/src/infrastructure/sim-routes-http.ts deleted file mode 100644 index 1764b80..0000000 --- a/src/infrastructure/sim-routes-http.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Router } from 'express'; -import { SimController } from '../application/sim-controller.js'; -import { SimUsecases } from '../application/sim-usecases.js'; - -export function createRouter(usecases: SimUsecases): Router { - const router = Router(); - const controller = new SimController(usecases); - router.get('/', controller.renderDashboard); - return router; -} \ No newline at end of file