fix: fixed shifts time tracking
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime, date
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from sqlalchemy import ForeignKey, Table, Column
|
||||
from sqlalchemy.sql import expression
|
||||
@@ -15,12 +15,8 @@ class WorkShift(BaseModel):
|
||||
__tablename__ = "work_shifts"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
started_at: Mapped[datetime] = mapped_column(
|
||||
nullable=False,
|
||||
)
|
||||
finished_at: Mapped[datetime] = mapped_column(
|
||||
nullable=True,
|
||||
)
|
||||
started_at: Mapped[datetime] = mapped_column()
|
||||
finished_at: Mapped[Optional[datetime]] = mapped_column()
|
||||
is_paused: Mapped[bool] = mapped_column(
|
||||
default=False,
|
||||
server_default=expression.false(),
|
||||
@@ -48,12 +44,8 @@ class WorkShiftPause(BaseModel):
|
||||
__tablename__ = "work_shifts_pauses"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
started_at: Mapped[datetime] = mapped_column(
|
||||
nullable=False,
|
||||
)
|
||||
finished_at: Mapped[datetime] = mapped_column(
|
||||
nullable=True,
|
||||
)
|
||||
started_at: Mapped[datetime] = mapped_column()
|
||||
finished_at: Mapped[Optional[datetime]] = mapped_column()
|
||||
|
||||
work_shift_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("work_shifts.id"),
|
||||
@@ -77,10 +69,10 @@ class PlannedWorkShift(BaseModel):
|
||||
__tablename__ = "planned_work_shifts"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
shift_date: Mapped[date] = mapped_column(nullable=False, index=True)
|
||||
created_at: Mapped[datetime] = mapped_column(nullable=False)
|
||||
shift_date: Mapped[date] = mapped_column(index=True)
|
||||
created_at: Mapped[datetime] = mapped_column()
|
||||
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), nullable=False, index=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), index=True)
|
||||
user: Mapped["User"] = relationship(lazy="selectin", backref="planned_work_shifts")
|
||||
|
||||
positions: Mapped[list["Position"]] = relationship(
|
||||
|
||||
Reference in New Issue
Block a user