108 lines
2.3 KiB
TypeScript
108 lines
2.3 KiB
TypeScript
import { db } from "../src/client"
|
|
|
|
async function main() {
|
|
await db.post.upsert({
|
|
where: { slug: "welcome" },
|
|
update: {},
|
|
create: {
|
|
title: "Welcome to your CMS",
|
|
slug: "welcome",
|
|
excerpt: "Your first seeded post",
|
|
body: "Edit or delete this post from your admin area.",
|
|
status: "published",
|
|
},
|
|
})
|
|
|
|
const media = await db.mediaAsset.upsert({
|
|
where: { storageKey: "seed/artwork-welcome.jpg" },
|
|
update: {},
|
|
create: {
|
|
type: "artwork",
|
|
title: "Seed Artwork Image",
|
|
altText: "Seed artwork placeholder",
|
|
tags: ["seed", "portfolio"],
|
|
storageKey: "seed/artwork-welcome.jpg",
|
|
mimeType: "image/jpeg",
|
|
isPublished: true,
|
|
},
|
|
})
|
|
|
|
const artwork = await db.artwork.upsert({
|
|
where: { slug: "seed-artwork-welcome" },
|
|
update: {},
|
|
create: {
|
|
title: "Seed Artwork",
|
|
slug: "seed-artwork-welcome",
|
|
description: "Baseline seeded artwork for MVP1 media foundation.",
|
|
medium: "Digital",
|
|
year: 2026,
|
|
availability: "available",
|
|
isPublished: true,
|
|
},
|
|
})
|
|
|
|
const gallery = await db.gallery.upsert({
|
|
where: { slug: "featured" },
|
|
update: {},
|
|
create: {
|
|
name: "Featured",
|
|
slug: "featured",
|
|
description: "Featured artwork selection.",
|
|
isVisible: true,
|
|
},
|
|
})
|
|
|
|
await db.artworkGallery.upsert({
|
|
where: {
|
|
artworkId_galleryId: {
|
|
artworkId: artwork.id,
|
|
galleryId: gallery.id,
|
|
},
|
|
},
|
|
create: {
|
|
artworkId: artwork.id,
|
|
galleryId: gallery.id,
|
|
},
|
|
update: {},
|
|
})
|
|
|
|
await db.artworkRendition.upsert({
|
|
where: {
|
|
artworkId_slot: {
|
|
artworkId: artwork.id,
|
|
slot: "thumbnail",
|
|
},
|
|
},
|
|
create: {
|
|
artworkId: artwork.id,
|
|
mediaAssetId: media.id,
|
|
slot: "thumbnail",
|
|
isPrimary: true,
|
|
},
|
|
update: {},
|
|
})
|
|
|
|
await db.systemSetting.upsert({
|
|
where: { key: "public.header_banner" },
|
|
update: {},
|
|
create: {
|
|
key: "public.header_banner",
|
|
value: JSON.stringify({
|
|
enabled: true,
|
|
message: "New portfolio release is live.",
|
|
ctaLabel: "Open latest posts",
|
|
ctaHref: "/",
|
|
}),
|
|
},
|
|
})
|
|
}
|
|
|
|
main()
|
|
.catch((error) => {
|
|
console.error(error)
|
|
process.exit(1)
|
|
})
|
|
.finally(async () => {
|
|
await db.$disconnect()
|
|
})
|