mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
127 lines
No EOL
3.1 KiB
Text
127 lines
No EOL
3.1 KiB
Text
generator client {
|
|
provider = "prisma-client-js"
|
|
output = "app/generated/prisma/client"
|
|
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(uuid())
|
|
username String @unique
|
|
email String @unique
|
|
password String
|
|
role String @default("user")
|
|
bio String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt @default(now())
|
|
|
|
profilePicture Media? @relation("UserProfilePicture", fields: [profilePictureId], references: [id])
|
|
profilePictureId String? @unique
|
|
|
|
posts Post[]
|
|
comments Comment[]
|
|
likes Like[]
|
|
media Media[] @relation("UploadedMedia")
|
|
|
|
following Follow[] @relation("Following")
|
|
followers Follow[] @relation("Followers")
|
|
}
|
|
|
|
enum PostStatus {
|
|
PUBLIC
|
|
PRIVATE
|
|
ARCHIVED
|
|
HIDDEN
|
|
}
|
|
|
|
model Post {
|
|
id String @id @default(uuid())
|
|
description String
|
|
status PostStatus @default(PRIVATE)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId String
|
|
|
|
comments Comment[]
|
|
likes Like[]
|
|
media Media[]
|
|
postTags PostTag[]
|
|
}
|
|
|
|
model Media {
|
|
id String @id @default(uuid())
|
|
originalFilename String
|
|
objectName String
|
|
mimeType String
|
|
size Int
|
|
uploadDate DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
bucket String
|
|
|
|
uploader User @relation("UploadedMedia", fields: [uploaderId], references: [id])
|
|
uploaderId String
|
|
|
|
post Post? @relation(fields: [postId], references: [id])
|
|
postId String?
|
|
userWithThisAsProfilePicture User? @relation("UserProfilePicture")
|
|
}
|
|
|
|
|
|
|
|
model Comment {
|
|
id String @id @default(uuid())
|
|
content String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
post Post @relation(fields: [postId], references: [id])
|
|
postId String
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId String
|
|
}
|
|
|
|
model Like {
|
|
id String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
|
|
post Post @relation(fields: [postId], references: [id])
|
|
postId String
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId String
|
|
}
|
|
|
|
model Tag {
|
|
id String @id @default(uuid())
|
|
name String @unique
|
|
|
|
posts PostTag[]
|
|
}
|
|
|
|
model PostTag {
|
|
postId String
|
|
tagId String
|
|
|
|
post Post @relation(fields: [postId], references: [id])
|
|
tag Tag @relation(fields: [tagId], references: [id])
|
|
|
|
@@id([postId, tagId])
|
|
}
|
|
|
|
model Follow {
|
|
followingUserId String
|
|
followedUserId String
|
|
createdAt DateTime @default(now())
|
|
|
|
followingUser User @relation("Following", fields: [followingUserId], references: [id])
|
|
followedUser User @relation("Followers", fields: [followedUserId], references: [id])
|
|
|
|
@@id([followingUserId, followedUserId])
|
|
} |