v1.2.0: Symbol-Verwaltung, SOMA-Admin, Light Mode Farbsystem, Onboarding-Tour, Credit-Link

This commit is contained in:
Pepe Ziberi
2026-02-24 21:13:27 +01:00
parent d893373bd9
commit 1583ef2a17
12 changed files with 700 additions and 128 deletions

View File

@@ -24,10 +24,17 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
if (existing.length > 0) {
return NextResponse.json(existing)
}
const templates = await (prisma as any).journalCheckTemplate.findMany({
where: { isActive: true },
// Prefer tenant-specific templates; fall back to global (tenantId=null) if none exist
let templates = await (prisma as any).journalCheckTemplate.findMany({
where: { isActive: true, tenantId: user.tenantId || null },
orderBy: { sortOrder: 'asc' },
})
if (templates.length === 0 && user.tenantId) {
templates = await (prisma as any).journalCheckTemplate.findMany({
where: { isActive: true, tenantId: null },
orderBy: { sortOrder: 'asc' },
})
}
const items = await Promise.all(
templates.map((tpl: any, i: number) =>
(prisma as any).journalCheckItem.create({