/
rnj
/
SuaiTestBot
Обзор
Документация
Войти
/
rnj
/
SuaiTestBot
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
model/lesson.py
31 строка
1 KB
Dmitriy Pozdeev
init commit
03 июн 2026, 23:58
03 июн 2026, 23:58
110bad2
Код
Авторство
О чём код?
from sqlalchemy import ForeignKey, Integer, String from sqlalchemy.orm import Mapped, mapped_column, relationship from database.database import Base LESSON_TYPES = ("lecture", "practice", "laboratory") class Lesson(Base): __tablename__ = "lessons" id: Mapped[int] = mapped_column(primary_key=True) week_type: Mapped[str] = mapped_column(String(10), nullable=False) # blue | red day_of_week: Mapped[int] = mapped_column(Integer, nullable=False) # 0=пн … 5=сб slot_number: Mapped[int] = mapped_column(Integer, nullable=False) # 1–7 room: Mapped[str] = mapped_column(String(20), nullable=False) lesson_type: Mapped[str] = mapped_column(String(20), nullable=False) discipline_id: Mapped[int] = mapped_column(ForeignKey("disciplines.id"), nullable=False) teacher_id: Mapped[int] = mapped_column(ForeignKey("teachers.id"), nullable=False) discipline: Mapped["Discipline"] = relationship(back_populates="lessons") teacher: Mapped["Teacher"] = relationship(back_populates="lessons") group_links: Mapped[list["LessonGroup"]] = relationship( back_populates="lesson", cascade="all, delete-orphan" ) def __repr__(self) -> str: return ( f"Lesson(id={self.id}, week={self.week_type}, " f"day={self.day_of_week}, slot={self.slot_number})" )