Files
4ventures-client-portal/scripts/enrich_thin_dna.ts
4Ventures 4a1abd3318 feat: LinkedIn editorial, accesos agencia estables y deshacer en historial
Integra estrategias LinkedIn en calendarios (backlog publicado vs pendiente), unifica roles/cookies de vista agencia y permite deshacer cambios de brandbook dejando constancia en el historial.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-16 04:15:51 +02:00

47 lines
1.2 KiB
TypeScript

/**
* Force-seed enrich for DNA-thin brandbooks after calendar-generate-brand updates.
*/
import { config } from 'dotenv';
import { resolve } from 'path';
config({ path: resolve(process.cwd(), '.env.local') });
import { enrichTenantBrandbook } from '../src/lib/brandbook-enrich';
const THIN = [
'delgado-abogados',
'equinsa-parking',
'fbm-abogados',
'la-freseria',
'virginia-molet',
'wine-advisors',
];
async function main() {
const url = process.env.NEXT_PUBLIC_SUPABASE_URL!;
const key = process.env.SUPABASE_SERVICE_ROLE_KEY!;
const h = {
apikey: key,
Authorization: `Bearer ${key}`,
};
const tenants = (await fetch(
`${url}/rest/v1/tenants?slug=in.(${THIN.join(',')})&select=id,slug`,
{ headers: h }
).then((r) => r.json())) as { id: string; slug: string }[];
for (const t of tenants) {
const r = await enrichTenantBrandbook({ tenantId: t.id, forceSeed: true });
console.log(
t.slug,
`${r.completenessBefore}→${r.completenessAfter}`,
'filled',
(r.filledFields || []).slice(0, 10).join(',') || '-',
r.warning || ''
);
}
}
main().catch((e) => {
console.error(e);
process.exit(1);
});