Repository navigation
feat(api): create custom exercises - #68
Merged
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 authenticated custom-exercise creation through
POST /exercises.A record created through this endpoint is always custom because its owner is always the authenticated user. Built-in exercises continue to be created only through the controlled seed process and have no owner.
Closes #67.
What changed
createExerciseInputSchemaand inferredCreateExerciseInputtype.POST /exercisesrouting.Request and response
The endpoint accepts only:
{ "name": "Cable Fly", "description": "Keep the movement controlled." }descriptionis optional and may be null. Input strings are trimmed. Names are limited to 100 characters and descriptions to 1,000 characters.A successful request returns
201 Createdwith the browser-safe exercise summary:{ "id": "generated-uuid", "name": "Cable Fly", "description": "Keep the movement controlled.", "isCustom": true }Ownership and security
The client cannot supply ownership. The input schema is strict and rejects extra fields such as
ownerUserId.The request flow is:
owner_user_id.Even if a user creates an exercise with the same name as a built-in exercise, the newly created record is custom because
isCustomrepresents record ownership, not whether its name appears in the built-in catalog.Error behavior
401 authentication_required400 invalid_request500 internal_server_errorhandlingVerification
Out of scope