Skip to content

[routes-b] GET /api/routes-b/branding — get invoice branding settings #412

@davedumto

Description

@davedumto

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

  • Returns `200` with branding object when it exists
  • Returns `{ "branding": null }` (not `404`) when no branding is set up
  • Returns `401` for unauthenticated requests

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions