230 lines
8.3 KiB
JavaScript
230 lines
8.3 KiB
JavaScript
const { PrismaPg } = require("@prisma/adapter-pg");
|
|
const { PrismaClient } = require("@prisma/client");
|
|
const { Pool } = require("pg");
|
|
|
|
const connectionString =
|
|
process.env.DATABASE_URL ||
|
|
"postgresql://postgres:postgres@localhost:5432/moh_sass?schema=public";
|
|
|
|
const pool = new Pool({ connectionString });
|
|
const prisma = new PrismaClient({ adapter: new PrismaPg(pool) });
|
|
|
|
async function main() {
|
|
await prisma.appConfig.upsert({
|
|
where: { key: "siteName" },
|
|
update: { value: "moh-sass" },
|
|
create: { key: "siteName", value: "moh-sass" },
|
|
});
|
|
|
|
const brandCategory = await prisma.category.upsert({
|
|
where: { slug: "branding" },
|
|
update: {
|
|
nameAr: "الهوية البصرية",
|
|
nameEn: "Branding",
|
|
nameDe: "Branding",
|
|
descriptionAr: "مشاريع هوية بصرية وشعارات وأنظمة علامة.",
|
|
descriptionEn: "Brand identity, logo, and design system work.",
|
|
descriptionDe: "Branding, Logos und visuelle Systeme.",
|
|
sortOrder: 1,
|
|
isActive: true,
|
|
},
|
|
create: {
|
|
slug: "branding",
|
|
nameAr: "الهوية البصرية",
|
|
nameEn: "Branding",
|
|
nameDe: "Branding",
|
|
descriptionAr: "مشاريع هوية بصرية وشعارات وأنظمة علامة.",
|
|
descriptionEn: "Brand identity, logo, and design system work.",
|
|
descriptionDe: "Branding, Logos und visuelle Systeme.",
|
|
sortOrder: 1,
|
|
isActive: true,
|
|
},
|
|
});
|
|
|
|
const webCategory = await prisma.category.upsert({
|
|
where: { slug: "web-experiences" },
|
|
update: {
|
|
nameAr: "تجارب الويب",
|
|
nameEn: "Web Experiences",
|
|
nameDe: "Web Experiences",
|
|
descriptionAr: "مواقع وصفحات هبوط وتجارب رقمية سريعة.",
|
|
descriptionEn: "Websites, landing pages, and digital experiences.",
|
|
descriptionDe: "Webseiten, Landingpages und digitale Erlebnisse.",
|
|
sortOrder: 2,
|
|
isActive: true,
|
|
},
|
|
create: {
|
|
slug: "web-experiences",
|
|
nameAr: "تجارب الويب",
|
|
nameEn: "Web Experiences",
|
|
nameDe: "Web Experiences",
|
|
descriptionAr: "مواقع وصفحات هبوط وتجارب رقمية سريعة.",
|
|
descriptionEn: "Websites, landing pages, and digital experiences.",
|
|
descriptionDe: "Webseiten, Landingpages und digitale Erlebnisse.",
|
|
sortOrder: 2,
|
|
isActive: true,
|
|
},
|
|
});
|
|
|
|
const project = await prisma.portfolioProject.upsert({
|
|
where: { slug: "brand-redesign" },
|
|
update: {
|
|
categoryId: brandCategory.id,
|
|
titleAr: "إعادة تصميم الهوية",
|
|
titleEn: "Brand Redesign",
|
|
titleDe: "Brand Redesign",
|
|
summaryAr: "إعادة بناء لهوية رقمية مع نظام مرئي أوضح ومسارات استخدام أسرع.",
|
|
summaryEn: "A digital brand refresh with a clearer visual system and faster journeys.",
|
|
summaryDe: "Ein digitales Redesign mit klarerem visuellen System und schnelleren Journeys.",
|
|
clientName: "Studio Client",
|
|
projectYear: 2025,
|
|
serviceLabelAr: "هوية بصرية",
|
|
serviceLabelEn: "Brand Identity",
|
|
serviceLabelDe: "Brand Identity",
|
|
previewUrl: "https://example.com/preview/brand-redesign",
|
|
coverImagePath: "/uploads/portfolio/demo-cover.svg",
|
|
isFeatured: true,
|
|
isPublished: true,
|
|
publishedAt: new Date("2025-01-10T09:00:00.000Z"),
|
|
sortOrder: 1,
|
|
},
|
|
create: {
|
|
categoryId: brandCategory.id,
|
|
slug: "brand-redesign",
|
|
titleAr: "إعادة تصميم الهوية",
|
|
titleEn: "Brand Redesign",
|
|
titleDe: "Brand Redesign",
|
|
summaryAr: "إعادة بناء لهوية رقمية مع نظام مرئي أوضح ومسارات استخدام أسرع.",
|
|
summaryEn: "A digital brand refresh with a clearer visual system and faster journeys.",
|
|
summaryDe: "Ein digitales Redesign mit klarerem visuellen System und schnelleren Journeys.",
|
|
clientName: "Studio Client",
|
|
projectYear: 2025,
|
|
serviceLabelAr: "هوية بصرية",
|
|
serviceLabelEn: "Brand Identity",
|
|
serviceLabelDe: "Brand Identity",
|
|
previewUrl: "https://example.com/preview/brand-redesign",
|
|
coverImagePath: "/uploads/portfolio/demo-cover.svg",
|
|
isFeatured: true,
|
|
isPublished: true,
|
|
publishedAt: new Date("2025-01-10T09:00:00.000Z"),
|
|
sortOrder: 1,
|
|
},
|
|
});
|
|
|
|
await prisma.portfolioSection.deleteMany({
|
|
where: { projectId: project.id },
|
|
});
|
|
|
|
await prisma.portfolioAsset.deleteMany({
|
|
where: { projectId: project.id },
|
|
});
|
|
|
|
await prisma.portfolioSection.createMany({
|
|
data: [
|
|
{
|
|
projectId: project.id,
|
|
type: "RICH_TEXT",
|
|
titleAr: "التحدي",
|
|
titleEn: "Challenge",
|
|
titleDe: "Herausforderung",
|
|
bodyAr: "كان المطلوب تحديث الهوية بدون خسارة التعرف البصري الحالي.",
|
|
bodyEn: "The brief required a refreshed identity without losing recognition.",
|
|
bodyDe: "Die Marke sollte modernisiert werden, ohne die Wiedererkennbarkeit zu verlieren.",
|
|
sortOrder: 1,
|
|
},
|
|
{
|
|
projectId: project.id,
|
|
type: "RICH_TEXT",
|
|
titleAr: "الحل",
|
|
titleEn: "Solution",
|
|
titleDe: "Loesung",
|
|
bodyAr: "تم بناء نظام مرئي أوضح مع قواعد استخدام قابلة للتوسع.",
|
|
bodyEn: "A clearer visual system with scalable usage rules was created.",
|
|
bodyDe: "Es wurde ein klareres visuelles System mit skalierbaren Regeln aufgebaut.",
|
|
sortOrder: 2,
|
|
},
|
|
{
|
|
projectId: project.id,
|
|
type: "LINK",
|
|
titleAr: "المعاينة",
|
|
titleEn: "Preview",
|
|
titleDe: "Vorschau",
|
|
bodyAr: "رابط مباشر لعرض المشروع.",
|
|
bodyEn: "Direct link for reviewing the work.",
|
|
bodyDe: "Direkter Link zur Projektansicht.",
|
|
linkUrl: "https://example.com/preview/brand-redesign",
|
|
sortOrder: 3,
|
|
},
|
|
],
|
|
});
|
|
|
|
await prisma.portfolioAsset.createMany({
|
|
data: [
|
|
{
|
|
projectId: project.id,
|
|
kind: "IMAGE",
|
|
filePath: "/uploads/portfolio/demo-cover.svg",
|
|
altAr: "غلاف مشروع إعادة تصميم الهوية",
|
|
altEn: "Brand redesign cover artwork",
|
|
altDe: "Titelgrafik fuer Brand Redesign",
|
|
sortOrder: 1,
|
|
},
|
|
],
|
|
});
|
|
|
|
await prisma.portfolioProject.upsert({
|
|
where: { slug: "campaign-site" },
|
|
update: {
|
|
categoryId: webCategory.id,
|
|
titleAr: "موقع حملة",
|
|
titleEn: "Campaign Site",
|
|
titleDe: "Campaign Site",
|
|
summaryAr: "صفحة إطلاق مرنة لحملة رقمية مع تركيز على السرعة والتحويل.",
|
|
summaryEn: "A launch site built for speed, iteration, and conversion.",
|
|
summaryDe: "Eine Kampagnenseite mit Fokus auf Tempo, Iteration und Conversion.",
|
|
clientName: "Launch Client",
|
|
projectYear: 2024,
|
|
serviceLabelAr: "موقع تسويقي",
|
|
serviceLabelEn: "Marketing Website",
|
|
serviceLabelDe: "Marketing Website",
|
|
previewUrl: "https://example.com/preview/campaign-site",
|
|
coverImagePath: "/uploads/portfolio/demo-cover.svg",
|
|
isFeatured: false,
|
|
isPublished: true,
|
|
publishedAt: new Date("2024-09-05T09:00:00.000Z"),
|
|
sortOrder: 2,
|
|
},
|
|
create: {
|
|
categoryId: webCategory.id,
|
|
slug: "campaign-site",
|
|
titleAr: "موقع حملة",
|
|
titleEn: "Campaign Site",
|
|
titleDe: "Campaign Site",
|
|
summaryAr: "صفحة إطلاق مرنة لحملة رقمية مع تركيز على السرعة والتحويل.",
|
|
summaryEn: "A launch site built for speed, iteration, and conversion.",
|
|
summaryDe: "Eine Kampagnenseite mit Fokus auf Tempo, Iteration und Conversion.",
|
|
clientName: "Launch Client",
|
|
projectYear: 2024,
|
|
serviceLabelAr: "موقع تسويقي",
|
|
serviceLabelEn: "Marketing Website",
|
|
serviceLabelDe: "Marketing Website",
|
|
previewUrl: "https://example.com/preview/campaign-site",
|
|
coverImagePath: "/uploads/portfolio/demo-cover.svg",
|
|
isFeatured: false,
|
|
isPublished: true,
|
|
publishedAt: new Date("2024-09-05T09:00:00.000Z"),
|
|
sortOrder: 2,
|
|
},
|
|
});
|
|
}
|
|
|
|
main()
|
|
.catch((error) => {
|
|
console.error("Seed failed:", error);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
await pool.end();
|
|
});
|