enum ProgressReportSemester { S1 S2 } enum ProgressReportStatus { DRAFT SENT } enum ProgressReportMeetingStatus { DRAFT SENT } enum ProgressReportMeetingSlot { FIRST SECOND } enum ProgressReportDeadlineSlot { FIRST SECOND FINAL } enum ProgressReportDeadlineStatus { DRAFT SENT } enum ProgressReportMinistryStatus { DRAFT SHARED_WITH_PSWG PSWG_REVIEWED SUBMITTED CDC_UNDER_REVIEW COMPLETED } model ProgressReport { id Int @id @default(autoincrement()) title String @db.VarChar(255) description Json? @map("description") year Int semester ProgressReportSemester status ProgressReportStatus @default(DRAFT) attachment String @db.VarChar(500) draftSemesterReport String? @map("draft_semester_report") @db.VarChar(500) finalSemesterReport String? @map("final_semester_report") @db.VarChar(500) userId Int @map("user_id") user User @relation("progress_reports", fields: [userId], references: [id]) deadlines ProgressReportDeadline[] @relation("progress_report_deadlines") meetings ProgressReportMeeting[] @relation("progress_report_meetings") ministries ProgressReportMinistry[] @relation("progress_report_ministries") progressReportUpdates ProgressReportUpdate[] @relation("progress_report_progress_report_updates") progressReportUpdatePlenaryDecisions ProgressReportUpdatePlenaryDecision[] @relation("progress_report_update_plenary_decisions_report") createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") @@unique([year, semester]) @@index([userId]) @@index([year]) @@index([semester]) @@index([status]) @@index([deletedAt]) @@map("progress_reports") } model ProgressReportDeadline { id Int @id @default(autoincrement()) progressReportId Int @map("progress_report_id") slot ProgressReportDeadlineSlot deadline DateTime @db.Date status ProgressReportDeadlineStatus @default(DRAFT) progressReport ProgressReport @relation("progress_report_deadlines", fields: [progressReportId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") @@unique([progressReportId, slot]) @@index([progressReportId]) @@index([slot]) @@index([status]) @@index([deadline]) @@index([deletedAt]) @@map("progress_report_deadlines") } model ProgressReportMeeting { id Int @id @default(autoincrement()) progressReportId Int @map("progress_report_id") slot ProgressReportMeetingSlot title String @db.VarChar(100) description Json? @map("description") meetingDate DateTime @map("meeting_date") @db.Date startTime DateTime @map("start_time") @db.Time endTime DateTime @map("end_time") @db.Time location String @db.VarChar(255) documentReference String @map("document_reference") @db.VarChar(500) status ProgressReportMeetingStatus @default(DRAFT) userId Int @map("user_id") progressReport ProgressReport @relation("progress_report_meetings", fields: [progressReportId], references: [id], onDelete: Cascade) user User @relation("progress_report_meetings", fields: [userId], references: [id]) createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") @@unique([progressReportId, slot]) @@index([progressReportId]) @@index([slot]) @@index([status]) @@index([meetingDate]) @@index([startTime]) @@index([endTime]) @@index([location]) @@index([documentReference]) @@index([userId]) @@index([deletedAt]) @@map("progress_report_meetings") } model ProgressReportMinistry { id Int @id @default(autoincrement()) progressReportId Int @map("progress_report_id") ministryId Int @map("ministry_id") issues Int @default(0) @map("issues") attachment String? @db.VarChar(500) status ProgressReportMinistryStatus @default(DRAFT) userId Int? @map("user_id") submittedAt DateTime? @map("submitted_at") reviewedById Int? @map("reviewed_by_id") reviewedAt DateTime? @map("reviewed_at") ministry Stakeholder @relation("progress_report_ministries", fields: [ministryId], references: [id], onDelete: Restrict) user User? @relation("progress_report_ministries", fields: [userId], references: [id]) reviewedBy User? @relation("progress_report_ministries_reviewer", fields: [reviewedById], references: [id]) progressReport ProgressReport @relation("progress_report_ministries", fields: [progressReportId], references: [id]) createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") @@unique([progressReportId, ministryId]) @@index([progressReportId]) @@index([ministryId]) @@index([status]) @@index([userId]) @@index([reviewedById]) @@index([submittedAt]) @@index([deletedAt]) @@map("progress_report_ministries") } model ProgressReportUpdate { id Int @id @default(autoincrement()) progressReportId Int @map("progress_report_id") ministryId Int @map("ministry_id") issueId Int? @map("issue_id") issueStatusId Int @map("issue_status_id") issueResolveId Int? @map("issue_resolve_id") indicators Json? @map("indicators") progressSolution Json? @map("progress_solution") implementationChallenges Json? @map("implementation_challenges") requests Json? @map("requests") sourceOfVerification String? @map("source_of_verification") linkToVerificationSource String? @map("link_to_verification_source") dateOfIssueSolution DateTime? @map("date_of_issue_solution") attachement String? @map("attachement") @db.VarChar(500) next_step Json? @map("next_step") userId Int @map("user_id") createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") progressReport ProgressReport @relation("progress_report_progress_report_updates", fields: [progressReportId], references: [id]) issue Issues? @relation("issue_progress_report_updates", fields: [issueId], references: [id]) issueStatus IssueStatuses @relation("issue_status_progress_report_updates", fields: [issueStatusId], references: [id]) issueResolve IssueResolves? @relation("issue_resolve_progress_report_updates", fields: [issueResolveId], references: [id]) user User @relation("progress_report_updates", fields: [userId], references: [id]) ministry Stakeholder @relation("progress_report_update", fields: [ministryId], references: [id]) progressReportUpdateIssues ProgressReportUpdateIssue[] @relation("progress_report_update_issues") progressReportUpdatePlenaryDecisions ProgressReportUpdatePlenaryDecision[] @relation("progress_report_update_plenary_decisions") @@unique([progressReportId, ministryId, issueId]) @@index([progressReportId]) @@index([ministryId]) @@index([issueId]) @@index([issueStatusId]) @@index([indicators]) @@index([progressSolution]) @@index([implementationChallenges]) @@index([requests]) @@index([sourceOfVerification]) @@index([linkToVerificationSource]) @@index([dateOfIssueSolution]) @@index([attachement]) @@index([userId]) @@index([deletedAt]) @@map("progress_report_updates") } model ProgressReportUpdateIssue { id Int @id @default(autoincrement()) progressReportUpdateId Int @map("progress_report_update_id") ministryId Int @map("ministry_id") issueId Int @map("issue_id") progressReportUpdate ProgressReportUpdate @relation("progress_report_update_issues", fields: [progressReportUpdateId], references: [id]) ministry Stakeholder @relation("progress_report_update_issues", fields: [ministryId], references: [id]) issue Issues @relation("progress_report_update_issues", fields: [issueId], references: [id]) progressReportIssueComments ProgressReportIssueComment[] @relation("progress_report_issue_comments") @@unique([progressReportUpdateId, ministryId, issueId]) @@index([progressReportUpdateId]) @@index([ministryId]) @@index([issueId]) @@map("progress_report_update_issues") } model ProgressReportIssueComment { id Int @id @default(autoincrement()) commentTypeId Int @map("comment_type_id") progressReportUpdateIssueId Int? @map("progress_report_update_issue_id") progressReportUpdatePlenaryDecisionId Int? @map("progress_report_update_plenary_decision_id") comment Json? @map("comment") userId Int @map("user_id") commentType CommentType @relation("progress_report_issue_comments", fields: [commentTypeId], references: [id]) user User @relation("progress_report_issue_comments", fields: [userId], references: [id]) progressReportUpdateIssue ProgressReportUpdateIssue? @relation("progress_report_issue_comments", fields: [progressReportUpdateIssueId], references: [id]) progressReportUpdatePlenaryDecision ProgressReportUpdatePlenaryDecision? @relation("progress_report_rgc_decision_comments", fields: [progressReportUpdatePlenaryDecisionId], references: [id]) createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") @@index([commentTypeId]) @@index([progressReportUpdateIssueId]) @@index([progressReportUpdatePlenaryDecisionId]) @@index([userId]) @@index([deletedAt]) @@map("progress_report_issue_comments") } model ProgressReportUpdatePlenaryDecision { id Int @id @default(autoincrement()) progressReportUpdateId Int @map("progress_report_update_id") progressReportId Int @map("progress_report_id") ministryId Int @map("ministry_id") plenaryDecisionId Int @map("plenary_decision_id") progressReport ProgressReport @relation("progress_report_update_plenary_decisions_report", fields: [progressReportId], references: [id]) progressReportUpdate ProgressReportUpdate @relation("progress_report_update_plenary_decisions", fields: [progressReportUpdateId], references: [id]) ministry Stakeholder @relation("progress_report_update_plenary_decisions", fields: [ministryId], references: [id]) plenaryDecision PlenaryRgcDecision @relation("progress_report_update_plenary_decisions", fields: [plenaryDecisionId], references: [id]) progressReportIssueComments ProgressReportIssueComment[] @relation("progress_report_rgc_decision_comments") createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") @@unique([progressReportId, ministryId, plenaryDecisionId]) @@index([progressReportUpdateId]) @@index([progressReportId]) @@index([plenaryDecisionId]) @@index([ministryId]) @@index([deletedAt]) @@map("progress_report_update_plenary_decisions") }