update a few things
This commit is contained in:
+65
-12
@@ -1,31 +1,84 @@
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Float, Boolean
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
DateTime,
|
||||
ForeignKey,
|
||||
Integer,
|
||||
String,
|
||||
Float,
|
||||
Boolean,
|
||||
JSON,
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
Base = declarative_base()
|
||||
from database import Base
|
||||
|
||||
class Worker(Base):
|
||||
__tablename__ = "worker"
|
||||
name= Column(String)
|
||||
site= Column(String)
|
||||
grade= Column(Integer)
|
||||
id=Column(Integer, primary_key=True, index=True)
|
||||
fte= Column(Integer)
|
||||
nwds= Column(JSON)
|
||||
start_date= Column(DateTime)
|
||||
end_date= Column(DateTime)
|
||||
oop= Column(JSON)
|
||||
not_available_to_work= Column(JSON)
|
||||
pref_not_to_work= Column(JSON)
|
||||
work_requests= Column(JSON)
|
||||
remote_site= Column(String)
|
||||
previous_shifts= Column(JSON)
|
||||
shift_balance_extra=Column(JSON)
|
||||
bank_holiday_extra= Column(Integer)
|
||||
pair= Column(String)
|
||||
|
||||
class SingleShift(Base):
|
||||
__tablename__ = 'single_shift'
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
__tablename__ = "single_shift"
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String)
|
||||
length = Column(Float)
|
||||
days = Column(JSON)
|
||||
sites = Column(JSON)
|
||||
balance_offset = Column(Float, nullable=True)
|
||||
balance_weighting = Column(Float)
|
||||
workers_required = Column(Float)
|
||||
rota_on_nwds = Column(Boolean)
|
||||
assign_as_block = Column(Boolean)
|
||||
force_as_block = Column(Boolean)
|
||||
force_as_block_unless_nwd = Column(Boolean)
|
||||
hard_constrain_shift = Column(Boolean)
|
||||
bank_holidays_only = Column(Boolean)
|
||||
constraint_id = Column(Integer, ForeignKey('shift_constraint.id'))
|
||||
|
||||
constraint = relationship('ShiftConstraint')
|
||||
#constraint = relationship("ShiftConstraint", back_populates="shifts")
|
||||
constraint = Column(JSON)
|
||||
|
||||
# This should never be used from here (automatically created by the pydantic model)
|
||||
constraint_options = Column(JSON)
|
||||
constraints = Column(JSON)
|
||||
|
||||
#sites = relationship("Site", secondary="site_shift_link_table")
|
||||
|
||||
#class ShiftConstraint(Base):
|
||||
# __tablename__ = "shift_constraint"
|
||||
# id = Column(Integer, primary_key=True)
|
||||
# name = Column(String)
|
||||
# options = Column(Integer, nullable=True)
|
||||
#
|
||||
# shifts = relationship("SingleShift", back_populates="constraint")
|
||||
#
|
||||
# shift_id = Column(Integer, ForeignKey("single_shift.id"))
|
||||
|
||||
|
||||
class ShiftConstraint(Base):
|
||||
__tablename__ = 'shift_constraint'
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String)
|
||||
options = Column(Integer, nullable=True)
|
||||
#class SiteShiftLinkTable(Base):
|
||||
# __tablename__ = "site_shift_link_table"
|
||||
# shift_id = Column(Integer, ForeignKey("single_shift.id"), primary_key=True)
|
||||
# site_id = Column(Integer, ForeignKey("sites.id"), primary_key=True)
|
||||
|
||||
|
||||
#class Site(Base):
|
||||
# __tablename__ = "sites"
|
||||
# id = Column(Integer, primary_key=True)
|
||||
# name = Column(String)
|
||||
#
|
||||
# shifts = relationship(SingleShift, secondary="site_shift_link_table")
|
||||
|
||||
Reference in New Issue
Block a user