@@ -64,26 +64,31 @@ model User {
6464}
6565
6666model TeamMember {
67- id String @id @default (uuid () ) // pilih uuid supaya beda style dari user.id
68- clientId String ? @unique
69- userId String
70- workspaceId String
71- name String
72- role String ?
73- email String ?
74- photo String ?
75- phone String ?
76- isTrash Boolean @default (false )
77- isAdmin Boolean @default (false )
78- createdAt DateTime @default (now () )
79- updatedAt DateTime ?
80- Task Task [] @relation (" TaskMembers " )
81- TaskCreatedBy Task [] @relation (" TaskCreatedBy " )
82-
83- // FK ke Workspace
84- workspace Workspace ? @relation (" WorkspaceMembers " , fields : [workspaceId ] , references : [id ] )
85- user User ? @relation (" UserMembers " , fields : [userId ] , references : [id ] )
67+ id String @id @default (uuid () )
68+ clientId String ? @unique
69+ userId String
70+ workspaceId String
71+
72+ name String
73+ role String ?
74+ email String ?
75+ photo String ?
76+ phone String ?
77+
78+ isTrash Boolean @default (false )
79+ isAdmin Boolean @default (false )
80+
81+ createdAt DateTime @default (now () )
82+ updatedAt DateTime ?
83+
84+ // 🔗 RELATIONS (HARUS SESUAI NAMA)
85+ assignedTasks Task [] @relation (" TaskAssignee " )
86+
8687 taskAssignees TaskAssignee []
88+
89+ // FK
90+ workspace Workspace ? @relation (" WorkspaceMembers " , fields : [workspaceId ] , references : [id ] )
91+ user User ? @relation (" UserMembers " , fields : [userId ] , references : [id ] )
8792}
8893
8994model Workspace {
@@ -112,26 +117,38 @@ model Project {
112117}
113118
114119model Task {
115- id String @id @default (uuid () )
116- title String
117- description String ?
118- status String @default (" todo " )
119- projectId String ?
120- project Project ? @relation (" ProjectTasks " , fields : [projectId ] , references : [id ] )
121- assigneeId String ?
122- startDate String ?
123- dueDate String ?
124- finishDate DateTime ?
125- priority String ?
126- assignee TeamMember ? @relation (" TaskMembers " , fields : [assigneeId ] , references : [id ] )
127- isTrash Boolean @default (false )
128- comments Comment [] @relation (" TaskComments " )
129- clientId String ? @unique
130- createdAt DateTime @default (now () )
131- createdById String ?
132- createdBy TeamMember ? @relation (" TaskCreatedBy " , fields : [createdById ] , references : [id ] )
133- updatedAt DateTime ?
120+ id String @id @default (uuid () )
121+ title String
122+ description String ?
123+ status String @default (" todo " )
124+
125+ projectId String ?
126+ project Project ? @relation (" ProjectTasks " , fields : [projectId ] , references : [id ] )
127+
128+ // 👤 ASSIGNEE (legacy single)
129+ assigneeId String ?
130+ assignee TeamMember ? @relation (" TaskAssignee " , fields : [assigneeId ] , references : [id ] )
131+
132+ // 👥 MULTI ASSIGNEE
134133 taskAssignees TaskAssignee []
134+
135+ startDate String ?
136+ dueDate String ?
137+ finishDate DateTime ?
138+ priority String ?
139+
140+ comments Comment [] @relation (" TaskComments " )
141+
142+ clientId String ? @unique
143+
144+ createdAt DateTime @default (now () )
145+ updatedAt DateTime ?
146+
147+ // 👤 AUDIT FIELDS (Team Member ID)
148+ createdById String ?
149+ updatedById String ?
150+
151+ isTrash Boolean @default (false )
135152}
136153
137154model TaskAssignee {
@@ -151,6 +168,7 @@ model Comment {
151168 id String @id @default (uuid () )
152169 taskId String
153170 task Task @relation (" TaskComments " , fields : [taskId ] , references : [id ] )
171+ memberId String ?
154172 author String
155173 body String
156174 attachments Json ? // optional JSON array of attachments metadata
0 commit comments