feat(badges): add awards, mentorship, and contribution badges
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 33
- Forks
- 104
- Avg merge
- 12h 3m
- Merged PRs (30d)
- 10
Description
Summary
Phase 3 of the badge expansion. Adds three new tables — `awards`, `mentorship_pairings`, `community_contributions` — and wires `computeBadges` to surface ~15 new badges spanning recognition, paired mentorship, and sustained contribution to community resources.
Requirements
Schema
- `awards` table: id, name, slug, description, tier (e.g., 'lifetime' | 'annual' | 'special'), visual accent. Plus `user_awards` (user_id, award_id, awarded_at, citation, awarding_event_id?).
- `mentorship_pairings` table: id, mentor_id, mentee_id, program_slug, started_at, ended_at?, notes?. Both sides earn a paired badge with the partner's name in the tooltip.
- `community_contributions` table: id, contributor_id, kind ('newsletter' | 'tutorial' | 'guide' | 'translation' | 'comm-call-host' | ...), title, url?, published_at. One row per attributed contribution.
Badges
- USRSE Award (parameterized — one badge kind, accent + label vary by award tier).
- Rising Star, Mentor of the Year, Excellence in Service, Lifetime Achievement (named awards, derive from `user_awards` joined to `awards`).
- Mentor / Mentee badges from `mentorship_pairings`.
- Newsletter Contributor, Resource Author, Tutorial Author, Translator, Community Call Host from `community_contributions` filtered by kind.
- First Contribution milestone (one per user, on first `community_contributions` row).
- Sustained Contributor — 5+ contributions across any kind.
Visual
- Premium awards (Lifetime Achievement, Excellence) are good R2 artwork candidates — see # for the storage strategy.
- Default fallback glyphs in `HexStamp.tsx` for awards without commissioned artwork.
Context
Phases 1 and 2 (#1951, #1952) widen `computeBadges` to accept richer existing data without schema changes. This phase introduces the tables that don't exist yet. Each table is small and additive — none of them couple to existing tables in a way that risks the rest of the data model.
Implementation Notes
- Generate the migration via `drizzle-kit generate` for the three new tables. Mirror the FK and cascade rules from `event_attendances` (cascade on user delete, set null on awarding_event delete).
- Awards seed: start with the actual USRSE community awards as approved entries (Service Award, etc.) — admin tooling to grant them comes later.
- Mentorship pairing badge tooltip should include the partner's display name, surfaced via a join in `computeBadges`. That's a privacy-tinted decision — only show the partner if both are public/discoverable.
- Contribution-attribution should accept a free-text `title` plus optional `url` so we can backfill historical contributions before building any admin UI.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with computeBadges, the event_attendances schema for foreign-key and cascade conventions, and HexStamp.tsx for fallback glyphs. Review how the three tables should support the listed award, mentorship, and contribution badges, including the public/discoverable partner condition. Done means the migrations, seed entries, badge computation, tooltips, and fallback visuals cover the stated requirements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, database, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100