feat(v2.7): 建立协作治理基础合同
This commit is contained in:
@@ -138,7 +138,6 @@ model Task {
|
||||
assignee User? @relation("TaskAssignee", fields: [assigneeId], references: [id])
|
||||
creator User @relation("TaskCreator", fields: [creatorId], references: [id])
|
||||
watchers TaskWatcher[]
|
||||
comments Comment[]
|
||||
|
||||
@@map("tasks")
|
||||
}
|
||||
@@ -156,30 +155,100 @@ model TaskWatcher {
|
||||
}
|
||||
|
||||
model Comment {
|
||||
id String @id @default(cuid())
|
||||
taskId String @map("task_id")
|
||||
authorId String @map("author_id")
|
||||
content String
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
task Task @relation(fields: [taskId], references: [id])
|
||||
id String @id @default(cuid())
|
||||
entityType String @map("entity_type")
|
||||
entityId String @map("entity_id")
|
||||
entityVersionId String? @map("entity_version_id")
|
||||
productId String? @map("product_id")
|
||||
projectId String? @map("project_id")
|
||||
versionId String? @map("version_id")
|
||||
authorId String @map("author_id")
|
||||
content String
|
||||
mentionedMemberIds Json @default("[]") @map("mentioned_member_ids")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@index([entityType, entityId, createdAt], name: "comments_entity_created_idx")
|
||||
@@index([authorId, createdAt], name: "comments_author_created_idx")
|
||||
@@map("comments")
|
||||
}
|
||||
|
||||
model ProjectMember {
|
||||
id String @id @default(cuid())
|
||||
projectId String @map("project_id")
|
||||
userId String @map("user_id")
|
||||
role String @default("member")
|
||||
id String @id @default(cuid())
|
||||
projectId String @map("project_id")
|
||||
userId String @map("user_id")
|
||||
role String @default("member")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
project Project @relation(fields: [projectId], references: [id])
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
@@unique([projectId, userId])
|
||||
@@index([userId, role], name: "project_members_user_role_idx")
|
||||
@@map("project_members")
|
||||
}
|
||||
|
||||
model Notification {
|
||||
id String @id @default(cuid())
|
||||
recipientId String @map("recipient_id")
|
||||
actorId String? @map("actor_id")
|
||||
type String
|
||||
title String
|
||||
body String @default("")
|
||||
resourceType String @map("resource_type")
|
||||
resourceId String @map("resource_id")
|
||||
resourceVersionId String? @map("resource_version_id")
|
||||
productId String? @map("product_id")
|
||||
projectId String? @map("project_id")
|
||||
versionId String? @map("version_id")
|
||||
metadata Json @default("{}")
|
||||
readAt DateTime? @map("read_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([recipientId, readAt, createdAt], name: "notifications_recipient_read_created_idx")
|
||||
@@index([resourceType, resourceId], name: "notifications_resource_idx")
|
||||
@@map("notifications")
|
||||
}
|
||||
|
||||
model AuditLog {
|
||||
id String @id @default(cuid())
|
||||
actorId String? @map("actor_id")
|
||||
action String
|
||||
resourceType String @map("resource_type")
|
||||
resourceId String @map("resource_id")
|
||||
productId String? @map("product_id")
|
||||
projectId String? @map("project_id")
|
||||
versionId String? @map("version_id")
|
||||
before Json @default("{}")
|
||||
after Json @default("{}")
|
||||
metadata Json @default("{}")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([resourceType, resourceId, createdAt], name: "audit_logs_resource_created_idx")
|
||||
@@index([actorId, createdAt], name: "audit_logs_actor_created_idx")
|
||||
@@map("audit_logs")
|
||||
}
|
||||
|
||||
model GovernanceDictionary {
|
||||
id String @id @default(cuid())
|
||||
scope String @default("global")
|
||||
kind String
|
||||
name String
|
||||
code String?
|
||||
group String?
|
||||
value Json @default("{}")
|
||||
isSystem Boolean @default(false) @map("is_system")
|
||||
deletedAt DateTime? @map("deleted_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@unique([scope, kind, name])
|
||||
@@index([kind, deletedAt], name: "governance_dictionaries_kind_deleted_idx")
|
||||
@@map("governance_dictionaries")
|
||||
}
|
||||
|
||||
model TaskCategory {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
|
||||
Reference in New Issue
Block a user