use domain + dto models for events api + cli - #189
Open
TheJolman wants to merge 18 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the Events API and CLI to use domain.* models for service/business logic and dto.* models for HTTP/CLI payloads, updating API docs and fixtures accordingly.
Changes:
- Switch Events service and handler layers to operate on
domain.Event/domain.UpdateEventand convert responses todto.Event. - Update CLI event create/update commands (and announcement time parsing) to use
dtopayloads and shared time parsing helpers. - Regenerate Swagger docs and update JSON fixtures for the new DTO shapes.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/time.go | Adds shared time layout and parsing helper used by CLI/API flows. |
| utils/convert.go | Removes old byte-slice conversion helpers by commenting them out. |
| internal/dto/event.go | Adds DTO↔domain conversions for events, including update DTO conversion. |
| internal/domain/event.go | Removes UUID field from domain.UpdateEvent. |
| internal/cli/events/post.go | Uses dto.Event and the new time parsing helper when creating events. |
| internal/cli/events/put.go | Uses dto.Event/dto.UpdateEvent and formats/parses timestamps for edits. |
| internal/cli/announcements/post.go | Switches announcement time parsing to the new helper. |
| internal/cli/announcements/put.go | Switches announcement time parsing to the new helper. |
| internal/api/store/events_mapper.go | Updates event update mapping after removing UUID from domain update model. |
| internal/api/services/event.go | Moves service interface to domain models; adds DB↔domain mapping. |
| internal/api/services/board.go | Adds a TODO note about filter types. |
| internal/api/handlers/event.go | Returns DTOs from handlers and updates swagger annotations. |
| internal/api/docs/swagger.yaml | Replaces dbmodels event schemas with DTO event schemas. |
| internal/api/docs/swagger.json | Same as above for JSON swagger. |
| internal/api/docs/docs.go | Same as above for embedded swagger template. |
| fixtures/event_update_partial.json | Updates fixture payload shape to DTO style. |
| fixtures/event_update_location.json | Updates fixture payload shape to DTO style. |
| fixtures/event_update_full.json | Updates fixture payload shape to DTO style. |
Comments suppressed due to low confidence (1)
internal/dto/event.go:23
- ToDomain converts StartAt/EndAt via utils.UnixToTime, which currently interprets the int64 as Unix seconds. In this repo, event timestamps are stored/used as UTC milliseconds (see sql/migrations/000002_create_events.up.sql and fixtures), so this will mis-convert times by ~1000x. Update the conversion (and the reverse DTO mapping) to use milliseconds consistently.
Uuid: e.Uuid,
Location: e.Location,
StartAt: utils.UnixToTime(e.StartAt),
EndAt: utils.UnixToTime(e.EndAt),
IsAllDay: e.IsAllDay,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
TheJolman
marked this pull request as ready for review
August 2, 2026 01:57
GaballaGit
approved these changes
Aug 2, 2026
GaballaGit
left a comment
Member
There was a problem hiding this comment.
Looks good to me.
Action item:
Make an issue for the following comment:
// TODO: these filters should probably operate on domain models
Member
|
wait wrong comment oops, I mean this one: |
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.
closes #156