feat: 完善广场功能
This commit is contained in:
@@ -27,6 +27,12 @@ enum ImageArchiveStatus {
|
||||
FAILED
|
||||
}
|
||||
|
||||
enum PlazaPostStatus {
|
||||
PUBLIC
|
||||
HIDDEN
|
||||
REMOVED
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id
|
||||
username String @default("") @db.VarChar(191)
|
||||
@@ -37,6 +43,7 @@ model User {
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
imageGenerations ImageGeneration[]
|
||||
plazaPosts PlazaPost[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -67,6 +74,7 @@ model ImageGeneration {
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
plazaPost PlazaPost?
|
||||
|
||||
@@index([userId, createdAt])
|
||||
@@index([status])
|
||||
@@ -76,6 +84,24 @@ model ImageGeneration {
|
||||
@@map("image_generations")
|
||||
}
|
||||
|
||||
model PlazaPost {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
imageGenerationId BigInt @unique @map("image_generation_id") @db.UnsignedBigInt
|
||||
userId Int @map("user_id")
|
||||
status PlazaPostStatus @default(PUBLIC)
|
||||
publishedAt DateTime @default(now()) @map("published_at")
|
||||
hiddenAt DateTime? @map("hidden_at")
|
||||
removedAt DateTime? @map("removed_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
imageGeneration ImageGeneration @relation(fields: [imageGenerationId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([status, publishedAt])
|
||||
@@index([userId, publishedAt])
|
||||
@@map("plaza_posts")
|
||||
}
|
||||
|
||||
model GenerationStats {
|
||||
id String @id @db.VarChar(32)
|
||||
totalRequests Int @default(0) @map("total_requests")
|
||||
|
||||
Reference in New Issue
Block a user