36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Project model."""
|
|
from sqlalchemy import Column, String, Integer, Text, DateTime, ForeignKey, Boolean
|
|
from app.models.base import Base, TimestampMixin, TenantMixin
|
|
|
|
|
|
class Project(Base, TimestampMixin, TenantMixin):
|
|
"""A project is the top-level business unit.
|
|
|
|
Lifecycle: draft -> planning -> in_progress -> review -> accepted -> archived
|
|
"""
|
|
__tablename__ = "projects"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
name = Column(String(300), nullable=False)
|
|
description = Column(Text, default="")
|
|
status = Column(String(50), nullable=False, default="draft")
|
|
|
|
# Owner (project manager)
|
|
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
|
|
# Timeline
|
|
start_date = Column(DateTime, nullable=True)
|
|
end_date = Column(DateTime, nullable=True)
|
|
|
|
# Budget (in cents to avoid float issues)
|
|
budget_limit_cents = Column(Integer, nullable=True)
|
|
|
|
# Acceptance criteria
|
|
acceptance_criteria = Column(Text, default="")
|
|
|
|
# Tags for categorization
|
|
tags = Column(String(500), default="")
|
|
|
|
def __repr__(self):
|
|
return f"<Project {self.name} [{self.status}]>"
|