Skip to content

Add a rewards catalog with admin create and update - #82

Draft
VidsterBroyo wants to merge 1 commit into
mainfrom
feat/rewards-catalog
Draft

VidsterBroyo wants to merge 1 commit into
mainfrom
feat/rewards-catalog

Conversation

@VidsterBroyo

@VidsterBroyo VidsterBroyo commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Notion ticket link

Ticket

Stack 1 of 4: rewards catalog. Next: redeeming, adjustments, points history.

Implementation description

  • rewards table: title, optional description, cost, optional image_id (FK to files), optional redemption_limit (per student) and stock_limit (across all students), and archived_at.
  • Archive instead of delete: rewards are archived rather than deleted, so redemptions in later PRs can keep pointing at them.
  • Database CHECK constraints: cost and limits must be positive. Prisma can't express these, so they're added by hand in the migration.
  • rewards(includeArchived): any signed-in user can list active rewards, cheapest first. Seeing archived ones is admin only.
  • createReward / updateReward: admin only.
    • updateReward changes only the fields sent. null clears an optional field, and archived: true/false archives or restores.
    • imageId must point to a finished upload.
  • Seed: five fixture rewards, including one archived, one with a per-student limit, and one with limited stock.

What should reviewers focus on?

  • Reward images can be stored but not viewed yet. The files service only lets staff, the uploader or a recipient's manager download a file. Reward images need a "readable by any signed-in user" rule. See TODO.md.
  • Tested against a real database: migrations applied, full seed run, and every case in the README's reward checks run live, plus the CHECK constraint tested directly in SQL.

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the TL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

🤖 Generated with Claude Code

Rewards have a title, optional description, cost, optional image (an FK to
files), and optional per-student redemption and stock limits. Admins create
and update them, and archive them instead of deleting so past redemptions
can still point at them. Any signed-in user can list active rewards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VidsterBroyo
VidsterBroyo added this pull request to stack #86 November 30, 2026 02:59
@VidsterBroyo VidsterBroyo changed the title feat: add a rewards catalog with admin create and update Add a rewards catalog with admin create and update Nov 30, 2026
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.

1 participant