diff --git a/server/src/index.ts b/server/src/index.ts index 7a73f005..a6e39c69 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -9,7 +9,7 @@ import { connectDB } from "./config/connectDB"; import routes from "./presentation/routers/index"; import { CLIENT_URL, PORT } from "./config/env"; import { webhook } from "./presentation/routers/appointment/AppointmentRoutes"; -import { initializeSocketIO } from "./presentation/socket"; +import initializeSocketIO from "./presentation/socket"; const port = PORT || 8080; diff --git a/server/src/presentation/socket/SocketServer/SocketServer.ts b/server/src/presentation/socket/SocketServer.ts similarity index 87% rename from server/src/presentation/socket/SocketServer/SocketServer.ts rename to server/src/presentation/socket/SocketServer.ts index 7539f13e..6aa92a16 100644 --- a/server/src/presentation/socket/SocketServer/SocketServer.ts +++ b/server/src/presentation/socket/SocketServer.ts @@ -1,7 +1,7 @@ import { Server } from "socket.io"; import { Server as HTTPServer } from "http"; -import { CLIENT_URL } from "../../../config/env"; -import logger from "../../../utils/logger"; +import { CLIENT_URL } from "../../config/env"; +import logger from "../../utils/logger"; export default class SocketServer { private io: Server; diff --git a/server/src/presentation/socket/index.ts b/server/src/presentation/socket/index.ts index eef90c72..58bb3ee2 100644 --- a/server/src/presentation/socket/index.ts +++ b/server/src/presentation/socket/index.ts @@ -5,17 +5,17 @@ import AppointmentRepository from "../../infrastructure/repositories/Appointment import UpdateAppointmentUseCase from "../../use_case/appointment/UpdateAppointmentUseCase"; import MessageRepository from "../../infrastructure/repositories/MessageRepository"; import PatientRepository from "../../infrastructure/repositories/PatientRepository"; +import NotificationSocketManager from "./socketManagers/NotificationSocketManager"; import DoctorRepository from "../../infrastructure/repositories/DoctorRepository"; +import NotificationUseCase from "../../use_case/notification/NotificationUseCae"; import ChatRepository from "../../infrastructure/repositories/ChatRepository"; import CreateChatUseCase from "../../use_case/chat/CreateChatUseCase"; +import VideoSocketManager from "./socketManagers/VideoSocketManager"; +import ChatSocketManager from "./socketManagers/ChatSocketManager"; import JoiService from "../../infrastructure/services/JoiService"; import JWTService from "../../infrastructure/services/JWTService"; import GetChatUseCase from "../../use_case/chat/GetChatUseCase"; -import VideoSocketManager from "./video/VideoSocketManager"; -import ChatSocketManager from "./chat/ChatSocketManager"; -import SocketServer from "./SocketServer/SocketServer"; -import NotificationSocketManager from "./notification/NotificationSocketManager"; -import NotificationUseCase from "../../use_case/notification/NotificationUseCae"; +import SocketServer from "./SocketServer"; const tokenService = new JWTService(); const validationService = new JoiService(); @@ -41,10 +41,12 @@ const notificationUseCase = new NotificationUseCase( notificationRepository, validationService ) -export function initializeSocketIO(server: HTTPServer) { +const initializeSocketIO = (server: HTTPServer) => { const socketServer = new SocketServer(server); const io = socketServer.getIO() new VideoSocketManager(io, updateAppointmentUseCase, tokenService); new ChatSocketManager(io, tokenService, createChatUseCase, getChatUseCase); new NotificationSocketManager(io, notificationUseCase, tokenService) } + +export default initializeSocketIO; \ No newline at end of file diff --git a/server/src/presentation/socket/chat/ChatSocketManager.ts b/server/src/presentation/socket/socketManagers/ChatSocketManager.ts similarity index 100% rename from server/src/presentation/socket/chat/ChatSocketManager.ts rename to server/src/presentation/socket/socketManagers/ChatSocketManager.ts diff --git a/server/src/presentation/socket/notification/NotificationSocketManager.ts b/server/src/presentation/socket/socketManagers/NotificationSocketManager.ts similarity index 100% rename from server/src/presentation/socket/notification/NotificationSocketManager.ts rename to server/src/presentation/socket/socketManagers/NotificationSocketManager.ts diff --git a/server/src/presentation/socket/video/VideoSocketManager.ts b/server/src/presentation/socket/socketManagers/VideoSocketManager.ts similarity index 100% rename from server/src/presentation/socket/video/VideoSocketManager.ts rename to server/src/presentation/socket/socketManagers/VideoSocketManager.ts