2.7 KiB
Admin events, polls, banners, and prefixes design
Goal
Port the complete events, CMS polls, banners, and user-prefix administration modules from habbo-next into EpicNext without duplicating existing features or changing emulator-owned data.
Compatibility boundary
EpicNext keeps its existing legacy polls, polls_questions, and polls_answers models untouched. The imported module uses independent website_polls, website_poll_questions, and website_poll_votes tables.
Events use dedicated website_event_* tables. Banners use website_banners. Prefixes use user_prefixes plus their configuration/blacklist tables. Every new table is CMS-owned and introduced through an idempotent versioned migration compatible with the existing migration runner.
Application architecture
Each module is a complete vertical slice:
- Prisma models map the CMS tables and relations.
- Zod validators define action inputs for events and polls.
- Server actions use EpicNext's existing
adminAction, audit logging, and ACL helpers. - Pages live under
/admin/events,/admin/polls,/admin/banners, and/admin/prefixeswithout[locale]routing. - Components use EpicNext semantic theme variables and existing admin primitives.
- Navigation exposes modules only through the existing staff guard.
No direct copy retains habbo-next locale parameters, route prefixes, or repository-specific imports.
Permissions
The canonical permission list gains view/edit pairs for events, polls, banners, and prefixes. The ACL seed migration inserts the new slugs idempotently. Existing highest-rank super-admin behavior remains unchanged. Administrator fallback grants view permissions only; edit permissions remain explicit except for the dynamic super-admin.
Migration and deployment
One numbered migration creates the CMS tables, indexes, foreign keys where safe, and ACL permission rows. It never drops or renames emulator tables. Prisma generation runs after migration through the existing deploy workflow.
Failure behavior
Actions validate input, fail closed on missing permissions, log administrative mutations, and return the existing safe-action result shape. Pages handle missing records with notFound() and empty tables with themed empty states.
Verification
- migration contract and idempotency tests;
- schema contract tests for every new mapped table;
- validator tests for invalid dates, statuses, and poll questions;
- action permission/import contract tests;
- route existence and locale-free import audit;
- targeted module tests, complete test suite, typecheck, Prisma generation, and production build;
- final Git audit excludes the local
package.jsonmodification.