Add UnitType DTO for list and detail responses - #6
Merged
Conversation
UnitTypeResource was returning raw Saloon Response objects, leaving callers to dig into Dutch JSON keys themselves. Introduce a typed UnitType DTO that covers both the list and detail responses, with nullable detail-only fields, so the resource is on par with ProjectResource and consumers get typed access end-to-end. Changelog: added
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
UnitTypeDTO covering bothGET /projects/{uuid}/projectwoningen/(list) andGET /projects/{uuid}/projectwoningen/{uuid}/(detail) — one DTO, detail-only fields nullable so the list endpoint populates them asnull.GetUnitTypeRequest::createDtoFromResponse()andGetUnitTypesRequest::createDtoFromResponse(); updatesUnitTypeResource::list()to returnUnitType[]andget()to returnUnitType, matching theProjectResourceshape.Project::fromResponse():toInt()for numeric strings andtoBool()for the"-1"/"0"convention used byProjectwoning_Online. No Carbon needed — the unit-type response carries no dates.Woning_Type→kind,Eigendom→ownership,Huurkoop→tenure) stay as?stringfor now; promote to enums in a follow-up once the full value sets are known.Test plan
vendor/bin/pest— full suite green locally (32 passed, 213 assertions; +13 new tests).NieuwbouwOffice::unitTypes('<project-uuid>')->list()and confirm an array ofUnitTypeinstances comes back.->get('<unit-uuid>')and confirm the detail-only fields (price_from,bedrooms_from,ownership,tenure, etc.) are populated.nullon the returned DTO.