From 9e68a42c9170cb59e51fd9da57f6bd14001847f4 Mon Sep 17 00:00:00 2001 From: Citali Date: Sat, 28 Jun 2025 18:46:48 +0200 Subject: [PATCH] Init prisma --- .gitignore | 2 + package-lock.json | 41 ++++-- package.json | 1 + prisma/schema.prisma | 306 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 341 insertions(+), 9 deletions(-) create mode 100644 prisma/schema.prisma diff --git a/.gitignore b/.gitignore index 881df20..6f3a07c 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ next-env.d.ts /src/generated/ /src/generated/prisma /src/generated/prisma + +/src/generated/prisma diff --git a/package-lock.json b/package-lock.json index 5d0302f..da36767 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "app.fellies.art", "version": "0.1.0", "dependencies": { + "@prisma/client": "^6.10.1", "next": "15.3.4", "next-themes": "^0.4.6", "react": "^19.0.0", @@ -990,11 +991,33 @@ "url": "https://opencollective.com/pkgr" } }, + "node_modules/@prisma/client": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.10.1.tgz", + "integrity": "sha512-Re4pMlcUsQsUTAYMK7EJ4Bw2kg3WfZAAlr8GjORJaK4VOP6LxRQUQ1TuLnxcF42XqGkWQ36q5CQF1yVadANQ6w==", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*", + "typescript": ">=5.1.0" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, "node_modules/@prisma/config": { "version": "6.10.1", "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.10.1.tgz", "integrity": "sha512-kz4/bnqrOrzWo8KzYguN0cden4CzLJJ+2VSpKtF8utHS3l1JS0Lhv6BLwpOX6X9yNreTbZQZwewb+/BMPDCIYQ==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "dependencies": { "jiti": "2.4.2" @@ -1004,14 +1027,14 @@ "version": "6.10.1", "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.10.1.tgz", "integrity": "sha512-k2YT53cWxv9OLjW4zSYTZ6Z7j0gPfCzcr2Mj99qsuvlxr8WAKSZ2NcSR0zLf/mP4oxnYG842IMj3utTgcd7CaA==", - "dev": true, + "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines": { "version": "6.10.1", "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.10.1.tgz", "integrity": "sha512-Q07P5rS2iPwk2IQr/rUQJ42tHjpPyFcbiH7PXZlV81Ryr9NYIgdxcUrwgVOWVm5T7ap02C0dNd1dpnNcSWig8A==", - "dev": true, + "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -1025,14 +1048,14 @@ "version": "6.10.1-1.9b628578b3b7cae625e8c927178f15a170e74a9c", "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.10.1-1.9b628578b3b7cae625e8c927178f15a170e74a9c.tgz", "integrity": "sha512-ZJFTsEqapiTYVzXya6TUKYDFnSWCNegfUiG5ik9fleQva5Sk3DNyyUi7X1+0ZxWFHwHDr6BZV5Vm+iwP+LlciA==", - "dev": true, + "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { "version": "6.10.1", "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.10.1.tgz", "integrity": "sha512-clmbG/Jgmrc/n6Y77QcBmAUlq9LrwI9Dbgy4pq5jeEARBpRCWJDJ7PWW1P8p0LfFU0i5fsyO7FqRzRB8mkdS4g==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "dependencies": { "@prisma/debug": "6.10.1", @@ -1044,7 +1067,7 @@ "version": "6.10.1", "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.10.1.tgz", "integrity": "sha512-4CY5ndKylcsce9Mv+VWp5obbR2/86SHOLVV053pwIkhVtT9C9A83yqiqI/5kJM9T1v1u1qco/bYjDKycmei9HA==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "dependencies": { "@prisma/debug": "6.10.1" @@ -4251,7 +4274,7 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", - "dev": true, + "devOptional": true, "license": "MIT", "bin": { "jiti": "lib/jiti-cli.mjs" @@ -5225,7 +5248,7 @@ "version": "6.10.1", "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.10.1.tgz", "integrity": "sha512-khhlC/G49E4+uyA3T3H5PRBut486HD2bDqE2+rvkU0pwk9IAqGFacLFUyIx9Uw+W2eCtf6XGwsp+/strUwMNPw==", - "dev": true, + "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -6191,7 +6214,7 @@ "version": "5.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", - "dev": true, + "devOptional": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 5e94a7a..49b10ed 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@prisma/client": "^6.10.1", "next": "15.3.4", "next-themes": "^0.4.6", "react": "^19.0.0", diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 0000000..25c66d6 --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,306 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? +// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init + +generator client { + provider = "prisma-client-js" + output = "../src/generated/prisma" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model Gallery { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + slug String @unique + name String + + description String? + + coverImageId String? + coverImage Image? @relation("GalleryCoverImage", fields: [coverImageId], references: [id]) + + albums Album[] +} + +model Album { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + slug String + name String + + description String? + + coverImageId String? + galleryId String? + coverImage Image? @relation("AlbumCoverImage", fields: [coverImageId], references: [id]) + gallery Gallery? @relation(fields: [galleryId], references: [id]) + + images Image[] + + @@unique([galleryId, slug]) +} + +model Artist { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + slug String @unique + displayName String + + nickname String? + + socials Social[] + images Image[] +} + +model Social { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + handle String + platform String + isPrimary Boolean + + link String? + + artistId String? + artist Artist? @relation(fields: [artistId], references: [id]) +} + +model Category { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + name String @unique + + description String? + + images Image[] @relation("ImageCategories") +} + +model Tag { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + name String @unique + + description String? + + images Image[] @relation("ImageTags") +} + +model Image { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + fileKey String + imageName String + originalFile String + uploadDate DateTime @default(now()) + nsfw Boolean @default(false) + + altText String? + description String? + fileType String? + imageData String? + source String? + creationMonth Int? + creationYear Int? + fileSize Int? + creationDate DateTime? + + albumId String? + artistId String? + album Album? @relation(fields: [albumId], references: [id]) + artist Artist? @relation(fields: [artistId], references: [id]) + + metadata ImageMetadata? + stats ImageStats? + + colors ImageColor[] + extractColors ImageExtractColor[] + palettes ImagePalette[] + variants ImageVariant[] + + albumCover Album[] @relation("AlbumCoverImage") + galleryCover Gallery[] @relation("GalleryCoverImage") + categories Category[] @relation("ImageCategories") + tags Tag[] @relation("ImageTags") +} + +model ImageMetadata { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + imageId String @unique + depth String + format String + space String + channels Int + height Int + width Int + + autoOrientH Int? + autoOrientW Int? + bitsPerSample Int? + density Int? + hasAlpha Boolean? + hasProfile Boolean? + isPalette Boolean? + isProgressive Boolean? + + image Image @relation(fields: [imageId], references: [id]) +} + +model ImageStats { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + imageId String @unique + entropy Float + sharpness Float + dominantB Int + dominantG Int + dominantR Int + isOpaque Boolean + + image Image @relation(fields: [imageId], references: [id]) +} + +model ImageVariant { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + imageId String + s3Key String + type String + height Int + width Int + + fileExtension String? + mimeType String? + url String? + sizeBytes Int? + + image Image @relation(fields: [imageId], references: [id]) +} + +model ColorPalette { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + name String + + items ColorPaletteItem[] + images ImagePalette[] +} + +model ColorPaletteItem { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + tone Int? + hex String? + + colorPaletteId String? + colorPalette ColorPalette? @relation(fields: [colorPaletteId], references: [id]) +} + +model ExtractColor { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + name String @unique + hex String + blue Int + green Int + red Int + + area Float? + hue Float? + saturation Float? + + images ImageExtractColor[] +} + +model Color { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + name String @unique + type String + + hex String? + blue Int? + green Int? + red Int? + + images ImageColor[] +} + +model ImagePalette { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + imageId String + paletteId String + type String + + image Image @relation(fields: [imageId], references: [id]) + palette ColorPalette @relation(fields: [paletteId], references: [id]) + + @@unique([imageId, type]) +} + +model ImageExtractColor { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + imageId String + extractId String + type String + + image Image @relation(fields: [imageId], references: [id]) + extract ExtractColor @relation(fields: [extractId], references: [id]) + + @@unique([imageId, type]) +} + +model ImageColor { + id String @id @default(cuid()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + imageId String + colorId String + type String + + image Image @relation(fields: [imageId], references: [id]) + color Color @relation(fields: [colorId], references: [id]) + + @@unique([imageId, type]) +}