Cleanup relation schema

This commit is contained in:
Jorge Vargas 2025-02-25 22:14:16 -06:00
parent 781a9ae216
commit a8d253fa2e
10 changed files with 404 additions and 291 deletions

View file

@ -14,7 +14,7 @@
"@astrojs/react": "4.1.3",
"@astrojs/rss": "4.0.11",
"@inlang/paraglide-astro": "^0.2.2",
"@prisma/client": "^6.4.0",
"@prisma/client": "^6.4.1",
"@tailwindcss/vite": "^4.0.7",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
@ -23,6 +23,7 @@
"better-auth": "^1.1.11",
"clsx": "^2.1.1",
"nodemailer": "^6.10.0",
"prisma": "^6.4.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
@ -42,7 +43,6 @@
"eslint-plugin-jsx-a11y": "^6.10.0",
"neostandard": "^0.11.6",
"prettier": "^3.3.3",
"prettier-config-standard": "^7.0.0",
"prisma": "^6.4.0"
"prettier-config-standard": "^7.0.0"
}
}

View file

@ -0,0 +1,183 @@
/*
- Made the column `albumId` on table `discs` required. This step will fail if there are existing NULL values in that column.
- Made the column `albumId` on table `downloads` required. This step will fail if there are existing NULL values in that column.
- Made the column `albumId` on table `favorites` required. This step will fail if there are existing NULL values in that column.
- Made the column `albumId` on table `linkCategories` required. This step will fail if there are existing NULL values in that column.
- Made the column `downloadId` on table `links` required. This step will fail if there are existing NULL values in that column.
- Made the column `score` on table `ratings` required. This step will fail if there are existing NULL values in that column.
- Made the column `albumId` on table `ratings` required. This step will fail if there are existing NULL values in that column.
- Made the column `username` on table `ratings` required. This step will fail if there are existing NULL values in that column.
*/
SET FOREIGN_KEY_CHECKS = 0;
-- DropForeignKey
ALTER TABLE `animation` DROP FOREIGN KEY `animation_ibfk_1`;
-- DropForeignKey
ALTER TABLE `discs` DROP FOREIGN KEY `discs_ibfk_1`;
-- DropForeignKey
ALTER TABLE `downloads` DROP FOREIGN KEY `downloads_ibfk_1`;
-- DropForeignKey
ALTER TABLE `favorites` DROP FOREIGN KEY `favorites_ibfk_1`;
-- DropForeignKey
ALTER TABLE `linkCategories` DROP FOREIGN KEY `linkCategories_ibfk_1`;
-- DropForeignKey
ALTER TABLE `links` DROP FOREIGN KEY `links_ibfk_1`;
-- DropForeignKey
ALTER TABLE `logs` DROP FOREIGN KEY `logs_ibfk_1`;
-- DropForeignKey
ALTER TABLE `ratings` DROP FOREIGN KEY `ratings_ibfk_1`;
-- DropForeignKey
ALTER TABLE `ratings` DROP FOREIGN KEY `ratings_ibfk_2`;
-- DropIndex
DROP INDEX `studioSlug` ON `animation`;
-- DropIndex
DROP INDEX `ostId` ON `discs`;
-- DropIndex
DROP INDEX `ostId` ON `downloads`;
-- DropIndex
DROP INDEX `ostId` ON `favorites`;
-- DropIndex
DROP INDEX `ostId` ON `linkCategories`;
-- DropIndex
DROP INDEX `downloadId` ON `links`;
-- DropIndex
DROP INDEX `username` ON `logs`;
-- DropIndex
DROP INDEX `ostId` ON `ratings`;
-- DropIndex
DROP INDEX `username` ON `ratings`;
-- AlterTable
ALTER TABLE `Album_Animation` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Album_Artist` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Album_Category` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Album_Classification` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Album_Game` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Album_Platform` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Album_Type` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Game_Platform` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Publisher_Game` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Series_Game` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `Studio_Animation` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `User_Role` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
DELETE FROM `discs` WHERE `albumId` IS NULL;
ALTER TABLE `discs` MODIFY `albumId` INTEGER NOT NULL;
-- AlterTable
DELETE FROM `downloads` WHERE `albumId` IS NULL;
ALTER TABLE `downloads` MODIFY `albumId` INTEGER NOT NULL;
-- AlterTable
DELETE FROM `favorites` WHERE `albumId` IS NULL;
ALTER TABLE `favorites` MODIFY `albumId` INTEGER NOT NULL;
-- AlterTable
DELETE FROM `linkCategories` WHERE `albumId` IS NULL;
ALTER TABLE `linkCategories` MODIFY `albumId` INTEGER NOT NULL;
-- AlterTable
DELETE FROM `links` WHERE `downloadId` IS NULL;
ALTER TABLE `links` MODIFY `downloadId` INTEGER NOT NULL;
-- AlterTable
DELETE FROM `ratings`
WHERE `score` IS NULL
OR `albumId` IS NULL
OR `username` IS NULL;
ALTER TABLE `ratings`
MODIFY `score` INTEGER NOT NULL,
MODIFY `albumId` INTEGER NOT NULL,
MODIFY `username` VARCHAR(255) NOT NULL;
-- AlterTable
ALTER TABLE `related_album` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;
-- AlterTable
ALTER TABLE `type`
DROP COLUMN `updatedAt`,
DROP COLUMN `createdAt`,
MODIFY `name` VARCHAR(255) NOT NULL;
-- DropTable
DROP TABLE `SequelizeMeta`;
-- AddForeignKey
ALTER TABLE `discs` ADD CONSTRAINT `discs_ibfk_1` FOREIGN KEY (`albumId`) REFERENCES `albums`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `downloads` ADD CONSTRAINT `downloads_ibfk_1` FOREIGN KEY (`albumId`) REFERENCES `albums`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `favorites` ADD CONSTRAINT `favorites_ibfk_1` FOREIGN KEY (`albumId`) REFERENCES `albums`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `linkCategories` ADD CONSTRAINT `linkCategories_ibfk_1` FOREIGN KEY (`albumId`) REFERENCES `albums`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `links` ADD CONSTRAINT `links_ibfk_1` FOREIGN KEY (`downloadId`) REFERENCES `downloads`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `logs` ADD CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`username`) REFERENCES `users`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `ratings` ADD CONSTRAINT `ratings_ibfk_1` FOREIGN KEY (`albumId`) REFERENCES `albums`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `ratings` ADD CONSTRAINT `ratings_ibfk_2` FOREIGN KEY (`username`) REFERENCES `users`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
SET FOREIGN_KEY_CHECKS = 1;

View file

@ -0,0 +1,12 @@
SET FOREIGN_KEY_CHECKS = 0;
-- DropForeignKey
ALTER TABLE `logs` DROP FOREIGN KEY `logs_ibfk_1`;
-- DropIndex
DROP INDEX `logs_ibfk_1` ON `logs`;
-- AddForeignKey
ALTER TABLE `logs` ADD CONSTRAINT `logs_ibfk_1` FOREIGN KEY (`username`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
SET FOREIGN_KEY_CHECKS = 1;

View file

@ -9,151 +9,111 @@ datasource db {
}
model Album_Animation {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int
animationId Int
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Animation_ibfk_1")
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Animation_ibfk_1")
animation animation @relation(fields: [animationId], references: [id], onDelete: Cascade, map: "Album_Animation_ibfk_2")
@@id([albumId, animationId])
@@index([animationId], map: "animationId")
}
model Album_Artist {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int
artistSlug String @db.VarChar(255)
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Artist_ibfk_1")
artist artist @relation(fields: [artistSlug], references: [slug], onDelete: Cascade, map: "Album_Artist_ibfk_2")
artistSlug String @db.VarChar(255)
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Artist_ibfk_1")
artist artist @relation(fields: [artistSlug], references: [slug], onDelete: Cascade, map: "Album_Artist_ibfk_2")
@@id([albumId, artistSlug])
@@index([artistSlug], map: "artistSlug")
}
model Album_Category {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
categoryName String @db.VarChar(255)
albumId Int
category category @relation(fields: [categoryName], references: [name], onDelete: Cascade, map: "Album_Category_ibfk_1")
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Category_ibfk_2")
@@id([categoryName, albumId])
@@index([albumId], map: "ostId")
}
model Album_Classification {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int
classificationName String @db.VarChar(255)
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Classification_ibfk_1")
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Classification_ibfk_1")
classification classification @relation(fields: [classificationName], references: [name], onDelete: Cascade, map: "Album_Classification_ibfk_2")
@@id([albumId, classificationName])
@@index([classificationName], map: "categoryName")
}
model Album_Game {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
gameSlug String @db.VarChar(255)
albumId Int
game game @relation(fields: [gameSlug], references: [slug], onDelete: Cascade, map: "Album_Game_ibfk_1")
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Game_ibfk_2")
gameSlug String @db.VarChar(255)
albumId Int
game game @relation(fields: [gameSlug], references: [slug], onDelete: Cascade, map: "Album_Game_ibfk_1")
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Game_ibfk_2")
@@id([gameSlug, albumId])
@@index([albumId], map: "ostId")
}
model Album_Platform {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int
platformId Int
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Platform_ibfk_1")
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Platform_ibfk_1")
platform platform @relation(fields: [platformId], references: [id], onDelete: Cascade, map: "Album_Platform_ibfk_2")
@@id([albumId, platformId])
@@index([platformId], map: "platformId")
}
model Album_Type {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int
typeId Int
albums albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Type_ibfk_1")
type type @relation(fields: [typeId], references: [id], onDelete: Cascade, map: "Album_Type_ibfk_2")
albumId Int
typeId Int
album albums @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "Album_Type_ibfk_1")
type type @relation(fields: [typeId], references: [id], onDelete: Cascade, map: "Album_Type_ibfk_2")
@@id([albumId, typeId])
@@index([typeId], map: "typeId")
}
model Game_Platform {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
gameSlug String @db.VarChar(255)
platformId Int
game game @relation(fields: [gameSlug], references: [slug], onDelete: Cascade, map: "Game_Platform_ibfk_1")
platform platform @relation(fields: [platformId], references: [id], onDelete: Cascade, map: "Game_Platform_ibfk_2")
@@id([gameSlug, platformId])
@@index([platformId], map: "platformId")
}
model Publisher_Game {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
gameSlug String @db.VarChar(255)
publisherId Int
game game @relation(fields: [gameSlug], references: [slug], onDelete: Cascade, map: "Publisher_Game_ibfk_1")
publisher publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade, map: "Publisher_Game_ibfk_2")
@@id([gameSlug, publisherId])
@@index([publisherId], map: "publisherId")
}
model SequelizeMeta {
name String @id @unique(map: "name") @db.VarChar(255)
}
model Series_Game {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
gameSlug String @db.VarChar(255)
seriesSlug String @db.VarChar(255)
game game @relation(fields: [gameSlug], references: [slug], onDelete: Cascade, map: "Series_Game_ibfk_1")
series series @relation(fields: [seriesSlug], references: [slug], onDelete: Cascade, map: "Series_Game_ibfk_2")
gameSlug String @db.VarChar(255)
seriesSlug String @db.VarChar(255)
game game @relation(fields: [gameSlug], references: [slug], onDelete: Cascade, map: "Series_Game_ibfk_1")
series series @relation(fields: [seriesSlug], references: [slug], onDelete: Cascade, map: "Series_Game_ibfk_2")
@@id([gameSlug, seriesSlug])
@@index([seriesSlug], map: "seriesSlug")
}
model Studio_Animation {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
animationId Int
studioSlug String @db.VarChar(255)
animation animation @relation(fields: [animationId], references: [id], onDelete: Cascade, map: "Studio_Animation_ibfk_1")
studio studio @relation(fields: [studioSlug], references: [slug], onDelete: Cascade, map: "Studio_Animation_ibfk_2")
@@id([animationId, studioSlug])
@@index([studioSlug], map: "studioSlug")
}
model User_Role {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
userUsername String @db.VarChar(255)
roleName String @db.VarChar(255)
users users @relation(fields: [userUsername], references: [id], onDelete: Cascade, map: "User_Role_ibfk_1")
roles roles @relation(fields: [roleName], references: [name], onDelete: Cascade, map: "User_Role_ibfk_2")
userUsername String @db.VarChar(255)
roleName String @db.VarChar(255)
users users @relation(fields: [userUsername], references: [id], onDelete: Cascade, map: "User_Role_ibfk_1")
roles roles @relation(fields: [roleName], references: [name], onDelete: Cascade, map: "User_Role_ibfk_2")
@@id([userUsername, roleName])
@@index([roleName], map: "roleName")
}
model albumHistories {
@ -163,70 +123,64 @@ model albumHistories {
updatedAt DateTime @db.DateTime(0)
username String? @db.VarChar(255)
albumId Int?
users users? @relation(fields: [username], references: [id], map: "albumHistories_ibfk_1")
albums albums? @relation(fields: [albumId], references: [id], map: "albumHistories_ibfk_2")
@@index([albumId], map: "ostId")
@@index([username], map: "username")
user users? @relation(fields: [username], references: [id], map: "albumHistories_ibfk_1")
album albums? @relation(fields: [albumId], references: [id], map: "albumHistories_ibfk_2")
}
model albums {
id Int @id @default(autoincrement())
title String? @db.VarChar(255)
subTitle String? @db.Text
releaseDate DateTime? @db.Date
label String? @db.VarChar(255)
vgmdb String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
description String? @db.VarChar(255)
createdBy String? @db.VarChar(255)
status String? @db.VarChar(255)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
animList Album_Animation[]
artistList Album_Artist[]
categoryList Album_Category[]
classificationList Album_Classification[]
gameList Album_Game[]
platformList Album_Platform[]
Album_Type Album_Type[]
albumHistories albumHistories[]
availables availables[]
comments comments[]
discs discs[]
downloads downloads[]
favorites favorites[]
linkCategories linkCategories[]
ratings ratings[]
relatedAlbumList related_album[] @relation("related_album_albumIdToalbums")
relatedToAlbumList related_album[] @relation("related_album_relatedIdToalbums")
stores stores[]
id Int @id @default(autoincrement())
title String? @db.VarChar(255)
subTitle String? @db.Text
releaseDate DateTime? @db.Date
label String? @db.VarChar(255)
vgmdb String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
description String? @db.VarChar(255)
createdBy String? @db.VarChar(255)
status String? @db.VarChar(255)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
animations Album_Animation[]
artists Album_Artist[]
categories Album_Category[]
classifications Album_Classification[]
games Album_Game[]
platforms Album_Platform[]
types Album_Type[]
histories albumHistories[]
availables availables[]
comments comments[]
discs discs[]
downloads downloads[]
favorites favorites[]
linkCategories linkCategories[]
ratings ratings[]
relatedAlbums related_album[] @relation("related_album_albumIdToalbums")
relatedTo related_album[] @relation("related_album_relatedIdToalbums")
stores stores[]
}
model animation {
id Int @id @default(autoincrement())
title String? @unique(map: "title") @db.VarChar(255)
releaseDate DateTime? @db.Date
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
studioSlug String? @db.VarChar(255)
subTitle String? @unique(map: "subTitle") @db.VarChar(255)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
Album_Animation Album_Animation[]
Studio_Animation Studio_Animation[]
studio studio? @relation(fields: [studioSlug], references: [slug], map: "animation_ibfk_1")
@@index([studioSlug], map: "studioSlug")
id Int @id @default(autoincrement())
title String? @unique(map: "title") @db.VarChar(255)
releaseDate DateTime? @db.Date
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
studioSlug String? @db.VarChar(255)
subTitle String? @unique(map: "subTitle") @db.VarChar(255)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
albums Album_Animation[]
studios Studio_Animation[]
}
model artist {
slug String @id @db.VarChar(255)
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
Album_Artist Album_Artist[]
slug String @id @db.VarChar(255)
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albums Album_Artist[]
}
model availables {
@ -236,23 +190,21 @@ model availables {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
albums albums? @relation(fields: [albumId], references: [id], map: "availables_ibfk_1")
@@index([albumId], map: "ostId")
album albums? @relation(fields: [albumId], references: [id], map: "availables_ibfk_1")
}
model category {
name String @id @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
Album_Category Album_Category[]
name String @id @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albums Album_Category[]
}
model classification {
name String @id @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
Album_Classification Album_Classification[]
name String @id @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
classifications Album_Classification[]
}
model comments {
@ -263,11 +215,8 @@ model comments {
updatedAt DateTime @db.DateTime(0)
albumId Int?
username String? @db.VarChar(255)
albums albums? @relation(fields: [albumId], references: [id], map: "comments_ibfk_1")
users users? @relation(fields: [username], references: [id], map: "comments_ibfk_2")
@@index([albumId], map: "ostId")
@@index([username], map: "username")
album albums? @relation(fields: [albumId], references: [id], map: "comments_ibfk_1")
user users? @relation(fields: [username], references: [id], map: "comments_ibfk_2")
}
model config {
@ -283,10 +232,8 @@ model discs {
body String? @db.Text
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
albums albums? @relation(fields: [albumId], references: [id], map: "discs_ibfk_1")
@@index([albumId], map: "ostId")
albumId Int
album albums? @relation(fields: [albumId], references: [id], map: "discs_ibfk_1")
}
model downloads {
@ -295,24 +242,19 @@ model downloads {
small Boolean?
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
albums albums? @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "downloads_ibfk_1")
albumId Int
album albums? @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "downloads_ibfk_1")
links links[]
@@index([albumId], map: "ostId")
}
model favorites {
id Int @id @default(autoincrement())
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
albumId Int
username String? @db.VarChar(255)
albums albums? @relation(fields: [albumId], references: [id], map: "favorites_ibfk_1")
album albums? @relation(fields: [albumId], references: [id], map: "favorites_ibfk_1")
users users? @relation(fields: [username], references: [id], map: "favorites_ibfk_2")
@@index([albumId], map: "ostId")
@@index([username], map: "username")
}
model forgors {
@ -322,23 +264,21 @@ model forgors {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
username String? @db.VarChar(255)
users users? @relation(fields: [username], references: [id], map: "forgors_ibfk_1")
@@index([username], map: "username")
user users? @relation(fields: [username], references: [id], map: "forgors_ibfk_1")
}
model game {
slug String @id @db.VarChar(255)
name String? @db.VarChar(255)
releaseDate DateTime? @db.Date
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
Album_Game Album_Game[]
Game_Platform Game_Platform[]
Publisher_Game Publisher_Game[]
Series_Game Series_Game[]
slug String @id @db.VarChar(255)
name String? @db.VarChar(255)
releaseDate DateTime? @db.Date
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
albums Album_Game[]
platforms Game_Platform[]
publishers Publisher_Game[]
series Series_Game[]
}
model linkCategories {
@ -347,10 +287,8 @@ model linkCategories {
small Boolean?
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
albums albums? @relation(fields: [albumId], references: [id], map: "linkCategories_ibfk_1")
@@index([albumId], map: "ostId")
albumId Int
album albums? @relation(fields: [albumId], references: [id], map: "linkCategories_ibfk_1")
}
model links {
@ -361,11 +299,9 @@ model links {
custom String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
downloadId Int?
downloadId Int
url2 String? @db.VarChar(255)
downloads downloads? @relation(fields: [downloadId], references: [id], map: "links_ibfk_1")
@@index([downloadId], map: "downloadId")
download downloads? @relation(fields: [downloadId], references: [id], map: "links_ibfk_1")
}
model logs {
@ -375,9 +311,7 @@ model logs {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
username String? @db.VarChar(255)
users users? @relation(fields: [username], references: [id], map: "logs_ibfk_1")
@@index([username], map: "username")
user users? @relation(fields: [username], references: [id], map: "logs_ibfk_1")
}
model pendings {
@ -387,47 +321,41 @@ model pendings {
}
model platform {
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
type String? @default("Game") @db.VarChar(255)
Album_Platform Album_Platform[]
Game_Platform Game_Platform[]
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
type String? @default("Game") @db.VarChar(255)
albums Album_Platform[]
games Game_Platform[]
}
model publisher {
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
Publisher_Game Publisher_Game[]
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
games Publisher_Game[]
}
model ratings {
id Int @id @default(autoincrement())
score Int?
score Int
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
username String? @db.VarChar(255)
albums albums? @relation(fields: [albumId], references: [id], map: "ratings_ibfk_1")
users users? @relation(fields: [username], references: [id], map: "ratings_ibfk_2")
@@index([albumId], map: "ostId")
@@index([username], map: "username")
albumId Int
username String @db.VarChar(255)
album albums? @relation(fields: [albumId], references: [id], map: "ratings_ibfk_1")
user users? @relation(fields: [username], references: [id], map: "ratings_ibfk_2")
}
model related_album {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int
relatedId Int
pageAlbum albums @relation("related_album_albumIdToalbums", fields: [albumId], references: [id], onDelete: Cascade, map: "related_album_ibfk_1")
relatedAlbum albums @relation("related_album_relatedIdToalbums", fields: [relatedId], references: [id], onDelete: Cascade, map: "related_album_ibfk_2")
pageAlbum albums @relation("related_album_albumIdToalbums", fields: [albumId], references: [id], onDelete: Cascade, map: "related_album_ibfk_1")
relatedAlbum albums @relation("related_album_relatedIdToalbums", fields: [relatedId], references: [id], onDelete: Cascade, map: "related_album_ibfk_2")
@@id([albumId, relatedId])
@@index([relatedId], map: "relatedId")
}
model requests {
@ -451,7 +379,7 @@ model roles {
permissions Json?
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
User_Role User_Role[]
users User_Role[]
}
model series {
@ -461,7 +389,7 @@ model series {
updatedAt DateTime @db.DateTime(0)
placeholder String? @db.Text
headerColor String? @default("#ffffff") @db.VarChar(255)
Series_Game Series_Game[]
games Series_Game[]
}
model stores {
@ -471,18 +399,15 @@ model stores {
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
albumId Int?
albums albums? @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "stores_ibfk_1")
@@index([albumId], map: "ostId")
album albums? @relation(fields: [albumId], references: [id], onDelete: Cascade, map: "stores_ibfk_1")
}
model studio {
slug String @id @db.VarChar(255)
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
Studio_Animation Studio_Animation[]
animation animation[]
slug String @id @db.VarChar(255)
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
animations Studio_Animation[]
}
model submissions {
@ -496,19 +421,14 @@ model submissions {
updatedAt DateTime @db.DateTime(0)
userUsername String? @db.VarChar(255)
requestId Int?
users users? @relation(fields: [userUsername], references: [id], map: "submissions_ibfk_1")
requests requests? @relation(fields: [requestId], references: [id], map: "submissions_ibfk_2")
@@index([requestId], map: "requestId")
@@index([userUsername], map: "userUsername")
user users? @relation(fields: [userUsername], references: [id], map: "submissions_ibfk_1")
request requests? @relation(fields: [requestId], references: [id], map: "submissions_ibfk_2")
}
model type {
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
Album_Type Album_Type[]
id Int @id @default(autoincrement())
name String @db.VarChar(255)
albums Album_Type[]
}
model users {
@ -521,16 +441,16 @@ model users {
updatedAt DateTime @db.DateTime(0)
image String? @db.VarChar(255)
roleList User_Role[]
albumHistories albumHistories[]
comments comments[]
favorites favorites[]
forgors forgors[]
logs logs[]
ratings ratings[]
submissions submissions[]
sessions session[]
accounts account[]
roles User_Role[]
histories albumHistories[]
comments comments[]
favorites favorites[]
forgors forgors[]
logs logs[]
ratings ratings[]
submissions submissions[]
sessions session[]
accounts account[]
}
model session {

View file

@ -6,7 +6,7 @@ import SidebarSection from './SidebarSection.astro'
import Looper from './CommentCarousel/Looper'
const comments = await prismaClient.comments.findMany({
select: { text: true, albums: { select: { id: true, title: true } } },
select: { text: true, album: { select: { id: true, title: true } } },
orderBy: { createdAt: 'desc' },
take: 5
})

View file

@ -4,7 +4,7 @@ import { useEffect, useRef, useState, type ButtonHTMLAttributes, type ReactNode
interface Props {
comments: {
text: string | null
albums: {
album: {
id: number
title: string | null
} | null
@ -37,7 +37,7 @@ export default function Looper(props: Props) {
<div className='text-md/6 font-extralight'>
<div>{comment.text}</div>
<div className='mt-1'>
- <a href={`/album/${comment.albums?.id}`}>{comment.albums?.title}</a>
- <a href={`/album/${comment.album?.id}`}>{comment.album?.title}</a>
</div>
{isMultiple ? (
<div className='flex mt-2.5'>

View file

@ -14,10 +14,10 @@ export const onRequest = defineMiddleware(async (context, next) => {
context.locals.session = isAuthed.session
const user = await prismaClient.users.findUnique({
select: { roleList: { select: { roles: { select: { permissions: true } } } } },
select: { roles: { select: { roles: { select: { permissions: true } } } } },
where: { id: isAuthed.user.id }
})
const permissions = (user?.roleList.map((r) => r.roles.permissions).flat() as string[]) ?? []
const permissions = (user?.roles.map((r) => r.roles.permissions).flat() as string[]) ?? []
const pages = PAGES.filter((p) => p.perms.some((r) => permissions.includes(r))).map((p) => p.url)
context.locals.permissions = permissions

View file

@ -21,12 +21,12 @@ const hasDirect = permissions.includes('SKIP_ADS')
const album = await prismaClient.albums.findUnique({
where: { id: Number(id) },
include: {
artistList: { select: { artist: true } },
categoryList: { select: { categoryName: true } },
classificationList: { select: { classificationName: true } },
platformList: { select: { platform: { select: { id: true, name: true } } } },
gameList: { select: { game: { select: { slug: true, name: true } } } },
animList: { select: { animation: { select: { id: true, title: true } } } },
artists: { select: { artist: true } },
categories: { select: { categoryName: true } },
classifications: { select: { classificationName: true } },
platforms: { select: { platform: { select: { id: true, name: true } } } },
games: { select: { game: { select: { slug: true, name: true } } } },
animations: { select: { animation: { select: { id: true, title: true } } } },
stores: { select: { url: true, provider: true }, where: { NOT: { provider: 'SOON' } } },
discs: { select: { number: true, body: true } },
downloads: {
@ -35,7 +35,7 @@ const album = await prismaClient.albums.findUnique({
links: { select: { id: true, url: true, url2: true, provider: true, directUrl: hasDirect } }
}
},
relatedAlbumList: { select: { relatedAlbum: { select: { id: true, title: true } } } }
relatedAlbums: { select: { relatedAlbum: { select: { id: true, title: true } } } }
}
})
@ -96,10 +96,10 @@ const { currentLocale } = Astro
}
{
(album?.artistList.length ?? 0) > 0 && (
(album?.artists.length ?? 0) > 0 && (
<tr>
<th>{m.artists()}</th>
<td>{album?.artistList.map(({ artist }) => artist.name).join(', ')}</td>
<td>{album?.artists.map(({ artist }) => artist.name).join(', ')}</td>
</tr>
)
}
@ -109,10 +109,8 @@ const { currentLocale } = Astro
<td>
{
[
album?.categoryList
.map(({ categoryName }) => (m as any)[`${categoryName}Osts`]())
.join(' & '),
album?.classificationList.map(({ classificationName }) => classificationName).join(', ')
album?.categories.map(({ categoryName }) => (m as any)[`${categoryName}Osts`]()).join(' & '),
album?.classifications.map(({ classificationName }) => classificationName).join(', ')
]
.filter((f) => f !== '')
.join(' - ')
@ -132,11 +130,11 @@ const { currentLocale } = Astro
)
}
{
(album?.platformList.length ?? 0) > 0 && (
(album?.platforms.length ?? 0) > 0 && (
<tr>
<th>{m.platforms()}</th>
<td>
{album?.platformList.map(({ platform }, i) => (
{album?.platforms.map(({ platform }, i) => (
<Fragment key={platform.id}>
{id === '29' ? (
<span class='btn p-0' style={{ color: 'white' }}>
@ -147,7 +145,7 @@ const { currentLocale } = Astro
{platform.name}
</a>
)}
{i !== album?.platformList.length - 1 && ', '}
{i !== album?.platforms.length - 1 && ', '}
</Fragment>
))}
</td>
@ -155,16 +153,16 @@ const { currentLocale } = Astro
)
}
{
(album?.gameList.length ?? 0) > 0 && (
(album?.games.length ?? 0) > 0 && (
<tr>
<th>{m.games()}</th>
<td>
{album?.gameList.map(({ game }, i) => (
{album?.games.map(({ game }, i) => (
<Fragment key={game.slug}>
<a class='btn btn-link p-0' href={`/game/${game.slug}`}>
{game.name}
</a>
{i !== album?.gameList.length - 1 && ', '}
{i !== album?.games.length - 1 && ', '}
</Fragment>
))}
</td>
@ -172,16 +170,16 @@ const { currentLocale } = Astro
)
}
{
(album?.animList.length ?? 0) > 0 && (
(album?.animations.length ?? 0) > 0 && (
<tr>
<th>{m.animations()}</th>
<td>
{album?.animList.map(({ animation }, i) => (
{album?.animations.map(({ animation }, i) => (
<Fragment key={id}>
<a class='btn btn-link p-0' href={`/anim/${id}`}>
{animation.title}
</a>
{i !== album?.animList.length - 1 && ', '}
{i !== album?.animations.length - 1 && ', '}
</Fragment>
))}
</td>
@ -343,7 +341,7 @@ const { currentLocale } = Astro
<div class='mt-2'>
<div class='grid grid-cols-4 gap-x-1.5 justify-items-center'>
{
album?.relatedAlbumList.map(({ relatedAlbum }) => (
album?.relatedAlbums.map(({ relatedAlbum }) => (
<AlbumBox
title={relatedAlbum?.title}
href={`/album/${relatedAlbum?.id}`}

View file

@ -5,7 +5,7 @@ import prismaClient from 'utils/prisma-client'
export async function GET(context: APIContext) {
const albums = await prismaClient.albums.findMany({
where: { status: 'show' },
include: { artistList: { include: { artist: { select: { name: true } } } } },
include: { artists: { include: { artist: { select: { name: true } } } } },
take: 15,
orderBy: { createdAt: 'desc' }
})
@ -14,7 +14,7 @@ export async function GET(context: APIContext) {
guid: `album/${album.id}`,
title: album.title || 'Error: Missing title',
pubDate: new Date(album.createdAt || ''),
description: album.subTitle || album.artistList.map((a) => a.artist.name).join(' - '),
description: album.subTitle || album.artists.map((a) => a.artist.name).join(' - '),
link: `https://www.sittingonclouds.net/album/${album.id}`,
customData: `<media:content
type="image/png"

View file

@ -1407,46 +1407,46 @@
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31"
integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==
"@prisma/client@^6.4.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-6.4.0.tgz#341f56b747ea7b70e4f1d2d362f0e7cdc2b1bdb4"
integrity sha512-48tLb+VL7iuuqJXjD4Xbqa622fuh8UtqmjTf39AKrQjlTUdNaMc9sC/c49eXQkcnrAdh9FoS1qVupmZSYiZ9TQ==
"@prisma/client@^6.4.1":
version "6.4.1"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-6.4.1.tgz#2666796c862e71eb2a6f39e30b192236893e07d3"
integrity sha512-A7Mwx44+GVZVexT5e2GF/WcKkEkNNKbgr059xpr5mn+oUm2ZW1svhe+0TRNBwCdzhfIZ+q23jEgsNPvKD9u+6g==
"@prisma/debug@6.4.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-6.4.0.tgz#1cc112f28a11fad609fdb50235b0e4d4369e4694"
integrity sha512-zXsLpNXLypdThJjItqk0u/3uitcD9+9rNynZPPu4Xp7664yp8VbxCGTVBS696vA0e3kw0Xv/4muR+cNHkxspcw==
"@prisma/debug@6.4.1":
version "6.4.1"
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-6.4.1.tgz#b3b4982e107a456f848ced3386469b3a35bc76f3"
integrity sha512-Q9xk6yjEGIThjSD8zZegxd5tBRNHYd13GOIG0nLsanbTXATiPXCLyvlYEfvbR2ft6dlRsziQXfQGxAgv7zcMUA==
"@prisma/engines-version@6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d":
version "6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d.tgz#dfd72efbf86a033c86b3245168f7383dfa3dd553"
integrity sha512-Xq54qw55vaCGrGgIJqyDwOq0TtjZPJEWsbQAHugk99hpDf2jcEeQhUcF+yzEsSqegBaDNLA4IC8Nn34sXmkiTQ==
"@prisma/engines@6.4.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-6.4.0.tgz#dd37f632cda7ad9140c389ff1618d77c158288b2"
integrity sha512-SeUigmWj0uhnSjYKWkG//Gzj4XHy6bi1TXgTZ+pPujxGELJgOvecgaA/bHmWokyHPnbYWRaoSwQDxPjihYzSZg==
"@prisma/engines@6.4.1":
version "6.4.1"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-6.4.1.tgz#e6f9056d466e0c3c3d60212c1ca1139bc1b51226"
integrity sha512-KldENzMHtKYwsOSLThghOIdXOBEsfDuGSrxAZjMnimBiDKd3AE4JQ+Kv+gBD/x77WoV9xIPf25GXMWffXZ17BA==
dependencies:
"@prisma/debug" "6.4.0"
"@prisma/debug" "6.4.1"
"@prisma/engines-version" "6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d"
"@prisma/fetch-engine" "6.4.0"
"@prisma/get-platform" "6.4.0"
"@prisma/fetch-engine" "6.4.1"
"@prisma/get-platform" "6.4.1"
"@prisma/fetch-engine@6.4.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-6.4.0.tgz#3e5bf1cc79734c8f05d54d4fb529bcb4e4ee4297"
integrity sha512-CN/Qb/+n+15gfhN0ipeUcGu/oGw7HIwVw4DCKD11190dneVGpa+n0wxwXTFJlV0vkAeSBSkQ3y1ugKAa5s/VPg==
"@prisma/fetch-engine@6.4.1":
version "6.4.1"
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-6.4.1.tgz#844686a1edeef8207abb230e34115fb7e72574fb"
integrity sha512-uZ5hVeTmDspx7KcaRCNoXmcReOD+84nwlO2oFvQPRQh9xiFYnnUKDz7l9bLxp8t4+25CsaNlgrgilXKSQwrIGQ==
dependencies:
"@prisma/debug" "6.4.0"
"@prisma/debug" "6.4.1"
"@prisma/engines-version" "6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d"
"@prisma/get-platform" "6.4.0"
"@prisma/get-platform" "6.4.1"
"@prisma/get-platform@6.4.0":
version "6.4.0"
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-6.4.0.tgz#4af641f6f7181de9c188b5487bec83c08524fe7a"
integrity sha512-khANH9QbCRhFWiGj3qmR0clxLTU76Cimxf4JAhjhtpsc1jdG1A9geGe0kU4WAQ1YpiKFJ10s9j2wbbE/jSP99Q==
"@prisma/get-platform@6.4.1":
version "6.4.1"
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-6.4.1.tgz#473152c71a896490680e92eab8bcfcd6c91b8c7d"
integrity sha512-gXqZaDI5scDkBF8oza7fOD3Q3QMD0e0rBynlzDDZdTWbWmzjuW58PRZtj+jkvKje2+ZigCWkH8SsWZAsH6q1Yw==
dependencies:
"@prisma/debug" "6.4.0"
"@prisma/debug" "6.4.1"
"@rollup/pluginutils@^5.1.4":
version "5.1.4"
@ -5636,12 +5636,12 @@ prettier@^3.3.3:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.1.tgz#22fac9d0b18c0b92055ac8fb619ac1c7bef02fb7"
integrity sha512-hPpFQvHwL3Qv5AdRvBFMhnKo4tYxp0ReXiPn2bxkiohEX6mBeBwEpBSQTkD458RaaDKQMYSp4hX4UtfUTA5wDw==
prisma@^6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-6.4.0.tgz#19fd91a34a401470cce2732a3ccc6f489c6a126f"
integrity sha512-UxEaEo1ajnEvwT9UQRyRfq0zZ9pvOmlZ6kShY8Hgu4jxgkHo1mg85IEP8yBgFRiRBA2o2OIt1nxzcllt86D4Mw==
prisma@^6.4.1:
version "6.4.1"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-6.4.1.tgz#8217325891466efaab5e896d9b11708c8503280e"
integrity sha512-q2uJkgXnua/jj66mk6P9bX/zgYJFI/jn4Yp0aS6SPRrjH/n6VyOV7RDe1vHD0DX8Aanx4MvgmUPPoYnR6MJnPg==
dependencies:
"@prisma/engines" "6.4.0"
"@prisma/engines" "6.4.1"
esbuild ">=0.12 <1"
esbuild-register "3.6.0"
optionalDependencies: