How diogobrazil/gestao-consulta-medica-api works
This repository is a REST API for medical-consultation management, but the visible runtime implements patient-user registration rather than consultation scheduling. The main flow is an HTTP POST route through the Express adapter and patient controller to a use case, which checks for an existing CPF and creates a patient record through Prisma. The tree also contains operator-creation modules and JWT/password providers, but their runtime wiring is not established by the excerpts. The graph reflects those modules without inventing connections; the Prisma schema is the available evidence for the persistence model.
Main entry points: app.ts Application wiring · CreateUserPatientController.ts Patient controller · ServerRouteAdapter.ts Express route adapter · UserPatientRoutes.ts Patient routes
Components 18
HTTP interface
- Patient routes
src/routes/user-patient/UserPatientRoutes.ts - Express route adapter
src/adapters/server/ServerRouteAdapter.ts - HTTP contracts
src/adapters/interfaces/server/IRoute.ts - Application wiring
src/app.ts
Patient registration
- Patient controller
src/controllers/user-patient/CreateUserPatientController.ts - Patient DTO
src/dtos/users-patients/CreateUserPatientDTO.ts - Patient creation use case
src/usecases/user-patient/CreateUserPatientUseCase.ts
Operator accounts
- Operator routes
src/routes/user-operator/UserOperatorRoutes.ts - Operator controller
src/controllers/user-operator/CreateUserOperatorController.ts - Operator DTO
src/dtos/users-operators/CreateUserOperatorDTO.ts - Operator creation use case
src/usecases/users-operator/CreateUserOperatorUseCase.ts
Persistence and providers
- Patient repository
src/repositories/user-patient/UserPatientRepository.ts - Patient repository contract
src/repositories/user-patient/IUserPatientRepository.ts - Prisma client
src/prisma/index.ts - Patient database model
prisma/schema.prisma - Password provider
src/providers/PasswordProvider.ts - JWT provider
src/providers/JWTProvider.ts
Other components
- API client
Connections 22
- API client → Patient routes: POST patient
src/routes/user-patient/UserPatientRoutes.ts - Patient routes → Express route adapter: registers route
src/routes/user-patient/UserPatientRoutes.ts - Patient routes → Patient controller: resolves controller
src/routes/user-patient/UserPatientRoutes.ts - Application wiring → Patient routes: configures routes
src/app.ts - Application wiring → Express route adapter: creates adapter
src/app.ts - Application wiring → Patient controller: registers dependency
src/app.ts - Application wiring → Patient creation use case: registers dependency
src/app.ts - Application wiring → Patient repository: registers dependency
src/app.ts - Application wiring → Password provider: registers provider
src/app.ts - Application wiring → JWT provider: registers provider
src/app.ts - Express route adapter → HTTP contracts: dispatches route
src/adapters/server/ServerRouteAdapter.ts - Express route adapter → Patient controller: invokes handler
src/adapters/server/ServerRouteAdapter.ts - Patient controller → Patient creation use case: executes creation
src/controllers/user-patient/CreateUserPatientController.ts - Patient controller → Patient DTO: types request
src/controllers/user-patient/CreateUserPatientController.ts - Patient creation use case → Patient repository: checks and creates
src/usecases/user-patient/CreateUserPatientUseCase.ts - Patient repository → Prisma client: queries
src/repositories/user-patient/UserPatientRepository.ts - Patient repository → Patient repository contract: implements
src/repositories/user-patient/UserPatientRepository.ts - Prisma client → Patient database model: persists records
- Operator routes → Express route adapter: registers route
src/routes/user-operator/UserOperatorRoutes.ts - Operator routes → Patient controller: resolves controller
src/routes/user-operator/UserOperatorRoutes.ts - Operator controller → Operator creation use case: uses patient use case
src/controllers/user-operator/CreateUserOperatorController.ts - Operator controller → Operator DTO: validates patient DTO
src/controllers/user-operator/CreateUserOperatorController.ts