From 2306f1d7bc026d61b67014e3e30cf0bc9279edc2 Mon Sep 17 00:00:00 2001 From: Sinan Date: Fri, 27 Sep 2024 23:28:17 +0530 Subject: [PATCH] server code updated --- package.json | 2 +- .../controllers/UnauthenticatedControllers.ts | 3 +- .../admin/AuthenticationController.ts | 10 +++- .../controllers/admin/DoctorController.ts | 7 ++- .../controllers/admin/PatientController.ts | 7 ++- .../appointment/AppointmentControllers.ts | 11 +++- .../controllers/chat/ChatControllers.ts | 12 +++- .../doctor/AuthenticationController.ts | 14 ++++- .../notification/NotificationController.ts | 7 ++- .../patient/AuthenticationController.ts | 3 +- .../controllers/patient/PatientController.ts | 4 +- .../presentation/middlewares/ErrorHandler.ts | 3 + .../presentation/routers/admin/AdminRoutes.ts | 12 ++-- .../routers/admin/AuthenticationRoutes.ts | 14 ++--- .../routers/appointment/AppointmentRoutes.ts | 60 ++++--------------- .../presentation/routers/chat/ChatRoutes.ts | 22 +++---- server/src/presentation/routers/index.ts | 4 +- .../routers/notification/NotificationRoute.ts | 45 +++----------- .../routers/patient/AuthenticationRoutes.ts | 4 +- .../routers/patient/PatientRoutes.ts | 4 +- 20 files changed, 120 insertions(+), 128 deletions(-) diff --git a/package.json b/package.json index 27224d34..970f331b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "start": "concurrently \"npm run dev --prefix client\" \"npm run dev --prefix server\"", "format": "concurrently \"npm run format --prefix client\" \"npm run format --prefix server\"", "dev": "concurrently \"npm run dev --prefix client\" \"npm run dev --prefix server\" \"stripe listen --forward-to localhost:8000/api/webhook\"", - "stripe":"stripe listen --forward-to localhost:8000/api/webhook" + "stripe": "stripe listen --forward-to localhost:8000/api/webhook" }, "devDependencies": { "concurrently": "^8.2.2" diff --git a/server/src/presentation/controllers/UnauthenticatedControllers.ts b/server/src/presentation/controllers/UnauthenticatedControllers.ts index 34546b67..ff2dd33a 100644 --- a/server/src/presentation/controllers/UnauthenticatedControllers.ts +++ b/server/src/presentation/controllers/UnauthenticatedControllers.ts @@ -3,7 +3,8 @@ import UnauthenticatedUseCases from "../../use_case/UnauthenticatedUseCases"; import { NextFunction, Request, Response } from "express"; export default class UnauthenticatedControllers { - constructor(private unauthenticatedUseCase: UnauthenticatedUseCases) {} + constructor( + private unauthenticatedUseCase: UnauthenticatedUseCases) {} async getDoctors(req: Request, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/admin/AuthenticationController.ts b/server/src/presentation/controllers/admin/AuthenticationController.ts index 7d5a3c37..d3867feb 100644 --- a/server/src/presentation/controllers/admin/AuthenticationController.ts +++ b/server/src/presentation/controllers/admin/AuthenticationController.ts @@ -3,7 +3,15 @@ import AuthenticationUseCase from "../../../use_case/admin/AuthenticationUseCase import { Cookie, StatusCode } from "../../../types"; export default class AuthenticationController { - constructor(private authUseCase: AuthenticationUseCase) {} + constructor( + private authUseCase: AuthenticationUseCase + ) { + this.login = this.login.bind(this); + this.validateOtp = this.validateOtp.bind(this); + this.resendOtp = this.resendOtp.bind(this); + this.refreshAccessToken = this.refreshAccessToken.bind(this); + this.logout = this.logout.bind(this); + } async login(req: Request, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/admin/DoctorController.ts b/server/src/presentation/controllers/admin/DoctorController.ts index 29d88d2d..803e8d83 100644 --- a/server/src/presentation/controllers/admin/DoctorController.ts +++ b/server/src/presentation/controllers/admin/DoctorController.ts @@ -4,7 +4,12 @@ import { DoctorsFilter, StatusCode } from "../../../types"; import IDoctor from "../../../domain/entities/IDoctor"; export default class AdminDoctorController { - constructor(private doctorUseCase: AdminDoctorUseCase) {} + constructor( + private doctorUseCase: AdminDoctorUseCase + ) { + this.getDoctors = this.getDoctors.bind(this); + this.updateDoctor = this.updateDoctor.bind(this); + } async getDoctors(req: Request, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/admin/PatientController.ts b/server/src/presentation/controllers/admin/PatientController.ts index 28a51820..7e0183c0 100644 --- a/server/src/presentation/controllers/admin/PatientController.ts +++ b/server/src/presentation/controllers/admin/PatientController.ts @@ -3,7 +3,12 @@ import AdminPatientUseCase from "../../../use_case/admin/PatientUseCase"; import { StatusCode } from "../../../types"; export default class AdminPatientController { - constructor(private adminPatientUseCase: AdminPatientUseCase) {} + constructor( + private adminPatientUseCase: AdminPatientUseCase + ) { + this.getPatients = this.getPatients.bind(this); + this.updatePatient = this.updatePatient.bind(this); + } async getPatients(req: Request, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/appointment/AppointmentControllers.ts b/server/src/presentation/controllers/appointment/AppointmentControllers.ts index a1472d62..fe602141 100644 --- a/server/src/presentation/controllers/appointment/AppointmentControllers.ts +++ b/server/src/presentation/controllers/appointment/AppointmentControllers.ts @@ -10,7 +10,16 @@ export default class AppointmentController { private createAppointmentUseCase: CreateAppointmentUseCase, private getAppointmentUseCase: GetAppointmentUseCase, private updateAppointmentUseCase: UpdateAppointmentUseCase - ) {} + ) { + this.create = this.create.bind(this); + this.handleStripeWebhook = this.handleStripeWebhook.bind(this); + this.getAppointmentsDoctor = this.getAppointmentsDoctor.bind(this); + this.getAppointmentDetails = this.getAppointmentDetails.bind(this); + this.getAppointmentSuccussDetails = this.getAppointmentSuccussDetails.bind(this); + this.getAppointmentsPatient = this.getAppointmentsPatient.bind(this); + this.updateAppointment = this.updateAppointment.bind(this); + this.updateStatusAndNotes = this.updateStatusAndNotes.bind(this); + } async create(req: CustomRequest, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/chat/ChatControllers.ts b/server/src/presentation/controllers/chat/ChatControllers.ts index 53bb4db9..8391617e 100644 --- a/server/src/presentation/controllers/chat/ChatControllers.ts +++ b/server/src/presentation/controllers/chat/ChatControllers.ts @@ -7,7 +7,17 @@ export default class ChatController { constructor( private createChatUseCase: CreateChatUseCase, private getChatUseCase: GetChatUseCase - ) { } + ) { + this.getChatsOfPatient = this.getChatsOfPatient.bind(this); + this.getChatsOfDoctor = this.getChatsOfDoctor.bind(this); + this.getPatientsDoctor = this.getPatientsDoctor.bind(this); + this.getMessagesOfChatPatient = this.getMessagesOfChatPatient.bind(this); + this.getMessagesOfChatDoctor = this.getMessagesOfChatDoctor.bind(this); + this.createChatPatient = this.createChatPatient.bind(this); + this.createChatDoctor = this.createChatDoctor.bind(this); + this.createMessageDoctor = this.createMessageDoctor.bind(this); + this.createMessagePatient = this.createMessagePatient.bind(this); + } async getChatsOfPatient(req: CustomRequest, res: Response, next: NextFunction) { try { const patientId = req.patient?.id; diff --git a/server/src/presentation/controllers/doctor/AuthenticationController.ts b/server/src/presentation/controllers/doctor/AuthenticationController.ts index 1d7c40f0..28a910a3 100644 --- a/server/src/presentation/controllers/doctor/AuthenticationController.ts +++ b/server/src/presentation/controllers/doctor/AuthenticationController.ts @@ -4,8 +4,18 @@ import { Cookie, StatusCode } from "../../../types"; import IDoctor from "../../../domain/entities/IDoctor"; export default class AuthDoctorController { - constructor(private authDoctorUseCase: AuthenticationUseCase) {} - + constructor( + private authDoctorUseCase: AuthenticationUseCase + ) { + this.signin = this.signin.bind(this); + this.validateOtp = this.validateOtp.bind(this); + this.resendOtp = this.resendOtp.bind(this); + this.forgotPassword = this.forgotPassword.bind(this); + this.updatePassword = this.updatePassword.bind(this); + this.signup = this.signup.bind(this); + this.getUploadUrl = this.getUploadUrl.bind(this); + this.uploadProfileImage = this.uploadProfileImage.bind(this); + } async signin(req: Request, res: Response, next: NextFunction) { try { const { email, password } = req.body; diff --git a/server/src/presentation/controllers/notification/NotificationController.ts b/server/src/presentation/controllers/notification/NotificationController.ts index cee30584..7fc3afe5 100644 --- a/server/src/presentation/controllers/notification/NotificationController.ts +++ b/server/src/presentation/controllers/notification/NotificationController.ts @@ -5,7 +5,12 @@ import NotificationUseCase from "../../../use_case/notification/NotificationUseC export default class NotificationController { constructor( private notificationUseCase: NotificationUseCase - ) {} + ) { + this.getAllPatientNotifications = this.getAllPatientNotifications.bind(this); + this.getAllDoctorNotifications = this.getAllDoctorNotifications.bind(this); + this.clearMultipleNotifications = this.clearMultipleNotifications.bind(this); + this.clearSingleNotification = this.clearSingleNotification.bind(this); + } async getAllPatientNotifications(req: CustomRequest, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/patient/AuthenticationController.ts b/server/src/presentation/controllers/patient/AuthenticationController.ts index 616128ed..ef62bd29 100644 --- a/server/src/presentation/controllers/patient/AuthenticationController.ts +++ b/server/src/presentation/controllers/patient/AuthenticationController.ts @@ -3,7 +3,8 @@ import { NextFunction, Request, Response } from "express"; import { Cookie, StatusCode } from "../../../types"; export default class AuthPatientController { - constructor(private authUseCase: AuthenticationUseCase) {} + constructor( + private authUseCase: AuthenticationUseCase) {} async register(req: Request, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/controllers/patient/PatientController.ts b/server/src/presentation/controllers/patient/PatientController.ts index efbab783..d29f6d95 100644 --- a/server/src/presentation/controllers/patient/PatientController.ts +++ b/server/src/presentation/controllers/patient/PatientController.ts @@ -3,7 +3,9 @@ import PatientUseCase from "../../../use_case/patient/PatientUseCases"; import { CustomRequest, StatusCode } from "../../../types"; export default class PatientController { - constructor(private patientUseCase: PatientUseCase) {} + constructor( + private patientUseCase: PatientUseCase + ) {} async getProfile(req: CustomRequest, res: Response, next: NextFunction) { try { diff --git a/server/src/presentation/middlewares/ErrorHandler.ts b/server/src/presentation/middlewares/ErrorHandler.ts index 0b421661..0a889c60 100644 --- a/server/src/presentation/middlewares/ErrorHandler.ts +++ b/server/src/presentation/middlewares/ErrorHandler.ts @@ -4,6 +4,9 @@ import logger from "../../utils/logger"; import CustomError from "../../domain/entities/CustomError"; export default class ErrorHandler { + constructor() { + this.exec = this.exec.bind(this); + } exec(error: any, req: Request, res: Response, next: NextFunction) { const statusCode = error.statusCode || StatusCode.InternalServerError; const message = error.message || "Internal Server Error"; diff --git a/server/src/presentation/routers/admin/AdminRoutes.ts b/server/src/presentation/routers/admin/AdminRoutes.ts index 96b7ef0a..ca3480c2 100644 --- a/server/src/presentation/routers/admin/AdminRoutes.ts +++ b/server/src/presentation/routers/admin/AdminRoutes.ts @@ -1,4 +1,4 @@ -import express from "express"; +import { Router } from "express"; import AdminPatientController from "../../controllers/admin/PatientController"; import AdminPatientUseCase from "../../../use_case/admin/PatientUseCase"; import PatientRepository from "../../../infrastructure/repositories/PatientRepository"; @@ -9,7 +9,7 @@ import DoctorRepository from "../../../infrastructure/repositories/DoctorReposit import NodeMailerService from "../../../infrastructure/services/NodeMailerService"; import JoiService from "../../../infrastructure/services/JoiService"; -const router = express.Router(); +const router = Router(); const patientRepository = new PatientRepository(); const doctorRepository = new DoctorRepository(); @@ -23,11 +23,11 @@ const adminDoctorController = new AdminDoctorController(adminDoctorUseCase); router .route("/patient") - .get(adminPatientController.getPatients.bind(adminPatientController)) - .put(adminPatientController.updatePatient.bind(adminPatientController)); + .get(adminPatientController.getPatients) + .put(adminPatientController.updatePatient); router .route("/doctor") - .get(adminDoctorController.getDoctors.bind(adminDoctorController)) - .put(adminDoctorController.updateDoctor.bind(adminDoctorController)); + .get(adminDoctorController.getDoctors) + .put(adminDoctorController.updateDoctor); export default router; diff --git a/server/src/presentation/routers/admin/AuthenticationRoutes.ts b/server/src/presentation/routers/admin/AuthenticationRoutes.ts index 709316f3..0c97cc86 100644 --- a/server/src/presentation/routers/admin/AuthenticationRoutes.ts +++ b/server/src/presentation/routers/admin/AuthenticationRoutes.ts @@ -1,4 +1,4 @@ -import express from "express"; +import { Router } from "express"; import AuthenticationController from "../../controllers/admin/AuthenticationController"; import AuthenticationUseCase from "../../../use_case/admin/AuthenticationUseCase"; import DoctorRepository from "../../../infrastructure/repositories/DoctorRepository"; @@ -8,7 +8,7 @@ import NodeMailerService from "../../../infrastructure/services/NodeMailerServic import OtpRepository from "../../../infrastructure/repositories/OtpRepository"; import JoiService from "../../../infrastructure/services/JoiService"; -const router = express.Router(); +const router = Router(); const adminRepository = new DoctorRepository(); const otpRepository = new OtpRepository(); @@ -27,10 +27,10 @@ const authUseCase = new AuthenticationUseCase( ); const authController = new AuthenticationController(authUseCase); -router.post("/", authController.login.bind(authController)); -router.post("/otp-verification", authController.validateOtp.bind(authController)); -router.post("/resend-otp", authController.resendOtp.bind(authController)); -router.get("/refresh", authController.refreshAccessToken.bind(authController)); -router.post("/logout", authController.logout.bind(authController)); +router.post("/", authController.login); +router.post("/otp-verification", authController.validateOtp); +router.post("/resend-otp", authController.resendOtp); +router.get("/refresh", authController.refreshAccessToken); +router.post("/logout", authController.logout); export default router; diff --git a/server/src/presentation/routers/appointment/AppointmentRoutes.ts b/server/src/presentation/routers/appointment/AppointmentRoutes.ts index 78b1b0ad..b55f2fea 100644 --- a/server/src/presentation/routers/appointment/AppointmentRoutes.ts +++ b/server/src/presentation/routers/appointment/AppointmentRoutes.ts @@ -1,4 +1,4 @@ -import express from "express"; +import { Router } from "express"; import AppointmentRepository from "../../../infrastructure/repositories/AppointmentRepository"; import SlotRepository from "../../../infrastructure/repositories/SlotRepository"; import CreateAppointmentUseCase from "../../../use_case/appointment/CreateAppointmentUseCase"; @@ -16,7 +16,7 @@ import VideoSectionRepository from "../../../infrastructure/repositories/VideoSe import PatientRepository from "../../../infrastructure/repositories/PatientRepository"; import DoctorRepository from "../../../infrastructure/repositories/DoctorRepository"; -const router = express.Router(); +const router = Router(); const appointmentRepository = new AppointmentRepository(); const slotRepository = new SlotRepository(); @@ -53,57 +53,19 @@ const authorizeDoctor = new DoctorAuthMiddleware(tokenService); // ! Patient Routes -router.get( - "/patient/details/:appointmentId", - authorizePatient.exec, - appointmentController.getAppointmentDetails.bind(appointmentController) -); - -router.get( - "/patient/succuss/:paymentId", - authorizePatient.exec, - appointmentController.getAppointmentSuccussDetails.bind(appointmentController) -); - -router.post( - "/patient/", - authorizePatient.exec, - appointmentController.create.bind(appointmentController) -); - -router.get( - "/patient/", - authorizePatient.exec, - appointmentController.getAppointmentsPatient.bind(appointmentController) -); - -router.put( - "/patient/", - authorizePatient.exec, - appointmentController.updateStatusAndNotes.bind(appointmentController) -); +router.get("/patient/details/:appointmentId", authorizePatient.exec, appointmentController.getAppointmentDetails); +router.get("/patient/succuss/:paymentId", authorizePatient.exec, appointmentController.getAppointmentSuccussDetails); +router.post("/patient/", authorizePatient.exec, appointmentController.create); +router.get("/patient/", authorizePatient.exec, appointmentController.getAppointmentsPatient); +router.put("/patient/", authorizePatient.exec, appointmentController.updateStatusAndNotes); // ! Doctor Routes - -router.get( - "/doctor/details/:appointmentId", - authorizeDoctor.exec, - appointmentController.getAppointmentDetails.bind(appointmentController) -); - -router.get( - "/doctor", - authorizeDoctor.exec, - appointmentController.getAppointmentsDoctor.bind(appointmentController) -); - -router.put( - "/doctor/", - authorizeDoctor.exec, - appointmentController.updateAppointment.bind(appointmentController) +router.get("/doctor/details/:appointmentId", authorizeDoctor.exec, appointmentController.getAppointmentDetails); +router.get("/doctor", authorizeDoctor.exec, appointmentController.getAppointmentsDoctor); +router.put("/doctor/", authorizeDoctor.exec, appointmentController.updateAppointment ); export default router; -export const webhook = appointmentController.handleStripeWebhook.bind(appointmentController); +export const webhook = appointmentController.handleStripeWebhook; diff --git a/server/src/presentation/routers/chat/ChatRoutes.ts b/server/src/presentation/routers/chat/ChatRoutes.ts index c337c36b..df55da6e 100644 --- a/server/src/presentation/routers/chat/ChatRoutes.ts +++ b/server/src/presentation/routers/chat/ChatRoutes.ts @@ -1,4 +1,4 @@ -import express from 'express'; +import { Router } from 'express'; import ChatRepository from '../../../infrastructure/repositories/ChatRepository'; import MessageRepository from '../../../infrastructure/repositories/MessageRepository'; import PatientRepository from '../../../infrastructure/repositories/PatientRepository'; @@ -11,7 +11,7 @@ import JWTService from '../../../infrastructure/services/JWTService'; import PatientAuthMiddleware from '../../middlewares/PatientAuthMiddleware'; import DoctorAuthMiddleware from '../../middlewares/DoctorAuthMiddleware'; -const router = express.Router(); +const router = Router(); const validatorService = new JoiService(); const tokenService = new JWTService(); @@ -31,15 +31,15 @@ const chatController = new ChatController(createChatUseCase, getChatUseCase); const authorizePatient = new PatientAuthMiddleware(tokenService); const authorizeDoctor = new DoctorAuthMiddleware(tokenService); -router.get('/patient', authorizePatient.exec, chatController.getChatsOfPatient.bind(chatController)); -router.post('/patient', authorizePatient.exec, chatController.createChatPatient.bind(chatController)); -router.post('/patient/message', authorizePatient.exec, chatController.createMessagePatient.bind(chatController)); -router.get('/patient/message/:chatId', authorizePatient.exec, chatController.getMessagesOfChatPatient.bind(chatController)); +router.get('/patient', authorizePatient.exec, chatController.getChatsOfPatient); +router.post('/patient', authorizePatient.exec, chatController.createChatPatient); +router.post('/patient/message', authorizePatient.exec, chatController.createMessagePatient); +router.get('/patient/message/:chatId', authorizePatient.exec, chatController.getMessagesOfChatPatient); -router.get('/doctor', authorizeDoctor.exec, chatController.getChatsOfDoctor.bind(chatController)); -router.get('/doctor/patients', authorizeDoctor.exec, chatController.getPatientsDoctor.bind(chatController)); -router.get('/doctor/message/:chatId', authorizeDoctor.exec, chatController.getMessagesOfChatDoctor.bind(chatController)); -router.post('/doctor', authorizeDoctor.exec, chatController.createChatDoctor.bind(chatController)); -router.post('/doctor/message', authorizeDoctor.exec, chatController.createMessageDoctor.bind(chatController)); +router.get('/doctor', authorizeDoctor.exec, chatController.getChatsOfDoctor); +router.get('/doctor/patients', authorizeDoctor.exec, chatController.getPatientsDoctor); +router.get('/doctor/message/:chatId', authorizeDoctor.exec, chatController.getMessagesOfChatDoctor); +router.post('/doctor', authorizeDoctor.exec, chatController.createChatDoctor); +router.post('/doctor/message', authorizeDoctor.exec, chatController.createMessageDoctor); export default router; \ No newline at end of file diff --git a/server/src/presentation/routers/index.ts b/server/src/presentation/routers/index.ts index 9f06ba88..6eb3f226 100644 --- a/server/src/presentation/routers/index.ts +++ b/server/src/presentation/routers/index.ts @@ -1,4 +1,4 @@ -import express from "express"; +import {Router} from "express"; import patientAuthentication from "./patient/AuthenticationRoutes"; import adminAuthentication from "./admin/AuthenticationRoutes"; import protectedRoutes from "./patient/PatientRoutes"; @@ -17,7 +17,7 @@ import notificationRoutes from "./notification/NotificationRoute"; import chatRouters from "./chat/ChatRoutes"; import videoSectionRoute from "./video/VideoSectionRoute"; -const app = express(); +const app = Router(); const tokenService = new TokenService(); const authorizePatient = new PatientAuthMiddleware(tokenService); diff --git a/server/src/presentation/routers/notification/NotificationRoute.ts b/server/src/presentation/routers/notification/NotificationRoute.ts index 35368edc..08ee45c4 100644 --- a/server/src/presentation/routers/notification/NotificationRoute.ts +++ b/server/src/presentation/routers/notification/NotificationRoute.ts @@ -1,4 +1,4 @@ -import express from "express"; +import { Router } from "express"; import NotificationRepository from "../../../infrastructure/repositories/NotificationRepository"; import JoiService from "../../../infrastructure/services/JoiService"; import NotificationController from "../../controllers/notification/NotificationController"; @@ -7,7 +7,7 @@ import DoctorAuthMiddleware from "../../middlewares/DoctorAuthMiddleware"; import PatientAuthMiddleware from "../../middlewares/PatientAuthMiddleware"; import NotificationUseCase from "../../../use_case/notification/NotificationUseCae"; -const router = express.Router(); +const router = Router(); const notificationRepository = new NotificationRepository(); const validatorService = new JoiService(); @@ -21,42 +21,13 @@ const authorizePatient = new PatientAuthMiddleware(tokenService); // ! Patient Routes -router.get( - "/patient", - authorizePatient.exec, - notificationController.getAllPatientNotifications.bind(notificationController) -); - -router.delete( - "/patient/clear-all", - authorizePatient.exec, - notificationController.clearMultipleNotifications.bind(notificationController) -); - -router.delete( - "/patient/:notificationId", - authorizePatient.exec, - notificationController.clearSingleNotification.bind(notificationController) -); +router.get("/patient", authorizePatient.exec, notificationController.getAllPatientNotifications.bind(notificationController)); +router.delete("/patient/clear-all", authorizePatient.exec, notificationController.clearMultipleNotifications.bind(notificationController)); +router.delete("/patient/:notificationId", authorizePatient.exec, notificationController.clearSingleNotification.bind(notificationController)); // ! Doctor Routes - -router.get( - "/doctor", - authorizeDoctor.exec, - notificationController.getAllDoctorNotifications.bind(notificationController) -); - -router.delete( - "/doctor/clear-all", - authorizeDoctor.exec, - notificationController.clearMultipleNotifications.bind(notificationController) -); - -router.delete( - "/doctor/:notificationId", - authorizeDoctor.exec, - notificationController.clearSingleNotification.bind(notificationController) -); +router.get("/doctor", authorizeDoctor.exec, notificationController.getAllDoctorNotifications.bind(notificationController)); +router.delete("/doctor/clear-all", authorizeDoctor.exec, notificationController.clearMultipleNotifications.bind(notificationController)); +router.delete("/doctor/:notificationId", authorizeDoctor.exec, notificationController.clearSingleNotification.bind(notificationController)); export default router; diff --git a/server/src/presentation/routers/patient/AuthenticationRoutes.ts b/server/src/presentation/routers/patient/AuthenticationRoutes.ts index 23be130d..4ae3631c 100644 --- a/server/src/presentation/routers/patient/AuthenticationRoutes.ts +++ b/server/src/presentation/routers/patient/AuthenticationRoutes.ts @@ -1,4 +1,4 @@ -import express from "express"; +import { Router } from "express"; import BcryptService from "../../../infrastructure/services/BcryptService"; import NodeMailerService from "../../../infrastructure/services/NodeMailerService"; import JWTService from "../../../infrastructure/services/JWTService"; @@ -8,7 +8,7 @@ import AuthenticationController from "../../controllers/patient/AuthenticationCo import AuthPatientUseCase from "../../../use_case/patient/AuthenticationUseCase"; import JoiService from "../../../infrastructure/services/JoiService"; -const router = express.Router(); +const router = Router(); const tokenService = new JWTService(); const passwordService = new BcryptService(); diff --git a/server/src/presentation/routers/patient/PatientRoutes.ts b/server/src/presentation/routers/patient/PatientRoutes.ts index dd39e0a5..edef773f 100644 --- a/server/src/presentation/routers/patient/PatientRoutes.ts +++ b/server/src/presentation/routers/patient/PatientRoutes.ts @@ -1,11 +1,11 @@ -import express from "express"; +import { Router } from "express"; import PatientUseCase from "../../../use_case/patient/PatientUseCases"; import PatientRepository from "../../../infrastructure/repositories/PatientRepository"; import PatientController from "../../controllers/patient/PatientController"; import S3StorageService from "../../../infrastructure/services/S3StorageService"; import JoiService from "../../../infrastructure/services/JoiService"; -const router = express.Router(); +const router = Router(); const patientRepository = new PatientRepository(); const s3StorageService = new S3StorageService();