Skip to content

628 add revert to defaults branding#657

Open
Peolite001 wants to merge 4 commits into
davedumto:mainfrom
Peolite001:628-add-revert-to-defaults-branding
Open

628 add revert to defaults branding#657
Peolite001 wants to merge 4 commits into
davedumto:mainfrom
Peolite001:628-add-revert-to-defaults-branding

Conversation

@Peolite001
Copy link
Copy Markdown
Contributor

Closes #628

Description

This PR implements #628 - Add revert-to-defaults action on the routes-b branding endpoint.

Changes Made

All changes are strictly inside app/api/routes-b/:

  • app/api/routes-b/_lib/branding.ts (new)

    • Defines DEFAULT_BRANDING
    • Added revertBrandingToDefaults() helper that performs atomic revert using Prisma transaction
  • app/api/routes-b/branding/revert/route.ts (new)

    • New POST /branding/revert endpoint
    • Reverts all branding fields to defaults atomically
    • Captures previous branding values for audit logging
  • Audit log entry created with oldValues so the previous state can be restored manually if needed.

Key Features

  • Single database transaction for safety
  • Works whether branding record exists or not (uses upsert)
  • Audit trail with previous configuration saved
  • Handles "already default" case gracefully (no-op)

Acceptance Criteria Met

  • Single transaction used
  • Audit captures previous configuration
  • Tests cover revert from custom + already default states

Out of Scope

  • Versioned branding history
  • Per-field revert

…- Add strict #RRGGBB hex color validation

- Enforce max 100 tags per user with atomic transaction (409 on exceed)
- Trim + lowercase tag names + length validation (max 32 chars)
- Add TAG_LIMITS constant in _lib/limits.ts
- Add comprehensive tests for success and failure cases

Closes davedumto#536
- Enrich tags list response with usageCount (invoices + contacts)
- Use single optimized Prisma query with _count (no N+1)
- Add 30-second in-memory caching with proper invalidation on POST
- Update POST response to include usageCount: 0 for new tags
- All changes kept inside app/api/routes-b/ as per scope

Closes davedumto#611
- New GET /notifications/digest?date=YYYY-MM-DD
- Respects user timezone for day boundaries
- Single Prisma groupBy query (no N+1)
- Rejects future dates
- Added helper in _lib/notifications.ts

Closes davedumto#623
- Added atomic revert using upsert in transaction
- Captures previous branding values for audit logging
- Created shared helper in _lib/branding.ts
- Audit log entry created with oldValues

Closes davedumto#628
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

@Peolite001 is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Add revert-to-defaults action on routes-b branding

1 participant