Appointments

Scheduling system for building inspections, customer meetings, and other project-related events. Supports proposal-based booking where customers pick time slots through the Portal.

Source Files

LayerPath
Schemabackend/src/db/schema.ts
Servicebackend/src/services/appointment-service.ts
Portal Pagefrontend/src/pages/portal/PortalAppointmentView.tsx
Queriesfrontend/src/lib/queries/appointmentQueries.ts
Portal Queriesfrontend/src/lib/queries/portalAppointmentQueries.ts

Database Tables

TablePurpose
appointmentsMain entity — date, time, type, status, location, assigned user, linked project
appointmentProposalsTime slot options sent to customers for selection

Key Fields

FieldTypeNotes
projectIduuid FKParent project
buildingIduuid FKAssociated building (inspection location)
assignedUserIduuid FKStaff member responsible
contactIduuid FKCustomer contact for the appointment
typeenumAppointment type (e.g., site inspection, consultation, handover)
statusenumLifecycle state (proposed, confirmed, completed, cancelled)
scheduledAttimestampConfirmed date and time
notestextInternal notes

Proposal-Based Booking

  1. Staff creates an appointment with multiple appointmentProposals (time slot options)
  2. Customer receives a notification with a link to the Portal
  3. Customer views proposals on PortalAppointmentView and selects a slot
  4. Selected proposal becomes the confirmed scheduledAt; others are discarded
  5. Both parties receive confirmation via Notifications

Workflow Integration

Appointments are created as part of Workflows tasks. Typical workflow tasks that generate appointments:

Task TypeAppointment Type
Site inspectionBuilding survey visit
Customer consultationAdvisory meeting
Results presentationFinal review meeting

The workflow task tracks the appointment status and can auto-advance when the appointment is completed.

Relationships

Appointment *──1 Project
Appointment *──1 Building
Appointment *──1 Users (assigned staff)
Appointment *──1 Contacts (customer)
Appointment 1──* AppointmentProposals
Appointment ──> Workflow Task (linked via workflow)

Frontend

  • Internal view — appointments appear inline within Workflows task cards and on project detail pages
  • Portal viewPortalAppointmentView.tsx provides the customer-facing proposal picker
  • Queries — separate query files for internal (appointmentQueries.ts) and portal (portalAppointmentQueries.ts) contexts

Workflows | Projects | Buildings | Contacts | Portal | Notifications | Users | Service Layer Pattern