Summary
Product doc section 4.5 describes 'Context Cards' — multiple curated cards per user (Professional, Hackathon, Community). Currently the cards.ts route handles creation, but there is no shared utility to validate card platform selections or diff two versions of a card.
Context
This utility lives in packages/shared so it can be used by both the web and mobile clients. The backend apps/backend/src/routes/cards.ts creates cards, but the validation is minimal.
Tasks
Acceptance Criteria
Difficulty
medium — cross-package logic, requires careful TypeScript type design and edge case coverage.
Summary
Product doc section 4.5 describes 'Context Cards' — multiple curated cards per user (Professional, Hackathon, Community). Currently the
cards.tsroute handles creation, but there is no shared utility to validate card platform selections or diff two versions of a card.Context
This utility lives in
packages/sharedso it can be used by both the web and mobile clients. The backendapps/backend/src/routes/cards.tscreates cards, but the validation is minimal.Tasks
packages/shared/src/cards.ts(new file), create:validateCardPlatforms(platforms: string[]): ValidationResult— checks that all platform IDs in a card are inPLATFORMS, max 10 platforms, no duplicates.diffCardPlatforms(oldCard: string[], newCard: string[]): { added: string[], removed: string[], unchanged: string[] }— pure diff utility.type CardValidationResult = { valid: boolean; errors: string[] }.packages/shared/src/index.ts.packages/shared/src/__tests__/cards.test.tscovering edge cases: empty array, all-invalid platforms, duplicate platforms, max exceeded.apps/backend/src/routes/cards.tsto usevalidateCardPlatformsfor input validation instead of ad-hoc checks.Acceptance Criteria
pnpm -r testpasses.Difficulty
medium— cross-package logic, requires careful TypeScript type design and edge case coverage.