Skip to content

Refactor notification handling: replace Trigger with Consumer#23

Merged
IsaacDSC merged 5 commits intomainfrom
enhancement/replace-trigger-to-consumer
Feb 18, 2026
Merged

Refactor notification handling: replace Trigger with Consumer#23
IsaacDSC merged 5 commits intomainfrom
enhancement/replace-trigger-to-consumer

Conversation

@IsaacDSC
Copy link
Owner

  • Updated the NotifyTrigger method to Notify, changing its parameter from Trigger to Consumer.
  • Adjusted related tests and mocks to reflect the new Consumer structure.
  • Modified the ModelEvent struct to use Consumers instead of Triggers.
  • Updated PostgresStore methods to handle Consumers in place of Triggers.
  • Refactored dead letter queue handling to utilize Consumers.
  • Changed external HTTP handling to accommodate Consumers instead of Triggers.
  • Updated request handling to use Consumer in place of Trigger.
  • Renamed Trigger struct to Consumer for clarity and consistency across the codebase.

- Updated the NotifyTrigger method to Notify, changing its parameter from Trigger to Consumer.
- Adjusted related tests and mocks to reflect the new Consumer structure.
- Modified the ModelEvent struct to use Consumers instead of Triggers.
- Updated PostgresStore methods to handle Consumers in place of Triggers.
- Refactored dead letter queue handling to utilize Consumers.
- Changed external HTTP handling to accommodate Consumers instead of Triggers.
- Updated request handling to use Consumer in place of Trigger.
- Renamed Trigger struct to Consumer for clarity and consistency across the codebase.
@IsaacDSC IsaacDSC requested a review from Copilot February 18, 2026 13:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the codebase to replace the term "Trigger" with "Consumer" throughout the notification handling system. The change improves clarity by better representing that these entities consume events rather than trigger them.

Changes:

  • Renamed Trigger struct to Consumer across all files and updated related method signatures
  • Updated database schema to use consumers column instead of triggers
  • Modified domain constants from TriggerTypeInternal/External to EventTypeInternal/External
  • Removed unique_key database column and simplified queries to use name directly

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/wtrhandler/trigger.go Renamed Trigger struct to Consumer
internal/wtrhandler/request_handle_asynq_test.go Updated test cases to use Consumer instead of Trigger
internal/wtrhandler/request_handle_asynq.go Modified RequestPayload and interfaces to use Consumer
internal/wtrhandler/fetcher_mock.go Updated mock method from NotifyTrigger to Notify
internal/wtrhandler/external_handle_http_test.go Updated test assertions for Consumer and event type constants
internal/wtrhandler/external_handle_http.go Modified event publishing logic to iterate over consumers
internal/wtrhandler/deadletter_asynq_handle_test.go Updated dead letter queue tests for consumer terminology
internal/wtrhandler/deadletter_asynq_handle.go Changed dead letter handling to use consumers
internal/interstore/postgres_store.go Removed unique_key column and updated to use consumers JSONB
internal/interstore/model_event.go Updated ModelEvent to use Consumers field
internal/fetcher/notification_test.go Updated notification tests to use Consumer parameter
internal/fetcher/notification.go Renamed method from NotifyTrigger to Notify
internal/domain/event.go Updated domain model to use Consumer and renamed type constants
internal/backoffice/register_consumer.go Updated DTO to use Consumers field
internal/backoffice/path_event_handle_test.go Updated test to use Consumers in assertions
internal/asynqtask/fetch_msg_data.go Changed Schedulers field type to []domain.Consumer
internal/asynqtask/archived_task.go Renamed cache method from FindAllTriggers to FindAllConsumers
internal/asynqstore/cache_store.go Updated cache interface and implementation method names
example/path_event_data.json Updated example JSON to use consumers key
example/event_data.json Updated example JSON to use consumers key
deployment/tables.sql Removed unique_key column and renamed triggers to consumers
deployment/dashboard.sql Updated dashboard query to reference consumers column
README.md Updated documentation to reflect consumer terminology

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

IsaacDSC and others added 3 commits February 18, 2026 10:48
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@IsaacDSC IsaacDSC merged commit 36ce754 into main Feb 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants