44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
"""账号、定时配置和调度状态。不保存每节课的实时记录。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import Boolean, DateTime, String, Text
|
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
|
|
|
|
class Base(DeclarativeBase):
|
|
pass
|
|
|
|
|
|
class Account(Base):
|
|
__tablename__ = "accounts"
|
|
|
|
employee_id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
cn_name: Mapped[str] = mapped_column(String(64), default="")
|
|
department_name: Mapped[str] = mapped_column(String(128), default="")
|
|
level_name: Mapped[str] = mapped_column(String(64), default="")
|
|
email: Mapped[str] = mapped_column(String(128), default="")
|
|
password_cipher: Mapped[str] = mapped_column(Text)
|
|
actual_study_hour: Mapped[str] = mapped_column(String(32), default="")
|
|
actual_study_score: Mapped[str] = mapped_column(String(32), default="")
|
|
points: Mapped[str] = mapped_column(String(32), default="")
|
|
today_hours: Mapped[str] = mapped_column(String(32), default="")
|
|
today_score: Mapped[str] = mapped_column(String(32), default="")
|
|
today: Mapped[str] = mapped_column(String(16), default="")
|
|
class_count: Mapped[str] = mapped_column(String(16), default="")
|
|
last_login_at: Mapped[datetime] = mapped_column(DateTime)
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime)
|
|
|
|
|
|
class Schedule(Base):
|
|
__tablename__ = "schedules"
|
|
|
|
employee_id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
run_time: Mapped[str] = mapped_column(String(5), default="08:00")
|
|
enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
status: Mapped[str] = mapped_column(String(16), default="idle")
|
|
last_run_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
|
last_message: Mapped[str] = mapped_column(String(255), default="")
|