UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

156 lines (141 loc) 4.74 kB
import { PrismaClient } from "@prisma/client"; import bcrypt from "bcryptjs"; const prisma = new PrismaClient(); async function main() { console.log("🌱 시드 데이터 생성을 시작합니다..."); // 기본 테넌트 생성 const defaultTenant = await prisma.tenant.upsert({ where: { domain: "default.local" }, update: {}, create: { name: "기본 조직", slug: "default", domain: "default.local", description: "기본 조직입니다", settings: JSON.stringify({ allowUserRegistration: true, maxUsers: 100, features: ["cms", "analytics", "seo"], }), status: "ACTIVE", isActive: true, }, }); console.log("✅ 기본 테넌트 생성 완료:", defaultTenant.name); // 관리자 사용자 생성 const adminPassword = await bcrypt.hash("admin123!", 12); const adminUser = await prisma.user.upsert({ where: { email: "admin@example.com" }, update: {}, create: { email: "admin@example.com", name: "시스템 관리자", password: adminPassword, role: "ADMIN", isActive: true, emailVerified: new Date(), tenantId: defaultTenant.id, failedLogins: 0, }, }); console.log("✅ 관리자 사용자 생성 완료:", adminUser.email); // 템플릿 데이터 생성 (Business Template) const businessTemplate = await prisma.siteTemplate.upsert({ where: { slug: "business-template" }, update: {}, create: { name: "Business Template", slug: "business-template", description: "전문적인 비즈니스 웹사이트를 위한 템플릿", category: "BUSINESS", pricing: "FREE", sections: JSON.stringify({ hero: { type: "hero", props: ["title", "subtitle", "cta"] }, features: { type: "features", props: ["items", "columns"] }, about: { type: "about", props: ["content", "image"] }, contact: { type: "contact", props: ["form", "info"] }, }), styles: JSON.stringify({ colors: { primary: "#1a365d", secondary: "#2d3748", }, layout: "standard", }), previewImage: "/templates/business-preview.jpg", previewUrl: "https://business-demo.example.com", features: "responsive,seo-optimized,contact-form", tags: "business,professional,corporate", isActive: true, isPublic: true, }, }); console.log("✅ Business 템플릿 생성 완료:", businessTemplate.name); // Portfolio Template const portfolioTemplate = await prisma.siteTemplate.upsert({ where: { slug: "portfolio-template" }, update: {}, create: { name: "Portfolio Template", slug: "portfolio-template", description: "개인 포트폴리오와 크리에이티브 작업을 위한 템플릿", category: "PORTFOLIO", pricing: "FREE", sections: JSON.stringify({ hero: { type: "hero", props: ["name", "title", "image"] }, portfolio: { type: "portfolio", props: ["projects", "filter"] }, about: { type: "about", props: ["bio", "skills"] }, contact: { type: "contact", props: ["form", "social"] }, }), styles: JSON.stringify({ colors: { primary: "#7c3aed", secondary: "#a855f7", }, layout: "creative", }), previewImage: "/templates/portfolio-preview.jpg", previewUrl: "https://portfolio-demo.example.com", features: "gallery,animations,responsive", tags: "portfolio,creative,personal", isActive: true, isPublic: true, }, }); console.log("✅ Portfolio 템플릿 생성 완료:", portfolioTemplate.name); // 테스트 사이트 생성 const testSite = await prisma.site.upsert({ where: { slug: "my-first-site" }, update: {}, create: { name: "나의 첫 번째 사이트", slug: "my-first-site", subdomain: "my-first-site", description: "테스트용 사이트입니다", templateId: businessTemplate.id, status: "DRAFT", isPublished: false, ownerId: adminUser.id, settings: JSON.stringify({ theme: { primaryColor: "#1a365d", secondaryColor: "#2d3748", }, seo: { title: "나의 첫 번째 사이트", description: "테스트용 사이트입니다", }, }), }, }); console.log("✅ 테스트 사이트 생성 완료:", testSite.name); console.log("🎉 시드 데이터 생성이 완료되었습니다!"); } main() .catch((e) => { console.error("❌ 시드 데이터 생성 중 오류:", e); process.exit(1); }) .finally(async () => { await prisma.$disconnect(); });