Appointments — referred to as turnos throughout the codebase — are the operational heartbeat of Turnero. Every scheduled slot is backed by aDocumentation 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.
Turn entity that records who the patient is, which doctor they are seeing, when and at what time, their insurance coverage, and whether they have physically arrived at the clinic. Staff with the Ingreso role handle the front desk (booking, editing, deleting), while doctors holding the Medico role can view their own schedule and mark patients as arrived. Deletions can be performed by Admin or Ingreso users.
The Turn entity
Each appointment maps to aTurn record in the database. The table below lists every field, its type, and what it represents.
| Field | Type | Description |
|---|---|---|
Id | Guid | Auto-generated primary key |
Name | string | Full name of the patient |
Dni | long | National identity document number |
MedicId | Guid | Foreign key to the assigned Medic |
DateTurn | DateTime | Calendar date of the appointment (displayed as dd/MM/yyyy) |
TimeId | Guid | Foreign key to the TimeTurn time slot |
SocialWork | string | Health insurance / social work name (Obra Social) |
Reason | string | Patient-provided reason for the visit |
Accessed | bool | true once the patient has been marked as arrived |
The
TurnDTO projection adds MedicName (the doctor’s display name), a pre-formatted Date string (dd/MM/yyyy), a pre-formatted Time string, and an IsMedic flag that the front-end uses to decide which actions to surface per row.Role-based access
Ingreso
Create, view, edit, and delete appointments. Cannot mark a patient as arrived.
Medico
Create and view appointments for their own schedule. Mark patients as arrived. Cannot edit or delete turns.
Admin
Delete appointments. Combined with Ingreso privileges when both roles are assigned.
Appointment list and filtering
The main appointments screen (GET /Turns) renders a DataTables-powered grid. The table is populated by an AJAX call to the initialization endpoint.
MedicId is locked to their own profile and cannot be overridden by the form value. If the user is Ingreso, they can filter by any doctor. The dateTurn parameter defaults to today if omitted or unparseable.
The response envelope follows the DataTables protocol:
Creating an appointment
Authenticated Ingreso or Medico users open the creation form viaGET /Turns/Create, which returns the _Create partial view pre-loaded with doctor and time-slot dropdowns sourced from an in-memory cache.
Name, Dni, MedicId, Date, TimeId.Optional fields:
SocialWork, Reason (trailing quotes are stripped automatically).
On success the server emits a SignalR message to the assigned doctor notifying them that a new appointment has been added to their schedule (see Real-time updates).
Editing an appointment
Only Ingreso users can edit existing turns. The edit form is loaded as a partial view:Marking a patient as arrived
Only users in the Medico role can mark a turn as accessed. This toggles theAccessed flag on the Turn record:
{id} is the turn’s Guid. On success, every connected Ingreso user is notified via SignalR so the front-desk table reflects the updated arrival status in real time.
Deleting an appointment
Admin and Ingreso users may delete a turn:UpdateTable SignalR event so all connected users see the row disappear without a manual page refresh.
Real-time updates
Turnero uses ASP.NET Core SignalR to push table changes to connected browsers. The hub is mounted at/TurnsTableHub.
| Trigger | SignalR method | Recipients |
|---|---|---|
| Turn created | UpdateTableDirected | The assigned doctor only |
| Turn edited | UpdateTableDirected | All Ingreso users |
Patient arrived (Accessed) | UpdateTableDirected | All Ingreso users |
| Turn deleted | UpdateTable | All connected clients |
Public walk-in booking
Anonymous users — for example patients who arrive without a prior appointment — can book a same-day slot through the public booking form at/TurnsPublic. No authentication is required.
| Field | Value set by server |
|---|---|
Date | Today (DateTime.Today, formatted as dd/MM/yyyy) |
Reason | "Turno espontáneo" |
TimeId | 78496444-276d-4389-8b2f-f668c5350e3f (the default walk-in slot) |
UpdateTableDirected SignalR push: "La tabla se ha actualizado". This differs from the authenticated create flow, which sends the doctor’s name, a message string, and the appointment date as three separate arguments.
The public endpoint is decorated with
[AllowAnonymous] and does not enforce CSRF validation, making it suitable for an unattended kiosk or a waiting-room tablet.Exporting appointments
The currently filtered view can be exported in two formats. Both endpoints apply the same doctor/date filters that are active in the DataTables session and sort rows by time of appointment.Excel export
turnos.xlsx (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet). The workbook contains a single sheet named Turnos with the following columns:
| Column | Source field | Format |
|---|---|---|
| Nombre | Name | text |
| DNI | Dni | text |
| Obra Social | SocialWork | text |
| Motivo | Reason | text |
| Médico | MedicName | text |
| Fecha | Date | dd/MM/yyyy |
| Hora | Time | HH:mm |
PDF export
turnos.pdf (application/pdf) generated with QuestPDF. The document includes a bold header reading “Turnos del día” and a five-column table: Nombre, DNI, Obra (Social), Médico, and Hora.