Skip to content

Commit

Permalink
📦 socket folder updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Oct 4, 2024
1 parent b5ff9d0 commit eeb27fa
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
14 changes: 8 additions & 6 deletions server/src/presentation/socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;

1 comment on commit eeb27fa

@vercel
Copy link

@vercel vercel bot commented on eeb27fa Oct 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.