Turnero persists all clinic data — appointments, patients, doctors, visit histories, and identity records — in a PostgreSQL database. The data-access layer lives in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pabloeferreyra/Turnero/llms.txt
Use this file to discover all available pages before exploring further.
Turnero.DAL project and uses Npgsql as the ADO.NET driver together with Entity Framework Core for schema management and query generation. The single connection string key LocalConnection is the only value you must supply before the application can start.
Connection String
Turnero reads the connection string at startup with:AppSettings.ConnectionString property so it can be accessed by internal infrastructure code without requiring dependency injection.
The expected Npgsql connection string format is:
Development: user secrets (recommended)
Storing credentials inappsettings.json risks accidentally committing them to source control. Use the .NET user-secrets store instead:
Production: appsettings.json
For server deployments, add the key directly toappsettings.json on the host. Keep the original file as a backup before editing:
ApplicationDbContext
ApplicationDbContext in Turnero.DAL inherits from IdentityDbContext, which automatically adds all ASP.NET Identity tables alongside the Turnero-specific entity sets:
| DbSet | Table purpose |
|---|---|
Turns | Scheduled appointments |
Medics | Doctor records |
TimeTurns | Available appointment time slots |
Patients | Patient demographic records |
ContactInfo | Patient contact details |
Allergies | Patient allergy entries |
Visits | Clinical visit history |
ParentsData | Parent / guardian information |
PersonalBackground | Personal medical history |
PerinatalBackground | Perinatal history |
Vaccines | Vaccination records |
PermMeds | Permanent medication records |
GrowthCharts | Anthropometric growth data |
CongErrors | Congenital anomaly records |
OnModelCreating. The full set of rules is:
| Entity | Property type | Override |
|---|---|---|
Turn | DateTurn | SQL date column type |
Patient | BirthDate | SQL date column type |
Visit | VisitDate | SQL date column type |
Allergies | All DateTime? properties | SQL date column type, default null |
Visit | All string properties | Default "" (empty string) |
PersonalBackground | All bool properties | Default false |
ParentsData | All string properties | Default "" (empty string) |
ParentsData | All DateOnly properties | SQL date column type, default DateOnly.MinValue |
ParentsData | All int properties | Default 0 |
CongErrors | All string properties | Default "" (empty string) |
PerinatalBackground | All int properties | Default 0 |
Applying Migrations
Apply all pending migrations to the target database
Adding New Migrations
When you modify a model class inTurnero.DAL, generate a new migration to capture the schema change:
<MigrationName> with a descriptive Pascal-case name such as AddPatientBirthDateIndex. After reviewing the generated files in Turnero.DAL/Migrations/, apply them with database update as shown above.
Always review the generated migration file before applying it in production. EF Core cannot always infer whether a column rename should be modelled as a drop-and-add or a true rename, which can result in data loss if not corrected manually.
Startup Cache Initialization
After the application is built and before it begins serving requests, Turnero pre-warms theIMemoryCache with the two most-frequently-read lookup tables:
TimeTurn or Medic records at runtime, restart the application (or implement a cache-invalidation call in the relevant write service) to ensure the new entries appear.