feat: add event types to events model, validator, and migration#388
Open
feat: add event types to events model, validator, and migration#388
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for categorizing events by introducing an array of allowed “event types” that can be stored on events, validated on input, and returned in the public events listing.
Changes:
- Add
typesJSON column to theeventstable via a migration. - Add
EventTypes/EventTypedefinitions andALLOWED_EVENT_TYPESlist for validation. - Extend event create/update validators and public events selection to include
types.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| database/migrations/1770630511827_create_add_type_to_events_table.ts | Adds nullable types JSON column to events table. |
| app/validators/event.ts | Validates types as an optional/nullable array of allowed event types for create/update. |
| app/types/event_types.ts | Defines allowed event-type values and exports a list for validation. |
| app/models/event.ts | Adds types column to the Event model. |
| app/controllers/events_controller.ts | Includes types in the publicIndex select list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… fix typos in event categories
…array return type
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.
Important
Add
categoriesfield to events with model, validation, and migration updates.categoriescolumn toeventstable in1770630511827_create_add_type_to_events_table.ts.categoriesfield toEventmodel inevent.tswith JSON serialization/deserialization.createEventValidatorandupdateEventValidatorinvalidators/event.tsto includecategoriesas an optional array ofALLOWED_EVENT_CATEGORIES.store()andupdate()inevents_controller.tsto handlecategoriesfield, defaulting to an empty array if null.This description was created by
for c116e03. You can customize this summary. It will automatically update as commits are pushed.