-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add the resolvers for gymnasts, their lists and routines #79
Open
ronjalh
wants to merge
11
commits into
70-session-tokens
Choose a base branch
from
73-user-data-resolvers
base: 70-session-tokens
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,797
−145
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…he GraphQL schema Gymnast.items with addGymnastItem and removeGymnastItem, Routine.createdAt and updatedAt, and CatalogItem.removed. API.md describes the rules, errors and limits.
…d items do not count addGymnastItem throws ALREADY_EXISTS and removeGymnastItem throws NOT_FOUND when nothing would change. A gymnast's list is limited to 100 items. Removed items do not count in the D-score, and calculateDScore rejects them. API.md describes the warning in the UI, the seed report and the other error codes.
Names are trimmed and checked in the backend, BAD_USER_INPUT otherwise.
Resolves the conflicts with the search and schema changes in dev. dev's names are kept (Gymnast.elements, addGymnastElement, removeGymnastElement, difficultyValues, no difficultyLetter, duplicates in a routine). The decisions for #37 are kept: errors for a duplicate add and a missing remove, a limit of 100, names of 70 characters, and removed items do not count.
Keeps both AI_USAGE sections. Puts the one-line descriptions in schema.graphql back as they are in dev: an earlier Prettier run had turned all of them into blocks.
Vault.dValue, CatalogFilter.difficultyValues, createGymnast, renameGymnast and createRoutine had ended up inside doc comments and were missing from the schema. Also restores the searchCatalog search description from dev (80 characters, 8 words, text without searchable words finds nothing).
Adding an item that is already in a gymnast's list, or removing one that is not, now changes nothing and returns the gymnast, so ALREADY_EXISTS is gone and NOT_FOUND is only for unknown ids. Routine.dScore is null while the routine has a removed item, the same rule as calculateDScore. calculateDScore keeps taking only item ids.
Only the layout of the doc comments changes. printSchema gives the same result before and after.
41053dc to
bcd34bd
Compare
7041f84 to
127735f
Compare
4bde9f2 to
a592ac3
Compare
A logged-in coach can create, rename and delete gymnasts and routines, change a gymnast's list one item at a time, and replace the items of a routine. Every operation only reaches the coach's own data (NOT_FOUND for anything else). Names are 1-70 characters, the lists have limits, NAME_TAKEN, INVALID_ITEMS and LIMIT_REACHED are returned in the right cases, and Routine.dScore is null while the routine has a removed item. The loaders keep the number of queries the same for any number of gymnasts.
127735f to
6392b73
Compare
Sign in
to join this conversation on GitHub.
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
A logged-in coach can keep gymnasts, their lists of elements and their routines through the API. Closes #73.
Stacked. The base is
70-session-tokens(#82, the session), which is on #78 (codegen), #77 (calculator) and #65 (server). This branch also contains a merge of the branch of #49 (the schema fields it needs), so until #49 is merged intodevthe diff of this PR includes #49's changes. Change the base todevwhen the others are merged. It does not depend on the Google login (#71, draft): it only needs to know who is asking, which the access token from #82 gives.What's in it
NOT_FOUNDwith the same message as an unknown id, and nothing changes (tested for all ten operations).NOT_FOUND. Removed item: cannot be added (INVALID_ITEMS), can be taken out. At most 100.NAME_TAKENper gymnast and apparatus, at most 50 per gymnast.setRoutineItems: replaces the list in one transaction and setsupdatedAt. Items must be on the routine's apparatus, at most one vault on vault, a removed item may stay but not be added. The first statement of the transaction updates the routine row, which locks it, so two saves at the same moment follow each other (last one wins, tested). A failed save changes nothing.Routine.dScore: the calculator's function;nullwhile the routine has a removed item.NOT_FOUND,NAME_TAKEN,LIMIT_REACHED. ADateTimescalar (ISO 8601). The login resolvers moved toresolvers/auth.ts.docs/API.mdreplaces "What is not built yet"; README anddocs/AI_USAGE.mdupdated.Things to know
docs/API.md.include.Testing
tsc --noEmitand 192 tests pass against a database (0 skipped); 40 are new (userData.test.ts, with two test coaches that are deleted afterwards, and one element that is marked removed and restored).🤖 Generated with Claude Code