Add PATCH event API and improve event removal handling#15
Merged
Conversation
Owner
IsaacDSC
commented
Oct 17, 2025
- Introduce PATCH /api/v1/event/{id} for updating events - Refactor event removal to clear cache and database - Add Backoffice Repository mock for testing - Update Makefile to support new mocks - Rename backoffice files for clarity - Add example and test files for PATCH event - Extend cache interface with RemoveValue method - Implement RemoveValue in cache strategy - Update interstore repository for event update and fetch by ID
- Introduce PATCH /api/v1/event/{id} for updating events - Refactor
event removal to clear cache and database - Add Backoffice Repository
mock for testing - Update Makefile to support new mocks - Rename
backoffice files for clarity - Add example and test files for PATCH
event - Extend cache interface with RemoveValue method - Implement
RemoveValue in cache strategy - Update interstore repository for event
update and fetch by ID
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a PATCH /api/v1/event/{id} endpoint and refactors event removal to invalidate cache alongside database updates. Key changes include:
- Introduce PATCH handler to update events with cache hydration and repository UpdateEvent
- Refactor DELETE handler to clear cache and disable event using RemoveValue and GetEventByID
- Extend cache interface and mocks; add backoffice repository mock and wire routes
Reviewed Changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/httpadapter/handle.go | Rename package to httpadapter to standardize HTTP adapter naming |
| pkg/cachemanager/cache_strategy.go | Add Strategy.RemoveValue to delete a key and run a callback |
| pkg/cachemanager/cache_mock.go | Add RemoveValue to Cache mock |
| pkg/cachemanager/adapter.go | Extend Cache interface with RemoveValue |
| internal/wtrhandler/external_handle_http.go | Switch to httpadapter.HttpHandle |
| internal/interstore/store.go | Extend Repository: UpdateEvent, GetEventByID |
| internal/interstore/postgres_store.go | Implement GetEventByID and UpdateEvent in PostgresStore |
| internal/backoffice/repository_mock.go | Add generated mock for backoffice Repository |
| internal/backoffice/remove_event_handle.go | New DELETE handler: invalidate cache and disable event |
| internal/backoffice/remove_event.go | Remove old DELETE handler (replaced by new version) |
| internal/backoffice/register_event_consumer_archived.go | Migrate to httpadapter.HttpHandle |
| internal/backoffice/register_event_consumer.go | Migrate to httpadapter and centralize Repository interface |
| internal/backoffice/path_event_handle_test.go | Tests for PATCH event handler |
| internal/backoffice/path_event_handle.go | New PATCH handler to update events and hydrate cache |
| internal/backoffice/interfaces.go | Backoffice Repository interface definition |
| internal/backoffice/insights_handle.go | Migrate to httpadapter.HttpHandle |
| internal/backoffice/health_check_handle.go | Migrate to httpadapter.HttpHandle |
| internal/backoffice/get_event.go | Migrate to httpadapter.HttpHandle |
| example/path_event_data.json | Example payload for PATCH event |
| example/example.md | Update docs; add PATCH usage example |
| deployment/charge-tests/plan.md | Add test planning document |
| deployment/app-pgsql/docker-compose.yaml | Update compose profile value |
| cmd/setup/httpserver.go | Wire new PATCH route and rename adapters |
| Makefile | Add mock generation/check for backoffice repository |
| .todos.md | Add TODO item |
Comments suppressed due to low confidence (1)
example/example.md:1
- The DELETE example includes a literal '\n' in the command, which will break copy/paste. Remove the '\n' so the curl command is valid on a single line.
### Example create event
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.