Overview
Implement a `GET` handler that returns the authenticated user's invoice branding settings.
⚠️ Scope: Write your code only inside `app/api/routes-b/branding/route.ts`. Do not touch any file outside this folder.
Create the route file
File: `app/api/routes-b/branding/route.ts`
The `BrandingSettings` model already exists in `prisma/schema.prisma`. Check it for the full list of fields before writing your select clause.
Handler logic
- Verify auth (standard pattern)
- Find `BrandingSettings` where `userId === user.id`
- If no record exists → return `{ "branding": null }` with `200` (not `404`)
Expected response (branding exists)
```json
{
"branding": {
"id": "uuid",
"logoUrl": "https://example.com/logo.png",
"primaryColor": "#6366f1",
"footerText": "Thank you for your business!",
"signatureUrl": null,
"createdAt": "2025-01-01T00:00:00.000Z"
}
}
```
Expected response (no branding)
```json
{ "branding": null }
```
Acceptance criteria
Overview
Implement a `GET` handler that returns the authenticated user's invoice branding settings.
Create the route file
File: `app/api/routes-b/branding/route.ts`
The `BrandingSettings` model already exists in `prisma/schema.prisma`. Check it for the full list of fields before writing your select clause.
Handler logic
Expected response (branding exists)
```json
{
"branding": {
"id": "uuid",
"logoUrl": "https://example.com/logo.png",
"primaryColor": "#6366f1",
"footerText": "Thank you for your business!",
"signatureUrl": null,
"createdAt": "2025-01-01T00:00:00.000Z"
}
}
```
Expected response (no branding)
```json
{ "branding": null }
```
Acceptance criteria