use dto and domain models for tiers + positions#187
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Board “tiers” and “positions” API to use DTO + domain models end-to-end, and renames the position identifier from oid to officer_id across the DB schema, sqlc queries/models, service layer, handlers, and swagger artifacts.
Changes:
- Rename
position.oid→position.officer_id(migration, queries, sqlc models, DTO/domain/store mappers). - Refactor BoardService/BoardHandler tier + position flows to return/accept
domain.*internally anddto.*at the API boundary. - Update routes and swagger docs to reflect tier param rename (
:id→:tier) and DTO-based schemas.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| sql/queries/board.sql | Updates position queries to use officer_id instead of oid. |
| sql/migrations/000003_create_officers.up.sql | Renames the position PK/FK column to officer_id. |
| internal/dto/tier.go | Adjusts tier DTO update payload shape. |
| internal/dto/position.go | Renames Oid → OfficerID, adds delete DTO, aligns tier type to int64. |
| internal/domain/position.go | Renames Oid → OfficerID, adds domain delete model, changes tier type to int64. |
| internal/domain/officer.go | Removes UUID from update model. |
| internal/api/store/dbmodels/models.go | Renames dbmodel Position field to OfficerID. |
| internal/api/store/dbmodels/board.sql.go | sqlc-generated updates for officer_id columns/params. |
| internal/api/store/board_mapper.go | Updates tier/position domain↔db mappings to match renamed fields/types. |
| internal/api/services/board.go | Board service now returns domain models for tiers/positions. |
| internal/api/routes/v1.go | Renames tiers path param :id → :tier. |
| internal/api/handlers/board.go | Handlers updated to bind DTOs and (partially) return DTOs; swagger annotations updated. |
| internal/api/docs/swagger.yaml | Replaces dbmodels schemas with dto schemas and updates tiers path param name. |
| internal/api/docs/swagger.json | Same as swagger.yaml (JSON form). |
| internal/api/docs/docs.go | Same as swagger.yaml (embedded template). |
| fixtures/*.json | Updates fixture payloads to match DTO JSON (strings instead of sql.Null* objects, officer_id rename). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+73
to
76
| officer_id = ?; | ||
|
|
||
| -- NOTE: Had to declare above table as :one, may need to change later to :many | ||
|
|
5cdf6c2 to
ea309e6
Compare
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.
mb for big PR, underestimated it
all routes tested at least once
this is an api-only change, will address CLI in next PR
closes #179
progress for #156