Query Block

A query asks for information and does not change business state.

When To Use It

Use a Query block when a user interface, policy, report, or external consumer needs data: Find Available Appointment Slots, Show Open Claims, Get Subscription Usage, Search Suppliers.

Required Data

  • Name: question-style phrase, such as Find Orders Awaiting Shipment.
  • Consumer: actor, interface, policy, report, or external system that asks the question.
  • Target read model: read model returned by the query.
  • Parameters: filters such as customer id, date range, status, search text, or pagination.
  • Result shape: list, detail, count, summary, export, or dashboard data.

Recommended Data

  • Authorization: who may run the query and which fields they can see.
  • Sorting and pagination: default order, page size, and limits.
  • Performance expectation: interactive, batch, export, or analytical.
  • Cache policy: whether stale data is acceptable.
  • Empty state: message or next action when no results exist.

Connections

Examples

  • Find Available Appointment Slots by clinician, location, and date range.
  • Show Claims Awaiting Evidence by handler and SLA age.
  • Get Account Billing Summary by account id.
  • Search Suppliers by capability, region, and certification status.

Generation Notes

Code Genie uses queries to generate read APIs, page loaders, report endpoints, authorization checks, and optimized retrieval paths. If a query appears to change state, split the state change into a command and keep the query pure.