Feature: Project update model, list request and newest-first ordering - #143
Merged
Conversation
ProjectStatusUpdate and ProjectStatusUpdateList cover
GET /projects/api/v3/projects/{projectId}/updates.json and its site-wide
variant. The type carries "status" because ProjectUpdate is already the
function that edits a project.
The constructor pins orderBy=date and orderMode=desc rather than inheriting
the order: the published default is ascending while the endpoint answers
newest-first, and the request type is new so nothing depends on either.
Project gains its update relationship and both project responses a
projectUpdates sideload slot, so a project row can resolve its current update.
color is a plain string, not twapi.HexColor, which rejects the empty value the
endpoint returns when the health is not set.
HexColor takes six digits with or without the leading "#" and always encodes with it, so an endpoint that omits the sign no longer costs the whole response. Allocation.Color uses it instead of a plain string. NewHexColor normalises the same way, rather than storing "##rrggbb" for a caller that passes the form it read off a design tool. OptionalHexColor is that type plus the blank: it reads null, "" and a bare "#" as unset, and encodes unset back as "", which keeps its declared string type accurate for consumers deriving a schema from these models. ProjectStatusUpdate.Color uses it — the endpoint reports no colour for a project nobody has rated. The custom field dropdown and rating options take it with omitempty, which fixes both directions of an optional colour: a request that set none used to send the bare "#" the endpoint rejects, and a choice stored without one comes back as that same "#", which HexColor refused to decode.
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.
Description
ProjectStatusUpdateandProjectStatusUpdateListcoverGET /projects/api/v3/projects/{projectId}/updates.jsonand its site-wide variant. The type carries "status" becauseProjectUpdateis already the function that edits a project.The constructor pins
orderBy=dateandorderMode=descrather than inheriting the order: the published default is ascending while the endpoint answers newest-first, and the request type is new so nothing depends on either.Project gains its update relationship, and both project responses have a
projectUpdatessideload slot, so a project row can resolve its current update.Type of Change
Testing
go test -v ./...)Checklist