26 lines
826 B
Python
26 lines
826 B
Python
|
|
"""
|
|
System Model - ServiceManagerWeb
|
|
"""
|
|
from sqlalchemy import String, Text, Boolean
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from typing import List, Optional
|
|
import uuid
|
|
|
|
from app.core.database import Base
|
|
|
|
class System(Base):
|
|
__tablename__ = "systems"
|
|
|
|
name: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
description: Mapped[Optional[str]] = mapped_column(Text)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
|
|
# Relationships
|
|
# If we want tickets to link to systems, we will add relationship in Ticket later or now.
|
|
# We will assume Ticket links to System.
|
|
tickets: Mapped[List["Ticket"]] = relationship("Ticket", back_populates="system")
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<System(id={self.id}, name='{self.name}')>"
|