Add Zona de marca brandbooks and strategist calendar generation.
Per-tenant brandbooks power ads, RRSS calendars, LinkedIn B2B and blog; Nov calendars now create from trends + client DNA instead of copying history. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,6 +8,10 @@ import { isAgencyRole, userRole } from '@/lib/agency';
|
||||
import { asPlanObject } from '@/lib/calendar-documents';
|
||||
import { generateMonthPreview } from '@/lib/calendar-generate';
|
||||
import type { RrssMonthPlan } from '@/components/RrssMonthView';
|
||||
import {
|
||||
BRANDBOOK_DOC_TYPE,
|
||||
parseBrandbook,
|
||||
} from '@/lib/brandbook';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const maxDuration = 60;
|
||||
@@ -64,11 +68,19 @@ export async function POST(req: NextRequest) {
|
||||
return String(b.month).localeCompare(String(a.month));
|
||||
});
|
||||
|
||||
const bb = await restGet<{ content?: unknown }[]>(
|
||||
`/rest/v1/documents?tenant_id=eq.${encodeURIComponent(
|
||||
ctx.tenantId
|
||||
)}&type=eq.${BRANDBOOK_DOC_TYPE}&select=content&order=updated_at.desc&limit=1`
|
||||
);
|
||||
const brandbook = parseBrandbook(bb.data?.[0]?.content);
|
||||
|
||||
const result = await generateMonthPreview({
|
||||
ym: month,
|
||||
slug,
|
||||
label: ctx.label,
|
||||
history,
|
||||
brandbook,
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
@@ -77,5 +89,6 @@ export async function POST(req: NextRequest) {
|
||||
rationale: result.rationale,
|
||||
source: result.source,
|
||||
brand: slug,
|
||||
brandbook: !!brandbook,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user