services are checked

This commit is contained in:
2024-11-08 17:14:02 +03:00
parent a5b1e0b2f4
commit c5b771e5cb
82 changed files with 1720 additions and 869 deletions

View File

@@ -1,5 +1,5 @@
from sqlalchemy import String, Integer, ForeignKey, Index, Boolean
from sqlalchemy.orm import mapped_column
from sqlalchemy import String, Integer, ForeignKey, Index, Boolean, Identity
from sqlalchemy.orm import mapped_column, Mapped
from databases.sql_models.core_mixin import CrudCollection
@@ -13,13 +13,17 @@ class Departments(CrudCollection):
department_code = mapped_column(
String(16), nullable=False, index=True, comment="Department Code"
)
department_name = mapped_column(
department_name: Mapped[str] = mapped_column(
String(128), nullable=False, comment="Department Name"
)
department_description = mapped_column(String, server_default="")
department_description: Mapped[str] = mapped_column(String, server_default="")
company_id = mapped_column(ForeignKey("companies.id"), nullable=False)
company_uu_id = mapped_column(String, nullable=False, comment="Company UUID")
company_id: Mapped[Identity] = mapped_column(
ForeignKey("companies.id"), nullable=False
)
company_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Company UUID"
)
# @classmethod
# def create_action(cls, data: DepartmentsPydantic, token):
@@ -35,9 +39,11 @@ class Duty(CrudCollection):
__tablename__ = "duty"
__exclude__fields__ = []
duty_name = mapped_column(String, unique=True, nullable=False, comment="Duty Name")
duty_code = mapped_column(String, nullable=False, comment="Duty Code")
duty_description = mapped_column(String, comment="Duty Description")
duty_name: Mapped[str] = mapped_column(
String, unique=True, nullable=False, comment="Duty Name"
)
duty_code: Mapped[str] = mapped_column(String, nullable=False, comment="Duty Code")
duty_description: Mapped[str] = mapped_column(String, comment="Duty Description")
# @classmethod
# def create_action(cls, data: InsertCompanyDuty, token):
@@ -60,15 +66,21 @@ class Duties(CrudCollection):
users_default_duty = mapped_column(
ForeignKey("duty.id"), nullable=True, comment="Default Duty for Users"
)
company_id = mapped_column(Integer)
company_uu_id = mapped_column(String, nullable=False, comment="Company UUID")
duties_id = mapped_column(ForeignKey("duty.id"), nullable=False)
duties_uu_id = mapped_column(String, nullable=False, comment="Duty UUID")
company_id: Mapped[int] = mapped_column(Integer)
company_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Company UUID"
)
duties_id: Mapped[Identity] = mapped_column(ForeignKey("duty.id"), nullable=False)
duties_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Duty UUID"
)
department_id = mapped_column(
ForeignKey("departments.id"), nullable=False, comment="Department ID"
)
department_uu_id = mapped_column(String, nullable=False, comment="Department UUID")
# priority_id = mapped_column(ForeignKey("priority.id"), nullable=True)
department_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Department UUID"
)
# priority_id: Mapped[Identity] = mapped_column(ForeignKey("priority.id"), nullable=True)
management_duty = mapped_column(
Boolean, server_default="0"
) # is this a prime Company Duty ???