Skip to content

feat(cases): design independent forensic investigation and case management domain model - #226

Merged
mijinummi merged 1 commit into
MD-Creative-Production:mainfrom
SharifIbrahimDev:feat/forensic-case-management-model-126
Aug 27, 2026
Merged

feat(cases): design independent forensic investigation and case management domain model#226
mijinummi merged 1 commit into
MD-Creative-Production:mainfrom
SharifIbrahimDev:feat/forensic-case-management-model-126

Conversation

@SharifIbrahimDev

Copy link
Copy Markdown

Description

Closes #126

Architects and integrates a dedicated, independent Forensic Investigation & Case Management data model within the system's core database domain (\prisma/schema.prisma). This decouples long-running forensic case tracking from transient, short-lived alert incidents while supporting multi-party investigation ownership, granular audit trail history, and dynamic relational mapping to associated system incidents.


Type of Change

  • New feature (non-breaking change which adds functionality)
  • Database / Architecture

Related Issues

Closes #126


Changes Made

  1. Prisma Schema Extensions (\prisma/schema.prisma):

    • Enums:
      • \CaseStatus: \DRAFT, \ACTIVE, \IN_REVIEW, \SUSPENDED, \CLOSED, \ARCHIVED\
      • \CaseSeverity: \LOW, \MEDIUM, \HIGH, \CRITICAL\
      • \CaseAssigneeRole: \INVESTIGATOR, \LEGAL_OBSERVER, \EXTERNAL_AUDITOR\
    • Case Model: UUID primary identifier, indexed human-readable \caseNumber\ (e.g. \CASE-2026-0891), lifecycle timestamps, and relationships to assignees, incidents, activity logs, and investigation notes.
    • CaseAssignee Model: Join table supporting multi-user collaborator tracking with granular role attributes.
    • CaseIncident Model: Explicit M:N mapping table linking multiple Incident records to a single Case with \onDelete: Restrict\ relational safety.
    • CaseActivityLog Model: Audit ledger capturing state mutations, actor ID, IP address, changed fields (JSON diffs), and timestamp for tamper-evident provenance.
    • Updated Existing Models: Linked \User\ (\leadCases, \caseAssignments, \caseActivities), \Incident\ (\caseIncidents), and \InvestigationNote\ (\case).
  2. Migration Script (\prisma/migrations/20260825181000_add_forensic_case_management/migration.sql):

    • Deterministic SQL DDL creating enums, tables, unique constraints, foreign keys with appropriate cascade/restrict behaviors, and indexes.
  3. Domain Types (\src/domain/cases/types/index.ts):

    • Enums and TypeScript interfaces for Case domain entities, DTOs (\CreateCaseInput, \UpdateCaseInput, \AddCaseAssigneeInput, \LinkCaseIncidentInput, \LogCaseActivityInput), and audit delta structures.
  4. Seed Pipeline (\src/infrastructure/database/seeds/caseSeed.ts):

    • Database seed script populating mock users, incidents, cases with various statuses/severities, multi-role assignees, linked incidents, and audit logs with JSON diffs for local development and testing.
  5. Testing (\ ests/domain/cases/case-domain.test.ts):

    • Comprehensive test suite validating enum integrity, DTO structures, JSON diffs, and database seed execution.

Testing


  • px prisma validate\ passes cleanly with 0 syntax errors or relation ambiguities.

  • px prisma generate\ generated client cleanly.
  • Jest test suite passes (\ ests/domain/cases/case-domain.test.ts).
  • Commitlint and lint-staged hooks passed.

@mijinummi
mijinummi merged commit b10fdd8 into MD-Creative-Production:main Aug 27, 2026
6 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# [FEAT] Design Independent Forensic Investigation & Case Management Domain Model in Prisma

2 participants