fix: wire brief submission, brand briefs page, and creator profile to real API#18
Merged
fix: wire brief submission, brand briefs page, and creator profile to real API#18
Conversation
… 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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three Phase 1 features were left with mock-only wiring after Phase 3 shipped. This PR fixes all three:
onSubmit()previously calledsetSubmitted(true)only. NowPOST /api/v1/briefsis called; success sets submitted state, failure showstoast.error(). Mock agency list replaced withtest_agency_001(the only seeded agency).agencyrole; brand managers received 403. Handler now falls back torequireBrandAuth()on 403. Newapp/(brand)/brand/briefs/page.tsxServer Component lists briefs submitted by the authenticated brand manager.mockCreatorsfixture;handleSave()calledtoast.success()without any fetch. NewGET/PATCH /api/v1/profileendpoints 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 pageapp/api/v1/profile/route.ts— GET + PATCH creator profile endpointlib/validations/creator.ts—UpdateCreatorProfileSchema(Zod)Modified files
components/briefs/SubmitBriefForm.tsx— real fetch, real agency IDapp/api/v1/briefs/route.ts— dual-role GET (agency + brand_manager)app/(creator)/creator/profile/page.tsx— serverFetch instead of mockCreatorscomponents/creator/CreatorProfileEditor.tsx— inline type, real PATCHdocs/API.md— documented new profile endpoints and GET /api/v1/briefs multi-role behaviourQuality gates
npm run typecheck— ✅ 0 errorsnpm run lint— ✅ 0 errors (14 pre-existing warnings unchanged)npm run test— ✅ 119/119 passnpm run build— ✅ clean, all routes present in output🤖 Generated with Claude Code