🚧 wip: create bulk insert endpoint
This commit is contained in:
@ -6,23 +6,22 @@ Table medias {
|
||||
id String [pk]
|
||||
title String [not null]
|
||||
titleAlternative Json [not null]
|
||||
slug String [not null]
|
||||
slug String [unique, not null]
|
||||
malId Int [unique]
|
||||
pictureMedium String [not null]
|
||||
pictureLarge String [not null]
|
||||
genres genres [not null]
|
||||
country countries [not null]
|
||||
countryId String [not null]
|
||||
isAiring Boolean [not null, default: false]
|
||||
isTba Boolean [not null, default: false]
|
||||
startAiring DateTime [not null]
|
||||
endAiring DateTime [not null]
|
||||
country Country [not null, default: 'JP']
|
||||
score Decimal [not null, default: 0]
|
||||
status String [not null]
|
||||
startAiring DateTime
|
||||
endAiring DateTime
|
||||
synopsis String [not null]
|
||||
nfsw Boolean [not null, default: false]
|
||||
ageRating AgeRating [not null]
|
||||
ageRating String [not null]
|
||||
mediaType MediaType [not null]
|
||||
source Source [not null]
|
||||
source String
|
||||
studios studios [not null]
|
||||
pendingUpload Boolean [not null, default: true]
|
||||
onDraft Boolean [not null, default: true]
|
||||
uploader users [not null]
|
||||
uploadedBy String [not null]
|
||||
deletedAt DateTime
|
||||
@ -51,7 +50,7 @@ Table media_logs {
|
||||
Table genres {
|
||||
id String [pk]
|
||||
name String [not null]
|
||||
slug String [not null]
|
||||
slug String [unique, not null]
|
||||
malId Int [not null]
|
||||
malUrl String [not null]
|
||||
creator users [not null]
|
||||
@ -66,9 +65,10 @@ Table genres {
|
||||
Table studios {
|
||||
id String [pk]
|
||||
name String [not null]
|
||||
slug String [not null]
|
||||
logoUrl String [not null]
|
||||
colorHex String [not null]
|
||||
slug String [unique, not null]
|
||||
linkAbout String [not null]
|
||||
malId Int [not null]
|
||||
logoUrl String
|
||||
creator users [not null]
|
||||
createdBy String [not null]
|
||||
deletedAt DateTime
|
||||
@ -77,20 +77,6 @@ Table studios {
|
||||
medias medias [not null]
|
||||
}
|
||||
|
||||
Table countries {
|
||||
id String [pk]
|
||||
name String [not null]
|
||||
code String [not null]
|
||||
flag String [not null]
|
||||
creator users [not null]
|
||||
createdBy String [not null]
|
||||
deletedAt DateTime
|
||||
createdAt DateTime [default: `now()`, not null]
|
||||
updatedAt DateTime [default: `now()`, not null]
|
||||
medias medias [not null]
|
||||
user_show_countries user_preferences [not null]
|
||||
}
|
||||
|
||||
Table episodes {
|
||||
id String [pk]
|
||||
media medias [not null]
|
||||
@ -186,7 +172,6 @@ Table users {
|
||||
media_approveds media_logs [not null]
|
||||
genres genres [not null]
|
||||
studios studios [not null]
|
||||
countries countries [not null]
|
||||
episodes episodes [not null]
|
||||
episode_likes episode_likes [not null]
|
||||
videos videos [not null]
|
||||
@ -221,7 +206,7 @@ Table user_preferences {
|
||||
videoQuality VideoQuality [not null, default: 'Q1080']
|
||||
serviceDefault video_services
|
||||
serviceDefaultId String
|
||||
showContries countries [not null]
|
||||
hideContries Country[] [not null]
|
||||
favoriteGenres genres [not null]
|
||||
createdAt DateTime [default: `now()`, not null]
|
||||
updatedAt DateTime [default: `now()`, not null]
|
||||
@ -495,25 +480,11 @@ Table UserFavoriteGenres {
|
||||
favoritegenresId String [ref: > genres.id]
|
||||
}
|
||||
|
||||
Table UserShowContries {
|
||||
user_show_countriesId String [ref: > user_preferences.id]
|
||||
showcontriesId String [ref: > countries.id]
|
||||
}
|
||||
|
||||
Table UserSelectedSharingCollention {
|
||||
allowed_collectionsId String [ref: > collections.id]
|
||||
usersallowedId String [ref: > users.id]
|
||||
}
|
||||
|
||||
Enum AgeRating {
|
||||
G
|
||||
PG
|
||||
PG_13
|
||||
R
|
||||
R_plus
|
||||
Rx
|
||||
}
|
||||
|
||||
Enum MediaType {
|
||||
TV
|
||||
ONA
|
||||
@ -523,11 +494,11 @@ Enum MediaType {
|
||||
Music
|
||||
}
|
||||
|
||||
Enum Source {
|
||||
original
|
||||
manga
|
||||
light_novel
|
||||
game
|
||||
Enum Country {
|
||||
JP
|
||||
EN
|
||||
ID
|
||||
KR
|
||||
}
|
||||
|
||||
Enum MediaOperation {
|
||||
@ -622,8 +593,6 @@ Enum TypeSystemNotification {
|
||||
toast
|
||||
}
|
||||
|
||||
Ref: medias.countryId > countries.id
|
||||
|
||||
Ref: medias.uploadedBy > users.id
|
||||
|
||||
Ref: media_logs.proposedBy > users.id
|
||||
@ -636,8 +605,6 @@ Ref: genres.createdBy > users.id
|
||||
|
||||
Ref: studios.createdBy > users.id
|
||||
|
||||
Ref: countries.createdBy > users.id
|
||||
|
||||
Ref: episodes.mediaId > medias.id
|
||||
|
||||
Ref: episodes.uploadedBy > users.id
|
||||
|
||||
@ -32,16 +32,16 @@ model Media {
|
||||
pictureLarge String @db.Text
|
||||
genres Genre[] @relation("MediaGenres")
|
||||
country Country @default(JP)
|
||||
status Status
|
||||
score Decimal @db.Decimal(4, 2) @default(0.00)
|
||||
status String
|
||||
startAiring DateTime?
|
||||
finishAiring DateTime?
|
||||
endAiring DateTime?
|
||||
synopsis String @db.Text
|
||||
nfsw Boolean @default(false)
|
||||
ageRating AgeRating
|
||||
ageRating String
|
||||
mediaType MediaType
|
||||
source Source
|
||||
source String?
|
||||
studios Studio[] @relation("MediaStudios")
|
||||
onDraft Boolean @default(false)
|
||||
onDraft Boolean @default(true)
|
||||
uploader User @relation("UserUploadedMedias", fields: [uploadedBy], references: [id])
|
||||
uploadedBy String
|
||||
deletedAt DateTime?
|
||||
@ -52,6 +52,11 @@ model Media {
|
||||
episodes Episode[] @relation("MediaEpisodes")
|
||||
collections Collection[] @relation("MediaCollections")
|
||||
reviews MediaReview[] @relation("MediaReviews")
|
||||
|
||||
@@index([status, onDraft, deletedAt])
|
||||
@@index([mediaType])
|
||||
@@index([uploadedBy])
|
||||
@@index([createdAt])
|
||||
@@map("medias")
|
||||
}
|
||||
|
||||
@ -73,7 +78,7 @@ model MediaLog {
|
||||
model Genre {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
slug String @db.VarChar(255)
|
||||
slug String @db.VarChar(255) @unique
|
||||
malId Int
|
||||
malUrl String @db.VarChar(255)
|
||||
creator User @relation("UserCreatedGenres", fields: [createdBy], references: [id])
|
||||
@ -84,15 +89,17 @@ model Genre {
|
||||
|
||||
medias Media[] @relation("MediaGenres")
|
||||
user_favourite_genres UserPreference[] @relation("UserFavoriteGenres")
|
||||
|
||||
@@map("genres")
|
||||
}
|
||||
|
||||
model Studio {
|
||||
id String @id @default(uuid())
|
||||
name String @db.VarChar(255)
|
||||
slug String @db.VarChar(255)
|
||||
logoUrl String @db.Text
|
||||
colorHex String @db.VarChar(10)
|
||||
slug String @db.VarChar(255) @unique
|
||||
linkAbout String @db.Text
|
||||
malId Int
|
||||
logoUrl String? @db.Text
|
||||
creator User @relation("UserCreatedStudios", fields: [createdBy], references: [id])
|
||||
createdBy String
|
||||
deletedAt DateTime?
|
||||
@ -103,6 +110,40 @@ model Studio {
|
||||
@@map("studios")
|
||||
}
|
||||
|
||||
model Character {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
name String
|
||||
role CharacterRole
|
||||
favorites Int @default(0)
|
||||
imageUrl String?
|
||||
smallImageUrl String?
|
||||
createdBy User @relation("UserCreatedCharacters", fields: [creatorId], references: [id])
|
||||
creatorId String
|
||||
deletedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@map("characters")
|
||||
}
|
||||
|
||||
model VoiceActor {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
malId Int
|
||||
name String
|
||||
birthday DateTime?
|
||||
description String @db.Text
|
||||
aboutUrl String
|
||||
imageUrl String?
|
||||
websiteUrl String?
|
||||
createdBy User @relation("UserCreatedVoiceActors", fields: [creatorId], references: [id])
|
||||
creatorId String
|
||||
deletedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@map("voice_actors")
|
||||
}
|
||||
|
||||
model Episode {
|
||||
id String @id @default(uuid())
|
||||
media Media @relation("MediaEpisodes", fields: [mediaId], references: [id])
|
||||
@ -205,6 +246,8 @@ model User {
|
||||
media_approveds MediaLog[] @relation("UserApprovedMedias")
|
||||
genres Genre[] @relation("UserCreatedGenres")
|
||||
studios Studio[] @relation("UserCreatedStudios")
|
||||
characters Character[] @relation("UserCreatedCharacters")
|
||||
voice_actor VoiceActor[] @relation("UserCreatedVoiceActors")
|
||||
episodes Episode[] @relation("UserEpisodes")
|
||||
episode_likes EpisodeLike[] @relation("UserEpisodeLikes")
|
||||
videos Video[] @relation("UserVideos")
|
||||
@ -523,14 +566,6 @@ model SystemLog {
|
||||
//// Prisma Enum Values ////
|
||||
|
||||
// Media Enum
|
||||
enum AgeRating {
|
||||
G // All Ages
|
||||
PG // Children
|
||||
PG_13 // Teens 13 or older
|
||||
R // 17+ (violance & profanity)
|
||||
R_plus // Mild Nudity
|
||||
Rx // Hentai
|
||||
}
|
||||
enum MediaType {
|
||||
TV
|
||||
ONA
|
||||
@ -539,17 +574,6 @@ enum MediaType {
|
||||
Special
|
||||
Music
|
||||
}
|
||||
enum Source {
|
||||
original
|
||||
manga
|
||||
light_novel
|
||||
game
|
||||
}
|
||||
enum Status {
|
||||
FINISHED_AIRING @map("Finished Airing")
|
||||
CURRENTLY_AIRING @map("Currently Airing")
|
||||
NOT_YET_AIRED @map("Not yet aired")
|
||||
}
|
||||
enum Country {
|
||||
JP @map("Japanese")
|
||||
EN @map("English")
|
||||
@ -557,6 +581,12 @@ enum Country {
|
||||
KR @map("Korea")
|
||||
}
|
||||
|
||||
// Character Enum
|
||||
enum CharacterRole {
|
||||
Main
|
||||
Supporting
|
||||
}
|
||||
|
||||
// MediaLog Enum
|
||||
enum MediaOperation {
|
||||
create
|
||||
|
||||
Reference in New Issue
Block a user