Skip to content

fix: wire brief submission, brand briefs page, and creator profile to real API#18

Merged
parva3105 merged 1 commit intomasterfrom
fix/phase1-mock-wiring
Mar 22, 2026
Merged

fix: wire brief submission, brand briefs page, and creator profile to real API#18
parva3105 merged 1 commit intomasterfrom
fix/phase1-mock-wiring

Conversation

@parva3105
Copy link
Copy Markdown
Owner

Summary

Three Phase 1 features were left with mock-only wiring after Phase 3 shipped. This PR fixes all three:

  • SubmitBriefFormonSubmit() previously called setSubmitted(true) only. Now POST /api/v1/briefs is called; success sets submitted state, failure shows toast.error(). Mock agency list replaced with test_agency_001 (the only seeded agency).
  • GET /api/v1/briefs + brand briefs page — The GET handler only accepted agency role; brand managers received 403. Handler now falls back to requireBrandAuth() on 403. New app/(brand)/brand/briefs/page.tsx Server Component lists briefs submitted by the authenticated brand manager.
  • Creator profile — Page used mockCreators fixture; handleSave() called toast.success() without any fetch. New GET/PATCH /api/v1/profile endpoints added, profile page fetches real data, editor calls PATCH on save.

Files changed

New files

  • app/(brand)/brand/briefs/page.tsx — brand manager brief listing page
  • app/api/v1/profile/route.ts — GET + PATCH creator profile endpoint
  • lib/validations/creator.tsUpdateCreatorProfileSchema (Zod)

Modified files

  • components/briefs/SubmitBriefForm.tsx — real fetch, real agency ID
  • app/api/v1/briefs/route.ts — dual-role GET (agency + brand_manager)
  • app/(creator)/creator/profile/page.tsx — serverFetch instead of mockCreators
  • components/creator/CreatorProfileEditor.tsx — inline type, real PATCH
  • docs/API.md — documented new profile endpoints and GET /api/v1/briefs multi-role behaviour

Quality gates

  • npm run typecheck — ✅ 0 errors
  • npm run lint — ✅ 0 errors (14 pre-existing warnings unchanged)
  • npm run test — ✅ 119/119 pass
  • npm run build — ✅ clean, all routes present in output

🤖 Generated with Claude Code

… real API

- SubmitBriefForm: replace mock agencies (test_agency_001 only), add
  fetch() to POST /api/v1/briefs, show toast on success/failure
- GET /api/v1/briefs: support brand_manager role via fallback auth
  (agency first, then brand on 403)
- app/(brand)/brand/briefs/page.tsx: new Server Component listing briefs
  for the authenticated brand manager with empty state and status badges
- GET/PATCH /api/v1/profile: new endpoint returning/updating Creator
  record for authenticated creator; handle is immutable
- lib/validations/creator.ts: UpdateCreatorProfileSchema (Zod)
- creator/profile/page.tsx: replace mockCreators with serverFetch
- CreatorProfileEditor: replace MockCreator import with inline type,
  wire handleSave to PATCH /api/v1/profile with toast feedback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
project-alpha Ready Ready Preview, Comment Mar 22, 2026 5:58am

@parva3105 parva3105 merged commit 6f74985 into master Mar 22, 2026
3 checks passed
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