inventory/models/room_functions.py
2025-06-11 09:10:41 -05:00

19 lines
No EOL
690 B
Python

from typing import List, Optional, TYPE_CHECKING
if TYPE_CHECKING:
from .rooms import Room
from sqlalchemy import Identity, Integer, Unicode
from sqlalchemy.orm import Mapped, mapped_column, relationship
from . import db
class RoomFunction(db.Model):
__tablename__ = 'Room Functions'
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
description: Mapped[Optional[str]] = mapped_column("Function", Unicode(255), nullable=True)
rooms: Mapped[List['Room']] = relationship('Room', back_populates='room_function')
def __repr__(self):
return f"<RoomFunction(id={self.id}, description={repr(self.description)})>"