Turnero’s appointment system is built around two core entities:Documentation 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 and TimeTurn. A Turn represents a single scheduled appointment slot, capturing the patient identity, the assigned medic, the appointment date, and the booked time slot. TimeTurn is a separate lookup entity that holds the discrete time values (e.g. "09:00") available for booking, allowing the schedule grid to remain consistent across days. At the API and DataTables layer, the TurnDTO projection flattens navigation properties—medic name and time string—into a single serializable object, making it suitable for JSON responses and real-time SignalR updates.
Turn
TheTurn entity maps directly to the Turns table in PostgreSQL. The DateTurn column is stored as a plain SQL date type (configured in ApplicationDbContext.OnModelCreating), which strips the time component and keeps only the calendar date.
Fields
Primary key. Generated automatically by the database using the Identity strategy (
DatabaseGeneratedOption.Identity). Exposed as a UUID in all API responses.The patient’s full name as entered at booking time. This is a free-text copy of the patient’s name for the appointment and is distinct from any linked
Patient record.The patient’s national identity number (DNI). Stored as a 64-bit integer to accommodate large numeric IDs.
Foreign key referencing
Medics.Id. Must be set when creating a turn.Navigation property. Populated when the entity is loaded with
.Include(t => t.Medic). See the Medic model for field details.The calendar date of the appointment. Stored in PostgreSQL as a
date column (no time component). Display format is dd/MM/yyyy. In the TurnDTO projection this value is serialized as the Date string.Foreign key referencing
TimeTurns.Id.Navigation property to the associated
TimeTurn slot. The Time.Time string (e.g. "09:00") is projected into TurnDTO.Time by the Mapster configuration.The patient’s health insurance provider (obra social) at the time of booking. Optional.
Free-text reason or chief complaint for the appointment. Optional.
Indicates whether the patient has physically checked in at the clinic. Defaults to
false. Updated to true when reception marks the patient as arrived.TurnDTO
TurnDTO is the Data Transfer Object used in controller actions, JSON API responses, and DataTables rendering. It flattens the Medic and TimeTurn navigation properties into plain strings, and reformats DateTurn as an ISO-8601 date string. The IsMedic flag is populated at query time (not mapped from Turn) to drive view-level conditional logic.
Fields
Matches
Turn.Id.Patient name. Mapped directly from
Turn.Name.Patient DNI. Mapped directly from
Turn.Dni.The medic’s identifier. Explicitly mapped from
Turn.MedicId by the Mapster configuration.The medic’s display name. Derived from
Turn.Medic.Name when the navigation property is not null; otherwise null.The appointment date formatted as
"yyyy-MM-dd" (ISO 8601). Mapped from Turn.DateTurn.ToString("yyyy-MM-dd"). When mapping a TurnDTO back to a Turn, this string is parsed with DateTime.ParseExact(src.Date, "yyyy-MM-dd", null), falling back to DateTime.MinValue if empty.The human-readable time slot string (e.g.
"09:00"). Derived from Turn.Time.Time when the navigation property is not null.The time slot’s identifier. Explicitly mapped from
Turn.TimeId.Health insurance provider. Mapped directly.
Appointment reason. Mapped directly.
Check-in status. Mapped directly.
Not mapped from
Turn. Ignored by the Mapster configuration and set at the service/controller level to indicate whether the currently authenticated user is the medic assigned to this turn, enabling the view to show or hide medic-specific actions.TimeTurn
TimeTurn is a lookup table of bookable time slots. Each row represents one discrete time of day (e.g. "08:00", "09:00") and holds a collection of all Turn records that reference it. New time slots are typically seeded or managed by an administrator.
Fields
Primary key.
The time of day as a display string, conventionally in
"HH:mm" format (e.g. "09:00", "14:30"). This value is read directly into TurnDTO.Time during the Mapster projection.Reverse navigation collection. Contains all
Turn records that have been booked into this time slot across all dates and medics.Mapster Mapping Configuration
Turnero uses Mapster for object-to-object mapping, configured inTurnero.Utilities.Utilities.MapsterConfig.RegisterMappings(). The following rules govern the Turn ↔ TurnDTO relationship.
- Date serialization format:
Turn.DateTurnis aDateTime, butTurnDTO.Dateis always astringin"yyyy-MM-dd"format (ISO 8601). Although the[DisplayFormat]attribute on the entity usesdd/MM/yyyyfor Razor view rendering, the DTO uses ISO 8601 to ensure reliable round-trip parsing in JSON contexts. - Navigation properties are ignored on the reverse map: When adapting a
TurnDTOback to aTurn, theMedicandTimenavigation properties are deliberately ignored to prevent Mapster from trying to instantiate them. Only the foreign-key scalar properties (MedicId,TimeId) are written through. IsMedicis always ignored: TheIsMedicflag has no counterpart onTurnand is excluded from mapping in both directions.Visit → VisitDTOalso uses a date-to-string mapping, serializingVisitDateas"yyyy-MM-dd"and resolving the medic name from the navigation property.