Skip to content

Custom Event - #7

Merged
Ret2Hell merged 2 commits into
mainfrom
dev
Apr 19, 2026
Merged

Ret2Hell merged 2 commits into
mainfrom
dev

Conversation

@Ret2Hell

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Apr 19, 2026 •

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 14c86e1b-55f2-4de0-89a9-be22cb14e7e2

📥 Commits

Reviewing files that changed from the base of the PR and between f6fb6e6 and d54b753.

📒 Files selected for processing (4)
  • internal/models/event.go
  • internal/server/handler.go
  • internal/validator/validator.go
  • internal/validator/validator_test.go

📝 Walkthrough

Walkthrough

The changes introduce support for a new "custom" event type that requires an optional EventName field. The custom type is added to event validation rules, and the EventName field is propagated through the event pipeline from raw events to internal events with validation ensuring non-empty values for custom event types.

Changes

Cohort / File(s) Summary
Event Model
internal/models/event.go
Added EventCustom event type constant and updated ValidEventTypes validation map. Introduced optional EventName field to both RawEvent and InternalEvent structs.
Event Handler
internal/server/handler.go
Extended event-to-internal mapping logic to include EventName field from raw events into InternalEvent objects.
Event Validation
internal/validator/validator.go
Added conditional validation rule requiring non-empty EventName (after whitespace trimming) when EventType equals EventCustom, with specific error message for violations.
Validation Tests
internal/validator/validator_test.go
Updated existing "all valid types" test to include EventCustom with valid EventName. Added two new test cases: one verifying batch invalidation with empty event_name for custom events, another verifying batch validity with populated EventName.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A custom event hops into view,
With names that must be true,
Through handlers and validators we go,
Field by field, the changes flow,
One more type to validate and chew! 🎉


Note

🎁 Summarized by CodeRabbit Free

The PR author is not assigned a seat. To perform a comprehensive line-by-line review, please assign a seat to the pull request author through the subscription management page by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@Ret2Hell
Ret2Hell merged commit 5687733 into main Apr 19, 2026
5 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.

1 participant