Project Model Documentation
Overview​
The Project model represents work initiatives within CODITECT, supporting various methodologies (PMI, Agile, etc.) through an extensible architecture. It serves as the central organizing unit for tasks, resources, and deliverables.
Model Structure​
Core Fields (Base Model)​
| Field | Type | Description | Constraints |
|---|---|---|---|
project_id / id | UUID | Unique project identifier | Primary key, auto-generated |
tenant_id | UUID | Associated tenant | Foreign key to Tenant |
entity_id | UUID | Owning organizational unit | Foreign key to Entity |
subsidiary_id | UUID | Associated subsidiary | Foreign key to Subsidiary |
name | String | Project display name | Required, max 255 chars |
code | String | Unique project code | Required, unique within tenant |
description | String | Detailed project description | Required |
status | ProjectStatus (Enum) | Current project state | Required |
priority | Priority (Enum) | Urgency level | Required |
project_type | ProjectType (Enum) | Category of work | Required |
owner_id | UUID | Project owner/sponsor | Foreign key to User |
manager_id | UUID | Project manager | Foreign key to User |
team_member_ids | Vec | Core team members | Array of User IDs |
start_date | DateTime | Planned start | Required |
end_date | DateTime | Planned end | Required |
actual_start_date | DateTime | Actual start | Tracked |
actual_end_date | DateTime | Actual completion | Tracked |
created_at | DateTime | Creation timestamp | Auto-set |
updated_at | DateTime | Last modification | Auto-updated |
created_by | UUID | Creating user | Foreign key to User |
archived | Boolean | Soft delete flag | Default: false |
enabled_extensions | Vec | Active extensions | Configurable |
Extended Fields (ProjectCore)​
Additional fields when full project data is needed:
| Field | Type | Description |
|---|---|---|
sponsor_id | UUID (Optional) | Executive sponsor |
team_ids | Vec | Associated teams |
timeline | ProjectTimeline | Detailed scheduling |
budget | Budget | Financial information |
technology_stack | Vec | Technologies used |
repository_ids | Vec | Code repositories |
compliance_requirements | Vec | Regulatory needs |
risk_tolerance | RiskTolerance | Risk appetite |
pmi_enabled | Boolean | PMI methodology active |
pmbok_version | String | PMBOK version used |
Enums and Types​
ProjectStatus​
enum ProjectStatus {
Draft, // Initial creation
Proposed, // Awaiting approval
Approved, // Approved, not started
Planning, // In planning phase
InProgress, // Active work
OnHold, // Temporarily paused
Completed, // Successfully finished
Cancelled, // Terminated early
Archived // Historical record
}
Priority​
enum Priority {
Critical, // Mission critical
High, // Important, urgent
Medium, // Standard priority
Low // Nice to have
}
ProjectType​
enum ProjectType {
Development, // Software development
Research, // R&D initiatives
Infrastructure, // System/platform work
Maintenance, // Ongoing support
Migration, // Data/system migration
Integration, // System integration
Custom(String) // Domain-specific
}
ExtensionType​
enum ExtensionType {
PMI, // PMI/PMBOK methodology
Agile, // Scrum/Kanban
Financial, // Advanced budgeting
Risk, // Risk management
Quality, // Quality management
Resource, // Resource planning
Integration, // External systems
Custom(String) // Custom extensions
}
Database Schema​
Primary Storage Patterns​
# Core project data
Key: /{tenant_id}/projects/{project_id}
Value: JSON serialized Project
# Extended project data (when using extensions)
Key: /{tenant_id}/projects/{project_id}/core
Value: JSON serialized ProjectCore
# Extension-specific data
Key: /{tenant_id}/projects/{project_id}/extensions/{extension_type}
Value: Extension-specific JSON
Secondary Indexes​
Code lookup: /{tenant_id}/project_by_code/{code} -> project_id
Entity projects: /{tenant_id}/projects_by_entity/{entity_id} -> [project_ids]
Manager projects: /{tenant_id}/projects_by_manager/{manager_id} -> [project_ids]
Status index: /{tenant_id}/projects_by_status/{status} -> [project_ids]
Extension Architecture​
PMI Extension​
When PMI extension is enabled:
{
"pmbok_version": "7th Edition",
"knowledge_areas": [...],
"process_groups": [...],
"project_charter": {...},
"wbs": {...},
"risk_register": [...]
}
Agile Extension​
When Agile extension is enabled:
{
"methodology": "Scrum",
"sprint_length": 14,
"current_sprint": 5,
"velocity": 32,
"backlog_items": [...],
"burn_down_data": [...]
}
Related Code​
Source Files​
- Core Model:
/src/models/project/core.rs - Project Core:
/src/models/project_core.rs - Extensions:
/src/models/project/extensions/- PMI:
pmi.rs - Agile:
agile.rs
- PMI:
- Repository:
/src/db/repositories/project_repository.rs - API Handler:
/src/api/handlers/project_handlers.rs - DTO:
/src/api/dto/project.rs
Key Methods​
impl Project {
fn new(tenant_id: Uuid, entity_id: Uuid, ...) -> Self
fn enable_extension(&mut self, extension: ExtensionType)
fn transition_status(&mut self, new_status: ProjectStatus) -> Result<()>
fn is_active(&self) -> bool
fn calculate_progress(&self) -> f32
}
Repository Operations​
trait ProjectRepository {
async fn create(&self, project: &Project) -> Result<()>
async fn get_by_id(&self, tenant_id: &Uuid, project_id: &Uuid) -> Result<Option<Project>>
async fn get_by_code(&self, tenant_id: &Uuid, code: &str) -> Result<Option<Project>>
async fn list_by_entity(&self, tenant_id: &Uuid, entity_id: &Uuid) -> Result<Vec<Project>>
async fn update(&self, project: &Project) -> Result<()>
async fn archive(&self, tenant_id: &Uuid, project_id: &Uuid) -> Result<()>
}
API Endpoints​
Create Project​
- POST
/api/projects - Body:
CreateProjectRequest - Response:
Project - Auth: Manager or Admin
Get Project​
- GET
/api/projects/{project_id} - Response:
ProjectorProjectCore(with extensions) - Auth: Team member or viewer
Update Project​
- PUT
/api/projects/{project_id} - Body:
UpdateProjectRequest - Response:
Project - Auth: Manager or Owner
List Projects​
- GET
/api/projects?entity_id={uuid}&status={status}&type={type} - Response:
Vec<ProjectSummary> - Auth: Any authenticated user
Project Dashboard​
- GET
/api/projects/{project_id}/dashboard - Response:
ProjectDashboard(metrics, progress, etc.) - Auth: Team member
Relationships​
Many-to-One​
- Tenant: Each project belongs to one tenant
- Entity: Each project owned by one entity
- Owner: Single user as owner/sponsor
- Manager: Single user as project manager
One-to-Many​
- Tasks: Project contains many tasks
- Members: Through project_members association
- Documents: Project-related files
- Workflows: Automated processes
Many-to-Many​
- Team Members: Users assigned to project
- Technologies: Tech stack associations
- Compliance: Regulatory requirements
Business Rules​
Project Lifecycle​
-
Creation
- Code must be unique within tenant
- Must have valid entity assignment
- Start date <= end date
- Manager must have appropriate role
-
Status Transitions
Draft -> Proposed -> Approved -> Planning -> InProgress -> Completed
| | | |
+-> Cancelled +-> OnHold +-> OnHold |
|
Archived -
Extension Management
- Extensions enabled per project
- Data isolated by extension type
- Can enable multiple extensions
- Extension-specific validation
-
Archival
- Soft delete only
- Preserves all relationships
- Removes from active queries
- Audit trail maintained
Performance Considerations​
Data Partitioning​
- Core data in main key
- Extensions in separate keys
- Enables selective loading
- Reduces payload size
Indexes Strategy​
- Code for unique lookups
- Entity for organizational views
- Manager for personal dashboards
- Status for workflow queries
Caching​
- Project summaries cached
- Extension configs cached
- Team member lists cached
- Frequently accessed projects in memory
Security Considerations​
-
Access Control
- Viewers: Read-only access
- Members: Read and contribute
- Managers: Full project control
- Owners: Strategic decisions
-
Data Isolation
- Tenant boundaries enforced
- Entity-level permissions
- Extension data segregated
- Audit all modifications
Example Usage​
Simple Development Project​
{
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"tenant_id": "8eba182c-2ad7-44c5-b0ab-5a1915b6b98a",
"name": "API Gateway Refactor",
"code": "PROJ-2024-001",
"project_type": "Development",
"status": "InProgress",
"priority": "High",
"enabled_extensions": ["Agile"]
}
Complex PMI Project​
{
"project_id": "456e7890-e89b-12d3-a456-426614174000",
"name": "Enterprise Digital Transformation",
"code": "EDT-2024",
"project_type": "Infrastructure",
"enabled_extensions": ["PMI", "Financial", "Risk", "Quality"],
"budget": {
"approved": 5000000,
"spent": 1250000,
"committed": 2100000
},
"risk_tolerance": "Medium"
}
Last Updated: 2025-08-29 Version: 1.0