Skip to content

feat: persist community events to the database#1010

Open
Arowolokehinde wants to merge 1 commit into
bakeronchain:mainfrom
Arowolokehinde:feat/persist-community-events-to-db
Open

feat: persist community events to the database#1010
Arowolokehinde wants to merge 1 commit into
bakeronchain:mainfrom
Arowolokehinde:feat/persist-community-events-to-db

Conversation

@Arowolokehinde

Copy link
Copy Markdown
Contributor

Summary

Replaces the in-memory events array in community.controller.ts with proper pg pool queries backed by a new community_events table.

  • Add migration 022_community_events.sql: community_events table with a CHECK constraint enforcing valid event types, and B-tree indexes on type and date for O(log n) filtering and sort-free ordering.
  • Add 022_community_events.undo.sql for clean rollback.
  • Rewrite getEvents/createEvent as async handlers using pool.query(), structured logging via logger.child(), and input validation with asNonEmptyString() matching the sponsors.controller.ts pattern.
  • Drop the two hardcoded placeholder events; seed data does not belong in production application code or migrations.
    Closes feat: persist community events to the database instead of an in-memory array #1004

Type of Change

  • Bug fix
  • New feature
  • Smart contract change
  • Documentation
  • Breaking change
  • Other (please describe)

Checklist

  • Tests added or updated
  • No hardcoded secrets or private keys
  • If contract change: cargo test passes
  • If frontend change: npm run typecheck passes
  • If backend change: npm test passes
  • Related issues linked (Closes #...)
  • Self-review completed
  • Code follows project style guidelines

Screenshots (if applicable)

Testing

Additional Notes

Replaces the in-memory events array in community.controller.ts with
proper pg pool queries backed by a new community_events table.

- Add migration 022_community_events.sql: community_events table with
  a CHECK constraint enforcing valid event types, and B-tree indexes on
  type and date for O(log n) filtering and sort-free ordering.
- Add 022_community_events.undo.sql for clean rollback.
- Rewrite getEvents/createEvent as async handlers using pool.query(),
  structured logging via logger.child(), and input validation with
  asNonEmptyString() matching the sponsors.controller.ts pattern.
- Drop the two hardcoded placeholder events; seed data does not belong
  in production application code or migrations.
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.

feat: persist community events to the database instead of an in-memory array

1 participant