auth endpoints added
This commit is contained in:
@@ -66,13 +66,12 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
)
|
||||
list_match_company_id = []
|
||||
send_duties = Duties.filter_one(
|
||||
Duties.uu_id == data.duty_uu_id,
|
||||
db=db_session
|
||||
Duties.uu_id == data.duty_uu_id, db=db_session
|
||||
)
|
||||
send_user_duties = Duties.filter_one(
|
||||
Duties.duties_id == send_duties.id,
|
||||
Duties.company_id == token_duties_id,
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
if not send_user_duties:
|
||||
raise Exception(
|
||||
@@ -81,14 +80,13 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
for company_uu_id in list(data.match_company_uu_id):
|
||||
company = Companies.filter_one(
|
||||
Companies.uu_id == company_uu_id,
|
||||
db=db_session
|
||||
Companies.uu_id == company_uu_id, db=db_session
|
||||
)
|
||||
bulk_company = RelationshipDutyCompany.filter_one(
|
||||
RelationshipDutyCompany.owner_id == token_company_id,
|
||||
RelationshipDutyCompany.relationship_type == "Bulk",
|
||||
RelationshipDutyCompany.member_id == company.id,
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
if not bulk_company:
|
||||
raise Exception(
|
||||
@@ -105,7 +103,7 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
parent_id=match_company_id.parent_id,
|
||||
relationship_type="Commercial",
|
||||
show_only=False,
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -116,13 +114,12 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
)
|
||||
list_match_company_id = []
|
||||
send_duties = Duties.filter_one(
|
||||
Duties.uu_id == data.duty_uu_id,
|
||||
db=db_session
|
||||
Duties.uu_id == data.duty_uu_id, db=db_session
|
||||
)
|
||||
send_user_duties = Duties.filter_one(
|
||||
Duties.duties_id == send_duties.id,
|
||||
Duties.company_id == token_duties_id,
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
if not send_user_duties:
|
||||
raise Exception(
|
||||
@@ -131,14 +128,13 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
for company_uu_id in list(data.match_company_uu_id):
|
||||
company = Companies.filter_one(
|
||||
Companies.uu_id == company_uu_id,
|
||||
db=db_session
|
||||
Companies.uu_id == company_uu_id, db=db_session
|
||||
)
|
||||
bulk_company = RelationshipDutyCompany.filter_one(
|
||||
RelationshipDutyCompany.owner_id == token_company_id,
|
||||
RelationshipDutyCompany.relationship_type == "Bulk",
|
||||
RelationshipDutyCompany.member_id == company.id,
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
if not bulk_company:
|
||||
raise Exception(
|
||||
@@ -151,7 +147,7 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
Duties.init_a_company_default_duties(
|
||||
company_id=match_company_id.id,
|
||||
company_uu_id=str(match_company_id.uu_id),
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
RelationshipDutyCompany.find_or_create(
|
||||
owner_id=token_company_id,
|
||||
@@ -160,7 +156,7 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
parent_id=match_company_id.parent_id,
|
||||
relationship_type="Organization",
|
||||
show_only=False,
|
||||
db=db_session
|
||||
db=db_session,
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
@@ -236,4 +232,3 @@ class Companies(CrudCollection):
|
||||
Index("_company_ndx_02", formal_name, public_name),
|
||||
{"comment": "Company Information"},
|
||||
)
|
||||
|
||||
|
||||
@@ -13,12 +13,20 @@ class Staff(CrudCollection):
|
||||
__tablename__ = "staff"
|
||||
__exclude__fields__ = []
|
||||
|
||||
staff_description: Mapped[str] = mapped_column(String, server_default="", comment="Staff Description")
|
||||
staff_name: Mapped[str] = mapped_column(String, nullable=False, comment="Staff Name")
|
||||
staff_code: Mapped[str] = mapped_column(String, nullable=False, comment="Staff Code")
|
||||
staff_description: Mapped[str] = mapped_column(
|
||||
String, server_default="", comment="Staff Description"
|
||||
)
|
||||
staff_name: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Staff Name"
|
||||
)
|
||||
staff_code: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Staff Code"
|
||||
)
|
||||
|
||||
duties_id: Mapped[int] = mapped_column(ForeignKey("duties.id"), nullable=False)
|
||||
duties_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Duty UUID")
|
||||
duties_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Duty UUID"
|
||||
)
|
||||
|
||||
__table_args__ = ({"comment": "Staff Information"},)
|
||||
|
||||
@@ -29,9 +37,13 @@ class Employees(CrudCollection):
|
||||
__exclude__fields__ = []
|
||||
|
||||
staff_id: Mapped[int] = mapped_column(ForeignKey("staff.id"))
|
||||
staff_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Staff UUID")
|
||||
staff_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Staff UUID"
|
||||
)
|
||||
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=True)
|
||||
people_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="People UUID")
|
||||
people_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="People UUID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("employees_ndx_00", people_id, staff_id, unique=True),
|
||||
@@ -44,10 +56,18 @@ class EmployeeHistory(CrudCollection):
|
||||
__tablename__ = "employee_history"
|
||||
__exclude__fields__ = []
|
||||
|
||||
staff_id: Mapped[int] = mapped_column(ForeignKey("staff.id"), nullable=False, comment="Staff ID")
|
||||
staff_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Staff UUID")
|
||||
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=False, comment="People ID")
|
||||
people_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="People UUID")
|
||||
staff_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("staff.id"), nullable=False, comment="Staff ID"
|
||||
)
|
||||
staff_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Staff UUID"
|
||||
)
|
||||
people_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("people.id"), nullable=False, comment="People ID"
|
||||
)
|
||||
people_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="People UUID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("_employee_history_ndx_00", people_id, staff_id),
|
||||
@@ -67,7 +87,9 @@ class EmployeesSalaries(CrudCollection):
|
||||
Numeric(20, 6), nullable=False, comment="Net Salary"
|
||||
)
|
||||
people_id: Mapped[int] = mapped_column(ForeignKey("people.id"), nullable=False)
|
||||
people_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="People UUID")
|
||||
people_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="People UUID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("_employee_salaries_ndx_00", people_id, "expiry_starts"),
|
||||
|
||||
Reference in New Issue
Block a user