Skip to main content

sort and deleted arguments on Patient.bookingsWithPagination

Summary​

Patient.bookingsWithPagination accepts two new optional arguments:

  • sort orders the bookings by start date, ascending or descending, across all pages.
  • deleted returns only cancelled bookings (true) or only active bookings (false), with meta.total and meta.hasMore counted 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: PatientBookingsSort to Patient.bookingsWithPagination.
  • Added input PatientBookingsSort { direction: SortDirection! }. Bookings are sorted by start date.
  • Added enum SortDirection with values ASC and DESC.
  • Added argument deleted: Boolean to Patient.bookingsWithPagination. When set, it takes precedence over queryOptions.includeDeleted.
  • These are additive. When both arguments are omitted, results and order are unchanged (active bookings only unless queryOptions.includeDeleted is true, 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 with deleted: true on Booking, whether the patient or the practice cancelled them.
  • Active bookings only: pass deleted: false, or omit deleted and leave queryOptions.includeDeleted unset.
  • Forward-compatible enums: treat unknown SortDirection values 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.