-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
318 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,6 @@ | |
|
||
.23234/ | ||
|
||
**/di/ | ||
|
||
# Build directories | ||
**/.next/ | ||
**/out/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import PrescriptionController from "../presentation/controllers/prescription/PrescriptionController"; | ||
import AppointmentController from "../presentation/controllers/appointment/AppointmentControllers"; | ||
import AuthPatientController from "../presentation/controllers/patient/AuthenticationController"; | ||
import UnauthenticatedControllers from "../presentation/controllers/UnauthenticatedControllers"; | ||
import AuthDoctorController from "../presentation/controllers/doctor/AuthenticationController"; | ||
import AdminPatientController from "../presentation/controllers/admin/AdminPatientController"; | ||
import AuthAdminController from "../presentation/controllers/admin/AuthenticationController"; | ||
import AdminDoctorController from "../presentation/controllers/admin/AdminDoctorController"; | ||
import PatientController from "../presentation/controllers/patient/PatientController"; | ||
import ChatBotController from "../presentation/controllers/chatbot/ChatBotController"; | ||
import DoctorController from "../presentation/controllers/doctor/DoctorController"; | ||
import AdminController from "../presentation/controllers/admin/AdminController"; | ||
import VideoController from "../presentation/controllers/video/VideoController"; | ||
import SlotController from "../presentation/controllers/slot/SlotController"; | ||
|
||
import createUseCase from "./useCases"; | ||
|
||
const { | ||
adminDoctorUseCase, | ||
adminPatientUseCase, | ||
authAdminUseCase, | ||
authDoctorUseCase, | ||
authPatientUseCase, | ||
chatBotUseCase, | ||
createAppointmentUseCase, | ||
createPrescriptionUseCase, | ||
createSlotUseCase, | ||
dashboardUseCase, | ||
deleteSlotUseCase, | ||
getAppointmentUseCase, | ||
getPatientUseCase, | ||
getSlotUseCase, | ||
getVideoSectionUseCase, | ||
patientUseCases, | ||
unauthenticatedUseCases, | ||
updateAppointmentUseCase, | ||
updateSlotUseCase | ||
} = createUseCase; | ||
|
||
const createControllers = () => ({ | ||
adminController: new AdminController(dashboardUseCase), | ||
adminDoctorController: new AdminDoctorController(adminDoctorUseCase), | ||
adminPatientController: new AdminPatientController(adminPatientUseCase), | ||
appointmentController: new AppointmentController(createAppointmentUseCase, getAppointmentUseCase, updateAppointmentUseCase), | ||
chatBotController: new ChatBotController(chatBotUseCase), | ||
doctorController: new DoctorController(getPatientUseCase), | ||
patientController: new PatientController(patientUseCases), | ||
authDoctorController: new AuthDoctorController(authDoctorUseCase), | ||
authPatientController: new AuthPatientController(authPatientUseCase), | ||
prescriptionController: new PrescriptionController(createPrescriptionUseCase), | ||
slotController: new SlotController(createSlotUseCase, updateSlotUseCase, getSlotUseCase, deleteSlotUseCase), | ||
videoController: new VideoController(getVideoSectionUseCase), | ||
unauthenticatedController: new UnauthenticatedControllers(unauthenticatedUseCases), | ||
authAdminController: new AuthAdminController(authAdminUseCase), | ||
}); | ||
|
||
export default createControllers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import PatientAuthMiddleware from "../presentation/middlewares/PatientAuthMiddleware"; | ||
import DoctorAuthMiddleware from "../presentation/middlewares/DoctorAuthMiddleware"; | ||
import AdminAuthMiddleware from "../presentation/middlewares/AdminAuthMiddleware"; | ||
import ErrorHandler from "../presentation/middlewares/ErrorHandler"; | ||
import { jwtService } from "./services"; | ||
|
||
|
||
export const authorizePatient = new PatientAuthMiddleware(jwtService); | ||
export const authorizeDoctor = new DoctorAuthMiddleware(jwtService); | ||
export const authorizeAdmin = new AdminAuthMiddleware(jwtService); | ||
export const errorHandler = new ErrorHandler(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import ChatBotMessageRepository from "../infrastructure/repositories/ChatBotMessageRepository"; | ||
import NotificationRepository from "../infrastructure/repositories/NotificationRepository"; | ||
import VideoSectionRepository from "../infrastructure/repositories/VideoSectionRepository"; | ||
import PrescriptionRepository from "../infrastructure/repositories/PrescriptionRepository"; | ||
import AppointmentRepository from "../infrastructure/repositories/AppointmentRepository"; | ||
import PatientRepository from "../infrastructure/repositories/PatientRepository"; | ||
import PaymentRepository from "../infrastructure/repositories/PaymentRepository"; | ||
import MessageRepository from "../infrastructure/repositories/MessageRepository"; | ||
import DoctorRepository from "../infrastructure/repositories/DoctorRepository"; | ||
import SlotRepository from "../infrastructure/repositories/SlotRepository"; | ||
import ChatRepository from "../infrastructure/repositories/ChatRepository"; | ||
import OtpRepository from "../infrastructure/repositories/OtpRepository"; | ||
|
||
export const chatBotMessageRepository = new ChatBotMessageRepository(); | ||
export const notificationRepository = new NotificationRepository(); | ||
export const videoSectionRepository = new VideoSectionRepository(); | ||
export const prescriptionRepository = new PrescriptionRepository(); | ||
export const appointmentRepository = new AppointmentRepository(); | ||
export const patientRepository = new PatientRepository(); | ||
export const paymentRepository = new PaymentRepository(); | ||
export const messageRepository = new MessageRepository(); | ||
export const doctorRepository = new DoctorRepository(); | ||
export const slotRepository = new SlotRepository(); | ||
export const chatRepository = new ChatRepository(); | ||
export const otpRepository = new OtpRepository(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import NodeMailerService from "../infrastructure/services/NodeMailerService"; | ||
import GeminiBotService from "../infrastructure/services/GeminiBotService"; | ||
import S3StorageService from "../infrastructure/services/S3StorageService"; | ||
import BcryptService from "../infrastructure/services/BcryptService"; | ||
import StripeService from "../infrastructure/services/StripeService"; | ||
import UUIDService from "../infrastructure/services/UUIDService"; | ||
import JWTService from "../infrastructure/services/JWTService"; | ||
import JoiService from "../infrastructure/services/JoiService"; | ||
|
||
export const nodeMailerService = new NodeMailerService(); | ||
export const geminiBotService = new GeminiBotService(); | ||
export const s3StorageService = new S3StorageService(); | ||
export const bcryptService = new BcryptService(); | ||
export const stripeService = new StripeService(); | ||
export const uuidService = new UUIDService(); | ||
export const jwtService = new JWTService(); | ||
export const joiService = new JoiService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
import CreatePrescriptionUseCase from "../use_case/prescription/CreatePrescriptionUseCase"; | ||
import CreateAppointmentUseCase from "../use_case/appointment/CreateAppointmentUseCase"; | ||
import UpdateAppointmentUseCase from "../use_case/appointment/UpdateAppointmentUseCase"; | ||
import PatientAuthenticationUseCase from "../use_case/patient/AuthenticationUseCase"; | ||
import DoctorAuthenticationUseCase from "../use_case/doctor/AuthenticationUseCase"; | ||
import GetAppointmentUseCase from "../use_case/appointment/GetAppointmentUseCase"; | ||
import NotificationUseCase from "../use_case/notification/NotificationUseCase"; | ||
import GetVideoSectionUseCase from "../use_case/video/GetVideoSectionUseCase"; | ||
import AuthenticationUseCase from "../use_case/admin/AuthenticationUseCase"; | ||
import UnauthenticatedUseCases from "../use_case/UnauthenticatedUseCases"; | ||
import AdminPatientUseCase from "../use_case/admin/AdminPatientUseCase"; | ||
import AdminDoctorUseCase from "../use_case/admin/AdminDoctorUseCase"; | ||
import GetPatientUseCase from "../use_case/doctor/GetPatientUseCase"; | ||
import CreateSlotUseCase from "../use_case/slot/CreateSlotUseCase"; | ||
import CreateChatUseCase from "../use_case/chat/CreateChatUseCase"; | ||
import DeleteSlotUseCase from "../use_case/slot/DeleteSlotUseCase"; | ||
import UpdateSlotUseCase from "../use_case/slot/UpdateSlotUseCase"; | ||
import DashboardUseCase from "../use_case/admin/DashboardUseCase"; | ||
import PatientUseCases from "../use_case/patient/PatientUseCases"; | ||
import ChatBotUseCase from "../use_case/chatbot/ChatBotUseCase"; | ||
import GetChatUseCase from "../use_case/chat/GetChatUseCase"; | ||
import GetSlotUseCase from "../use_case/slot/GetSlotUseCase"; | ||
|
||
import { | ||
appointmentRepository, | ||
chatBotMessageRepository, | ||
chatRepository, | ||
doctorRepository, | ||
messageRepository, | ||
notificationRepository, | ||
otpRepository, | ||
patientRepository, | ||
paymentRepository, | ||
prescriptionRepository, | ||
slotRepository, | ||
videoSectionRepository, | ||
} from "./repositories"; | ||
|
||
import { | ||
bcryptService, | ||
geminiBotService, | ||
joiService, | ||
jwtService, | ||
nodeMailerService, | ||
s3StorageService, | ||
stripeService, | ||
uuidService, | ||
} from "./services"; | ||
|
||
|
||
const createUseCases = () => ({ | ||
authAdminUseCase: new AuthenticationUseCase( | ||
doctorRepository, | ||
bcryptService, | ||
jwtService, | ||
nodeMailerService, | ||
otpRepository, | ||
joiService | ||
), | ||
dashboardUseCase: new DashboardUseCase( | ||
patientRepository, | ||
appointmentRepository, | ||
doctorRepository, | ||
slotRepository | ||
), | ||
adminPatientUseCase: new AdminPatientUseCase(patientRepository, joiService), | ||
adminDoctorUseCase: new AdminDoctorUseCase(doctorRepository, nodeMailerService, joiService), | ||
createAppointmentUseCase: new CreateAppointmentUseCase( | ||
appointmentRepository, | ||
slotRepository, | ||
joiService, | ||
stripeService, | ||
paymentRepository, | ||
videoSectionRepository, | ||
doctorRepository, | ||
patientRepository, | ||
uuidService | ||
), | ||
updateAppointmentUseCase: new UpdateAppointmentUseCase( | ||
appointmentRepository, | ||
joiService, | ||
notificationRepository, | ||
videoSectionRepository, | ||
stripeService, | ||
paymentRepository | ||
), | ||
getAppointmentUseCase: new GetAppointmentUseCase( | ||
appointmentRepository, | ||
joiService, | ||
paymentRepository, | ||
prescriptionRepository | ||
), | ||
createChatUseCase: new CreateChatUseCase( | ||
messageRepository, | ||
chatRepository, | ||
joiService, | ||
patientRepository, | ||
doctorRepository | ||
), | ||
getChatUseCase: new GetChatUseCase(messageRepository, chatRepository, joiService, patientRepository), | ||
chatBotUseCase: new ChatBotUseCase(chatBotMessageRepository, geminiBotService, joiService), | ||
authDoctorUseCase: new DoctorAuthenticationUseCase( | ||
doctorRepository, | ||
bcryptService, | ||
jwtService, | ||
nodeMailerService, | ||
otpRepository, | ||
s3StorageService, | ||
joiService | ||
), | ||
getPatientUseCase: new GetPatientUseCase(appointmentRepository, joiService), | ||
notificationUseCase: new NotificationUseCase(notificationRepository, joiService), | ||
authPatientUseCase: new PatientAuthenticationUseCase( | ||
patientRepository, | ||
bcryptService, | ||
nodeMailerService, | ||
otpRepository, | ||
jwtService, | ||
joiService | ||
), | ||
patientUseCases: new PatientUseCases( | ||
patientRepository, | ||
s3StorageService, | ||
joiService, | ||
chatRepository, | ||
videoSectionRepository | ||
), | ||
createPrescriptionUseCase: new CreatePrescriptionUseCase( | ||
joiService, | ||
prescriptionRepository, | ||
appointmentRepository | ||
), | ||
createSlotUseCase: new CreateSlotUseCase(slotRepository, joiService), | ||
deleteSlotUseCase: new DeleteSlotUseCase( | ||
slotRepository, | ||
appointmentRepository, | ||
joiService, | ||
notificationRepository | ||
), | ||
getSlotUseCase: new GetSlotUseCase(slotRepository, appointmentRepository, joiService), | ||
updateSlotUseCase: new UpdateSlotUseCase(slotRepository, joiService), | ||
getVideoSectionUseCase: new GetVideoSectionUseCase(videoSectionRepository, joiService, appointmentRepository), | ||
unauthenticatedUseCases: new UnauthenticatedUseCases(doctorRepository), | ||
}); | ||
|
||
export default createUseCases(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 7 additions & 29 deletions
36
server/src/presentation/routers/admin/AuthenticationRoutes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,14 @@ | ||
import { Router } from "express"; | ||
import AuthenticationController from "../../controllers/admin/AuthenticationController"; | ||
import NodeMailerService from "../../../infrastructure/services/NodeMailerService"; | ||
import DoctorRepository from "../../../infrastructure/repositories/DoctorRepository"; | ||
import AuthenticationUseCase from "../../../use_case/admin/AuthenticationUseCase"; | ||
import OtpRepository from "../../../infrastructure/repositories/OtpRepository"; | ||
import BcryptService from "../../../infrastructure/services/BcryptService"; | ||
import JWTService from "../../../infrastructure/services/JWTService"; | ||
import JoiService from "../../../infrastructure/services/JoiService"; | ||
import createControllers from "../../../di/controllers"; | ||
|
||
const router = Router(); | ||
|
||
const adminRepository = new DoctorRepository(); | ||
const otpRepository = new OtpRepository(); | ||
const passwordService = new BcryptService(); | ||
const tokenService = new JWTService(); | ||
const emailService = new NodeMailerService(); | ||
const validatorService = new JoiService(); | ||
const { authAdminController } = createControllers | ||
|
||
const authUseCase = new AuthenticationUseCase( | ||
adminRepository, | ||
passwordService, | ||
tokenService, | ||
emailService, | ||
otpRepository, | ||
validatorService | ||
); | ||
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("/", authAdminController.login.bind(authAdminController)); | ||
router.post("/otp-verification", authAdminController.validateOtp.bind(authAdminController)); | ||
router.post("/resend-otp", authAdminController.resendOtp.bind(authAdminController)); | ||
router.get("/refresh", authAdminController.refreshAccessToken.bind(authAdminController)); | ||
router.post("/logout", authAdminController.logout.bind(authAdminController)); | ||
|
||
export default router; |
Oops, something went wrong.
f13141e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
avm-care – ./
avm-care-sinans-projects-8d312afe.vercel.app
avm-care-git-main-sinans-projects-8d312afe.vercel.app
avm-care.vercel.app