feat(templates): add six reusable guide structures

This commit is contained in:
2026-08-28 16:17:41 +00:00 Unverified
parent 42c80965cf
commit 7761cacd10
7 changed files with 608 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
import { closeDb, getDb } from "@/db";
import { templates } from "@/db/schema";
import { builtInTemplates } from "@/lib/templates";
const db = getDb();
for (const template of builtInTemplates) {
await db
.insert(templates)
.values({
slug: template.slug,
name: template.name,
description: template.description,
category: template.category,
structure: template as unknown as Record<string, unknown>,
builtIn: true,
})
.onConflictDoUpdate({
target: templates.slug,
set: {
name: template.name,
description: template.description,
category: template.category,
structure: template as unknown as Record<string, unknown>,
builtIn: true,
updatedAt: new Date(),
},
});
}
await closeDb();