refactor: split tasks/supports/meetings into separate tables
This commit is contained in:
38
app/models/support.py
Normal file
38
app/models/support.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, Enum
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
from app.core.config import Base
|
||||
import enum
|
||||
|
||||
class SupportStatus(str, enum.Enum):
|
||||
OPEN = "open"
|
||||
IN_PROGRESS = "in_progress"
|
||||
RESOLVED = "resolved"
|
||||
CLOSED = "closed"
|
||||
|
||||
class SupportPriority(str, enum.Enum):
|
||||
LOW = "low"
|
||||
MEDIUM = "medium"
|
||||
HIGH = "high"
|
||||
CRITICAL = "critical"
|
||||
|
||||
class Support(Base):
|
||||
__tablename__ = "supports"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
title = Column(String(255), nullable=False)
|
||||
description = Column(Text, nullable=True)
|
||||
status = Column(Enum(SupportStatus), default=SupportStatus.OPEN)
|
||||
priority = Column(Enum(SupportPriority), default=SupportPriority.MEDIUM)
|
||||
|
||||
project_id = Column(Integer, ForeignKey("projects.id"), nullable=False)
|
||||
milestone_id = Column(Integer, ForeignKey("milestones.id"), nullable=False)
|
||||
reporter_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
assignee_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
|
||||
reporter = relationship("User", foreign_keys=[reporter_id])
|
||||
assignee = relationship("User", foreign_keys=[assignee_id])
|
||||
Reference in New Issue
Block a user