Initial commit
This commit is contained in:
25
backend/app/models/system.py
Normal file
25
backend/app/models/system.py
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
"""
|
||||
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}')>"
|
||||
Reference in New Issue
Block a user