Keep editorial calendars private to each tenant.

Stop seeding Agua Miia’s October plan for every client and restrict the portal publish action to that tenant only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-10-06 12:25:47 +02:00
parent 5b21ffce94
commit ead310e783
3 changed files with 55 additions and 9 deletions

View File

@@ -30,6 +30,20 @@ export async function POST() {
);
}
const t = await restGet<{ slug?: string; name?: string }[]>(
`/rest/v1/tenants?id=eq.${encodeURIComponent(ctx.tenantId)}&select=slug,name`
);
const slug = t.data?.[0]?.slug || '';
if (slug !== 'agua-miia') {
return NextResponse.json(
{
error:
'Este botón solo carga el plan de octubre de Agua Miia en su propio portal. No publica en Instagram ni copia el calendario a otros clientes.',
},
{ status: 400 }
);
}
const headers = serviceHeaders();
if (!headers) {
return NextResponse.json({ error: 'no service role' }, { status: 500 });