Skip to content

refactor(shared): extract artifact status/scope/type vocab into shared constants module #2005

@cdcore09

Description

@cdcore09

Summary

Artifact lifecycle status, scope, and event-type enum values are currently re-declared in multiple files (admin route validation, admin list-page filters, public route filters). The drizzle pgEnum is the authoritative source but isn't easy to import as a const array for UI dropdowns and zod schemas.

Requirements

  • Create a shared module exporting const arrays + label maps for: artifactStatus, artifactScope, artifactReviewDecision, broadcastChannel, broadcastChannelStatus, eventType
  • The shared module must be importable from both packages/api and apps/admin (possibly apps/web too)
  • Refactor existing redeclarations to import from the shared module:
    • packages/api/src/routes/admin/events/index.ts
    • packages/api/src/routes/admin/events/byId.ts
    • packages/api/src/routes/admin/announcements/index.ts
    • packages/api/src/routes/admin/announcements/byId.ts
    • packages/api/src/routes/eventsSubmit.ts
    • apps/admin/src/pages/events/EventsListPage.tsx
    • apps/admin/src/pages/events/NewEventPage.tsx
    • apps/admin/src/pages/announcements/AnnouncementsListPage.tsx

Context

Flagged in the Plan 3 review. As Plan 4 (forms) and Plan 5 (broadcast) add more surfaces touching these enums, drift risk compounds.

Implementation Notes

The existing monorepo structure suggests a new packages/shared/ workspace or extending packages/design-system/ with a constants subpath. Pick whichever fits the existing pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions