19 lines
No EOL
660 B
Python
19 lines
No EOL
660 B
Python
from typing import List, Optional
|
|
|
|
from sqlalchemy import Boolean, Unicode
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from sqlalchemy.sql import expression as sql
|
|
|
|
from crudkit.core.base import Base, CRUDMixin
|
|
|
|
class Area(Base, CRUDMixin):
|
|
__tablename__ = "area"
|
|
|
|
name: Mapped[Optional[str]] = mapped_column(Unicode(255), nullable=True, index=True)
|
|
|
|
rooms: Mapped[List['Room']] = relationship('Room', back_populates='area')
|
|
|
|
is_deleted: Mapped[Boolean] = mapped_column(Boolean, nullable=False, default=False, server_default=sql.false())
|
|
|
|
def __repr__(self):
|
|
return f"<Area(id={self.id}, name={repr(self.name)})>" |