Difficulty: Intermediate
Type: feature
Background
The README's Data Model section explicitly lists badges as a placeholder table in the Prisma schema, alongside communities, wallets, members, memberships, roles, access policies, profiles, and audit_events.
Problem
The badges table exists in the schema but has no API surface, so there's no way to create, assign, list, or revoke badges for members, leaving the feature unusable despite being modeled.
Expected outcome
New /v1/communities/:communityId/badges (list/create) and /v1/members/:wallet/badges (list/assign/revoke) endpoints let admins manage badges, backed by the existing Prisma model (extended if needed).
Suggested implementation
- Review/extend the
badges Prisma model as needed (name, description, iconUrl, communityId, and a join table for member-badge assignment).
- Add Fastify routes with request/response schemas for list, create, assign, and revoke.
- Emit an
OutboxEvent (e.g., a new BADGE_ASSIGNED/BADGE_REVOKED event type) for each mutation, following the existing outbox pattern.
- Add the new event types to
packages/shared-types.
- Add unit + integration tests and regenerate the OpenAPI spec.
Acceptance criteria
Likely affected files/directories
apps/access-api/prisma/schema.prisma
apps/access-api/src/routes/
packages/shared-types/
docs/openapi.json
Difficulty: Intermediate
Type: feature
Background
The README's Data Model section explicitly lists
badgesas a placeholder table in the Prisma schema, alongsidecommunities,wallets,members,memberships,roles,access policies,profiles, andaudit_events.Problem
The
badgestable exists in the schema but has no API surface, so there's no way to create, assign, list, or revoke badges for members, leaving the feature unusable despite being modeled.Expected outcome
New
/v1/communities/:communityId/badges(list/create) and/v1/members/:wallet/badges(list/assign/revoke) endpoints let admins manage badges, backed by the existing Prisma model (extended if needed).Suggested implementation
badgesPrisma model as needed (name, description, iconUrl, communityId, and a join table for member-badge assignment).OutboxEvent(e.g., a newBADGE_ASSIGNED/BADGE_REVOKEDevent type) for each mutation, following the existing outbox pattern.packages/shared-types.Acceptance criteria
docs/openapi.jsonLikely affected files/directories
apps/access-api/prisma/schema.prismaapps/access-api/src/routes/packages/shared-types/docs/openapi.json