25 lines
868 B
Python
25 lines
868 B
Python
"""用户工作量模型"""
|
|
from .base import BaseNoCreatedAt
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from sqlalchemy import BigInteger, Integer, DECIMAL, ForeignKey
|
|
|
|
|
|
class UserWorkload(BaseNoCreatedAt):
|
|
__tablename__ = "user_workloads"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
user_id: Mapped[int] = mapped_column(
|
|
BigInteger, ForeignKey("users.id"), nullable=False
|
|
)
|
|
current_assigned_hours: Mapped[float] = mapped_column(
|
|
DECIMAL(5, 2), nullable=False, default=0.0
|
|
)
|
|
max_available_hours_per_week: Mapped[float] = mapped_column(
|
|
DECIMAL(5, 2), nullable=False, default=40.0
|
|
)
|
|
workload_ratio: Mapped[float] = mapped_column(
|
|
DECIMAL(10, 2), nullable=False, default=0.0
|
|
)
|
|
|
|
user = relationship("User", back_populates="workload_rel")
|