Compare commits

...

2 Commits

Author SHA1 Message Date
Rao 181e8c995d Merge branch 'main' of http://113.45.67.59:3003/linfeng/training_data 2025-04-21 20:48:17 +08:00
Rao 5c6a3eebda rht 2025-04-21 20:45:56 +08:00
1 changed files with 25 additions and 36 deletions

View File

@ -44,11 +44,12 @@ model Term {
createdBy String? @map("created_by")
depts Department[] @relation("department_term")
hasChildren Boolean? @default(false) @map("has_children")
posts Post[] @relation("post_term")
Plan Plan? @relation(fields: [planId], references: [id])
plan Plan? @relation(fields: [planId], references: [id])
planId String?
Subject Subject? @relation(fields: [subjectId], references: [id])
plans Plan[] @relation("plan_term")
subject Subject? @relation(fields: [subjectId], references: [id], name: "subject_term")
subjectId String?
trainPlans TrainPlan[] @relation("TrainPlanTerm")
@@index([name]) // 对name字段建立索引以加快基于name的查找速度
@@index([parentId]) // 对parentId字段建立索引以加快基于parentId的查找速度
@ -142,8 +143,6 @@ model Resource {
isPublic Boolean? @default(true) @map("is_public")
owner Staff? @relation(fields: [ownerId], references: [id])
ownerId String? @map("owner_id")
post Post? @relation(fields: [postId], references: [id])
postId String? @map("post_id")
// 索引
@@index([type])
@ -155,7 +154,6 @@ model Department {
id String @id @default(cuid())
name String
order Float?
posts Post[] @relation("post_dept")
ancestors DeptAncestry[] @relation("DescendantToAncestor")
descendants DeptAncestry[] @relation("AncestorToDescendant")
parentId String? @map("parent_id")
@ -169,13 +167,11 @@ model Department {
deptStaffs Staff[] @relation("DeptStaff")
terms Term[] @relation("department_term")
trainPlans TrainPlan[] @relation("TrainPlanDept")
// watchedPost Post[] @relation("post_watch_dept")
hasChildren Boolean? @default(false) @map("has_children")
planId String?
Plan Plan? @relation(fields: [planId], references: [id])
plans Plan[] @relation("plan_dept")
@@index([parentId])
@@index([isDomain])
@ -185,21 +181,18 @@ model Department {
}
model Staff {
id String @id @default(cuid())
showname String? @map("showname")
username String @unique @map("username")
avatar String? @map("avatar")
password String? @map("password")
phoneNumber String? @unique @map("phone_number")
age Int? @default(22) @map("age")
sex Boolean? @default(true) @map("sex")
absent Boolean? @default(false) @map("absent")
trainSituations TrainSituation[]
position Position? @relation("StaffPosition", fields: [positionId], references: [id])
positionId String? @map("position_id")
domainId String? @map("domain_id")
deptId String? @map("dept_id")
id String @id @default(cuid())
showname String? @map("showname")
username String @unique @map("username")
avatar String? @map("avatar")
password String? @map("password")
phoneNumber String? @unique @map("phone_number")
age Int? @default(22) @map("age")
gender Int? @default(1) @map("gender")
absent Boolean? @default(false) @map("absent")
subjects Subject[] @relation("staff_subject")
domainId String? @map("domain_id")
deptId String? @map("dept_id")
domain Department? @relation("DomainStaff", fields: [domainId], references: [id])
department Department? @relation("DeptStaff", fields: [deptId], references: [id])
@ -212,17 +205,10 @@ model Staff {
officerId String? @map("officer_id")
// watchedPost Post[] @relation("post_watch_staff")
visits Visit[]
posts Post[]
learningPosts Post[] @relation("post_student")
sentMsgs Message[] @relation("message_sender")
receivedMsgs Message[] @relation("message_receiver")
registerToken String?
enrollments Enrollment[]
teachedPosts PostInstructor[]
ownedResources Resource[]
Plan Plan[]
plans Plan[]
@@index([officerId])
@@index([deptId])
@ -242,10 +228,12 @@ model Plan {
updatedAt DateTime @map("updated_at")
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
terms Term[] @relation("plan_term")
checked Boolean @default(false) @map("checked")
depts Department[] @relation("plan_dept")
meta Json? @map("meta") // 计划表
terms Term[] @relation("plan_term")
termRefs Term[]
checked Boolean @default(false) @map("checked")
depts Department[] @relation("plan_dept")
meta Json? @map("meta") // 计划表
trainPlans TrainPlan[]
@@map("plan")
}
@ -287,6 +275,7 @@ model Subject {
children Subject[] @relation("SubjectChildren") // 子级帖子列表,关联 Post 模型
ancestors SubjectAncestry[] @relation("DescendantToAncestor")
descendants SubjectAncestry[] @relation("AncestorToDescendant")
staffs Staff[] @relation("staff_subject")
@@map("subject")
}