Skip to content

Implement CRUD endpoints for the badges data model (currently a placeholder) #261

Description

@Lakes41

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

  • Badges can be created per community and assigned/revoked per member
  • Mutations emit outbox events consistent with existing event types
  • New routes documented in docs/openapi.json
  • Tests cover create/assign/revoke/list flows

Likely affected files/directories

  • apps/access-api/prisma/schema.prisma
  • apps/access-api/src/routes/
  • packages/shared-types/
  • docs/openapi.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsfeatureNew feature, enhancement, or functional additionintermediateIntermediate difficulty tasks requiring solid experience and some context

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions