How marcoskrul/development-challenge-nine works
This repository implements a patient-register CRUD web application: users browse/search a paginated patient list, create or edit a patient and address, and retrieve or delete records. The React client provides patient routes, shared patient state, and API requests; the Node/Express server is organized around HTTP handling, application services, and database repositories. Patient creation validates and normalizes inputs, checks email uniqueness, then saves patient and address records transactionally. The graph emphasizes relationships shown in excerpts and documented capabilities; unsampled routes and service wiring are left unasserted.
Main entry points: PatientController.ts Patient controller · patients.routes.tsx Patient routes · SavePatientService.ts Create patient · index.routes.tsx App routes
Components 20
Patient web client
- App routes
client/src/routes/index.routes.tsx - Patient routes
client/src/routes/patients.routes.tsx - Patient control
client/src/pages/PatientControl/index.tsx - Patient table
client/src/pages/PatientControl/PatientsTable.tsx - Patient form
client/src/pages/PatientPersistence/index.tsx - Patient state and API
client/src/context/Patients/index.tsx - HTTP client
client/src/services/api.ts
HTTP application
- HTTP routes
server/src/infra/http/routes/patient.routes.ts - Patient controller
server/src/infra/http/controllers/PatientController.ts
Patient operations
- Create patient
server/src/application/services/patient/SavePatientService.ts - Update patient
server/src/application/services/patient/UpdatePatientService.ts - List patients
server/src/application/services/patient/ListPatientsService.ts - Get patient
server/src/application/services/patient/GetPatientByIdService.ts - Delete patient
server/src/application/services/patient/DeletePatientService.ts
Persistence
- Patient repository
server/src/infra/database/repositories/patient/implementations/PostgreSQL/Prisma/PatientRepository.ts - Address repository
server/src/infra/database/repositories/address/implementations/PostgreSQL/Prisma/AddressRepository.ts - PostgreSQL database
server/src/infra/database/client/index.ts
Other components
- Clinic user
- Browser
- Patient API
Connections 21
- Clinic user → Browser: uses
- Browser → App routes: opens
client/src/routes/index.routes.tsx - App routes → Patient routes: routes to
client/src/routes/index.routes.tsx - Patient routes → Patient control: renders
client/src/routes/patients.routes.tsx - Patient routes → Patient form: renders
client/src/routes/patients.routes.tsx - Patient control → Patient table: uses
client/src/pages/PatientControl/index.tsx - Patient routes → Patient state and API: provides
client/src/routes/patients.routes.tsx - Patient state and API → HTTP client: sends requests
client/src/context/Patients/index.tsx - HTTP client → Patient API: calls
- Patient API → HTTP routes: handles CRUD
- HTTP routes → Patient controller: dispatches
- Patient controller → Create patient: invokes
- Patient controller → Update patient: invokes
- Patient controller → List patients: invokes
- Patient controller → Get patient: invokes
- Patient controller → Delete patient: invokes
- Update patient → Create patient: delegates
server/src/application/services/patient/UpdatePatientService.ts - Create patient → Patient repository: checks and saves
server/src/application/services/patient/SavePatientService.ts - Create patient → Address repository: saves address
server/src/application/services/patient/SavePatientService.ts - Patient repository → PostgreSQL database: reads and writes
- Address repository → PostgreSQL database: reads and writes