"""library_categories 테이블 ORM — 자료실 분류 체계 독립 관리""" from datetime import datetime from sqlalchemy import BigInteger, Boolean, DateTime, Integer, Text from sqlalchemy.orm import Mapped, mapped_column from core.database import Base class LibraryCategory(Base): __tablename__ = "library_categories" id: Mapped[int] = mapped_column(BigInteger, primary_key=True) path: Mapped[str] = mapped_column(Text, unique=True, nullable=False) name: Mapped[str] = mapped_column(Text, nullable=False) parent_path: Mapped[str | None] = mapped_column(Text, nullable=True) depth: Mapped[int] = mapped_column(Integer, nullable=False, default=1) is_system: Mapped[bool] = mapped_column(Boolean, default=False) created_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), default=datetime.now ) updated_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), default=datetime.now, onupdate=datetime.now )