docs: add GraphQL schema draft for the catalog #29
+639
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds the first draft of the GraphQL API, written schema first, together with the documentation of the choices behind it. No server code yet: this is the contract that the frontend and the backend can build on.
backend/src/schema.graphql: the catalog (apparatus, element groups, elements and vaults behind aCatalogIteminterface, variants),searchCatalogwith search, filter, sort and cursor pagination, the user data (coach, gymnast, routine),login, and the mutations for gymnasts and routines.docs/API.md: why GraphQL and not REST, how the schema differs from the database, search and pagination, scalability, login, error handling, images, tooling, configuration and a test plan for the API.docs/USER_LIST_PAGINATION.md: why the lists of gymnasts and routines are plain lists with limits and not cursor connections, and when to change that.README.md: a "Why GraphQL and not REST" section.docs/DATA_MODEL.mdanddocs/AI_USAGE.md: the image decision, the derived search tables, and how AI was used for this work.Main decisions
first/after,totalCountonly calculated when asked for), with a page size of 1–100.extensions.code(UNAUTHENTICATED,NOT_FOUND,NAME_TAKEN,INVALID_ITEMS,BAD_USER_INPUT,LIMIT_REACHED).mereturnsnullwhen nobody is logged in. Other coaches' data givesNOT_FOUND, so ids cannot be probed.imageUrlinstead of a file name: the database keeps the file name and the API gives a full URL.CatalogIteminterface, so one search covers both.Open point for review: how the search is implemented
docs/API.mdcurrently describes a search that never uses raw SQL: a read-onlyCatalogEntrytable and aCatalogWordtable, queried with PrismastartsWith. Issue #24 plans a different search:ILIKEonsearch_textwith a trigram index, a three character minimum, and suggestions from trigram similarity when nothing is found. Issue #22 plans acatalog_itemsview for the combined list.These need to be reconciled before the backend is built. The questions are listed on #24. Once the team has decided,
API.mdandDATA_MODEL.mdwill be updated to match, so this PR should be read as a draft of the schema and the reasoning, not as the final word on the search.How to review
backend/src/schema.graphqlfirst, thendocs/API.md.graphql@16(buildSchema). Nothing else can be run yet, because there is no server.Related to #28.
🤖 Generated with Claude Code