sort and deleted arguments on Patient.bookingsWithPagination
Summary
Patient.bookingsWithPagination accepts two new optional arguments:
sortorders the bookings by start date, ascending or descending, across all pages.deletedreturns only cancelled bookings (true) or only active bookings (false), withmeta.totalandmeta.hasMorecounted on that subset.
Use them to list a patient's most recent bookings first, or to page through a patient's cancelled bookings without filtering on the client.
What changed
- Added argument
sort: PatientBookingsSorttoPatient.bookingsWithPagination. - Added input
PatientBookingsSort { direction: SortDirection! }. Bookings are sorted by start date. - Added enum
SortDirectionwith valuesASCandDESC. - Added argument
deleted: BooleantoPatient.bookingsWithPagination. When set, it takes precedence overqueryOptions.includeDeleted. - These are additive. When both arguments are omitted, results and order are unchanged (active bookings only unless
queryOptions.includeDeletedistrue, earliest start first).
Integration guidance
- Most recent first: pass
sort: { direction: DESC }. The order applies before pagination, so page 1 holds the latest bookings. - Cancelled bookings only: pass
deleted: true. Cancelled bookings are those withdeleted: trueonBooking, whether the patient or the practice cancelled them. - Active bookings only: pass
deleted: false, or omitdeletedand leavequeryOptions.includeDeletedunset. - Forward-compatible enums: treat unknown
SortDirectionvalues defensively if you generate clients from the schema.
Example
query PatientCancelledBookings($patientId: ID!, $start: Date!, $end: Date!) {
patient(id: $patientId) {
bookingsWithPagination(
start: $start
end: $end
pagination: { page: 1, pageSize: 3 }
sort: { direction: DESC }
deleted: true
) {
data {
id
start
end
deleted
cancellationReason
}
meta {
page
pageSize
hasMore
total
}
}
}
}
Migration
No breaking changes. Opt in by passing sort and/or deleted when needed.