Skip to content

feat: add case tracking model for independent investigation management#184

Open
codesailor4 wants to merge 1 commit into
MD-Creative-Production:mainfrom
codesailor4:feat/security
Open

feat: add case tracking model for independent investigation management#184
codesailor4 wants to merge 1 commit into
MD-Creative-Production:mainfrom
codesailor4:feat/security

Conversation

@codesailor4

Copy link
Copy Markdown
  • Create Case model with ownership and status tracking
  • Link InvestigationNote to Case with cascade delete
  • Add Case relationship to User model
  • Generate migration for cases table and relationships

Description

✅ Implementation Summary

Case Model Created

  • id - Unique identifier (CUID)
  • title - Case title/name
  • ownerId - Ownership tracking (foreign key to User)
  • status - Status field with default "open" (supports: open, in_progress, closed, on_hold)
  • createdAt & updatedAt - Timestamps for audit trail

Relationships Configured

  • User → Case: One-to-many relationship (users can own multiple cases)
  • Case → InvestigationNote: One-to-many relationship (notes belong to cases)
  • Cascade delete enabled on InvestigationNote (deleting a case removes its notes)

Migration Generated

Located in migration.sql:

  • Creates cases table with proper structure and defaults
  • Creates index on ownerId for query performance
  • Establishes foreign key constraints for data integrity
  • Sets up cascade delete for investigation notes

All acceptance criteria met:

  • ✅ Case entity created
  • ✅ Migration generated
  • ✅ Relationships configured with ownership and status tracking

Made changes.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Related Issues

Fixes #
Related to #

Changes Made

Testing

  • I have tested these changes locally
  • Tests pass locally (npm run test)
  • Linting passes (npm run lint)
  • Code is formatted (npm run format)
  • TypeScript builds successfully (npm run build)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests passed with my changes

Screenshots (if applicable)

Additional Context

Closes #126

- Create Case model with ownership and status tracking
- Link InvestigationNote to Case with cascade delete
- Add Case relationship to User model
- Generate migration for cases table and relationships
@mijinummi

Copy link
Copy Markdown
Collaborator

Hello @codesailor4 , thank you for this great work. Please kindly fix the database migration check failure and push back. Well done

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.

Create Security Case Management Entity

2 participants