-
Notifications
You must be signed in to change notification settings - Fork 0
Implement PATCH method for partial updates #41
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestpriority:mediumPlanned enhancement. Queue for upcoming work.Planned enhancement. Queue for upcoming work.rustA language empowering everyone to build reliable and efficient softwareA language empowering everyone to build reliable and efficient software
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:mediumPlanned enhancement. Queue for upcoming work.Planned enhancement. Queue for upcoming work.rustA language empowering everyone to build reliable and efficient softwareA language empowering everyone to build reliable and efficient software
Problem
The API supports
PUTfor player updates, which requires sending the complete player payload even when only one or two fields need to change. APATCHendpoint would allow callers to update specific fields without providing the entire resource.Proposed Solution
Add
PATCH /players/squadnumber/<squad_number>for partial updates.squad_number(natural key, present in the URL path) andid(UUID surrogate key).squad_numberorid, the endpoint returns400 Bad Request.Suggested Approach
PlayerPatchRequeststruct insrc/models/player.rswith all patchable fields asOption<T>. Excludesquad_numberandid.patchfunction insrc/services/player_service.rsthat retrieves the existing player bysquad_numberand applies only theSome(…)fields.#[patch("/players/squadnumber/<squad_number>")]handler insrc/routes/players.rs. Check for forbidden fields →400. Look up player →404if missing. ReturnStatus::NoContenton success.src/main.rs.Acceptance Criteria
PATCH /players/squadnumber/<squad_number>is implementedsquad_numberandidare patchable204 No Contenton success400 Bad Requestif the body containssquad_numberorid400 Bad Requeston field validation failure404 Not Foundwhen no player has that squad numberCHANGELOG.mdupdatedReferences