Add Project DTO and expand it to cover the detail endpoint - #5
Merged
Conversation
The detail endpoint returns ~60 attributes per project, but the DTO only exposed seven of them; everything else was silently dropped. Map the full payload into typed, nullable properties so callers of the detail endpoint get the data they need, and parse date and timestamp fields into CarbonImmutable for ergonomic downstream use. Changelog: added Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the redundant numeric Project_Id mapping (the uuid already identifies a project) and convert the free-form internal status string into a typed ProjectStatus enum so callers can branch on known states instead of comparing Dutch labels. Changelog: changed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The API response is always string-or-null, so the int/self handling in parse() was dead weight. Use ProjectStatus::tryFrom() directly in the DTO mapping, guarded by isset() for the null case. Changelog: changed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
ProjectDTO and wires it throughGetProjectRequestandGetProjectsRequest, so the resource methods now return typed objects instead of raw response arrays.nesbot/carbonas a runtime dependency and parses all date and timestamp fields (includingcreated_at/updated_at) intoCarbonImmutableinstances.Project::$created_atandProject::$updated_atchange fromstringtoCarbonImmutable. Downstream consumers will need to update.Test plan
composer installto pick upnesbot/carbon ^3.0.vendor/bin/pest— full suite is green locally (19 passed, 137 assertions).presale_date,created_at, etc. come back asCarbonImmutableand that integer / float / bool fields are properly typed.null).🤖 Generated with Claude Code