🗃️ db: add comment audit logs in schema

This commit is contained in:
2026-05-25 21:00:00 +07:00
parent 72a33377eb
commit 183642805d

View File

@ -78,6 +78,13 @@ enum like_type {
dislike
}
enum audit_action {
delete
restore
edit
flag
}
/**
@ -125,6 +132,7 @@ model User {
reviewed_video_services VideoServiceSubmission[] @relation("VideoServiceSubmissionReviewer")
comments Comment[]
comment_likes CommentLike[]
comment_audit_logs CommentAuditLog[]
@@index([email])
@@index([username])
@@map("users")
@ -655,6 +663,7 @@ model Comment {
user_id String @db.Uuid
episode_id String @db.Uuid
likes CommentLike[]
audit_logs CommentAuditLog[]
@@map("comments")
}
@ -670,6 +679,18 @@ model CommentLike {
@@map("comment_likes")
}
model CommentAuditLog {
id String @id @db.Uuid @default(uuid(7))
comment Comment @relation(fields: [comment_id], references: [id])
performed_by User @relation(fields: [performed_by_id], references: [id])
action audit_action
created_at DateTime @default(now()) @db.Timestamptz()
comment_id String @db.Uuid
performed_by_id String @db.Uuid
@@map("comment_audit_logs")
}
/**