反爬虫优化,评论图片支持
This commit is contained in:
+27
-6
@@ -49,7 +49,7 @@ model Video {
|
||||
cover_url String?
|
||||
|
||||
authorId String
|
||||
author Author @relation(fields: [authorId], references: [sec_uid])
|
||||
author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade)
|
||||
|
||||
comments Comment[]
|
||||
|
||||
@@ -87,13 +87,16 @@ model Comment {
|
||||
|
||||
// 可关联视频或图文中的一种
|
||||
videoId String?
|
||||
video Video? @relation(fields: [videoId], references: [aweme_id])
|
||||
video Video? @relation(fields: [videoId], references: [aweme_id], onDelete: Cascade)
|
||||
|
||||
imagePostId String?
|
||||
imagePost ImagePost? @relation(fields: [imagePostId], references: [aweme_id])
|
||||
imagePost ImagePost? @relation(fields: [imagePostId], references: [aweme_id], onDelete: Cascade)
|
||||
|
||||
userId String
|
||||
user CommentUser @relation(fields: [userId], references: [id])
|
||||
user CommentUser @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
// 评论下的贴纸/配图(统一按图片存储)
|
||||
images CommentImage[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -102,6 +105,24 @@ model Comment {
|
||||
@@index([imagePostId, created_at])
|
||||
}
|
||||
|
||||
// 评论图片(贴纸和配图统一保存在这里)
|
||||
model CommentImage {
|
||||
id String @id @default(cuid())
|
||||
commentId String
|
||||
comment Comment @relation(fields: [commentId], references: [cid], onDelete: Cascade)
|
||||
|
||||
url String
|
||||
order Int // 在该评论中的顺序(0 开始)
|
||||
width Int?
|
||||
height Int?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([commentId, order])
|
||||
@@unique([commentId, order])
|
||||
}
|
||||
|
||||
// 图片作品(图文)
|
||||
model ImagePost {
|
||||
aweme_id String @id
|
||||
@@ -115,7 +136,7 @@ model ImagePost {
|
||||
collect_count BigInt @default(0)
|
||||
|
||||
authorId String
|
||||
author Author @relation(fields: [authorId], references: [sec_uid])
|
||||
author Author @relation(fields: [authorId], references: [sec_uid], onDelete: Cascade)
|
||||
|
||||
tags String[]
|
||||
music_url String? // 背景音乐(已上传到 MinIO 的外链)
|
||||
@@ -137,7 +158,7 @@ model ImagePost {
|
||||
model ImageFile {
|
||||
id String @id @default(cuid())
|
||||
postId String
|
||||
post ImagePost @relation(fields: [postId], references: [aweme_id])
|
||||
post ImagePost @relation(fields: [postId], references: [aweme_id], onDelete: Cascade)
|
||||
url String
|
||||
order Int // 在作品中的顺序(从 0 开始)
|
||||
width Int?
|
||||
|
||||
Reference in New Issue
Block a user