alchemy updated
This commit is contained in:
@@ -38,11 +38,11 @@ class CompanyListEventMethods(MethodToEvent):
|
||||
]
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
Companies.pre_query = Companies.filter_active(
|
||||
Companies.pre_query = Companies.filter_all(
|
||||
Companies.id == token_dict.selected_occupant.responsible_company_id
|
||||
).query
|
||||
Companies.filter_attr = list_options
|
||||
records = Companies.filter_active(
|
||||
records = Companies.filter_all(
|
||||
*Companies.valid_record_args(Companies)
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
|
||||
@@ -30,8 +30,9 @@ class DepartmentListEventMethods(MethodToEvent):
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
Departments.filter_attr = list_options
|
||||
records = Departments.filter_active(
|
||||
records = Departments.filter_all(
|
||||
Departments.company_id == token_dict.selected_company.company_id,
|
||||
*Departments.valid_record_args(Departments)
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
completed=True,
|
||||
|
||||
@@ -64,9 +64,10 @@ class DutiesGetByUUIDEventMethods(MethodToEvent):
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
|
||||
records = Duties.filter_active(
|
||||
records = Duties.filter_all(
|
||||
Duties.duties_id == duty.id,
|
||||
Duties.company_id == token_dict.selected_company.company_id,
|
||||
*Duties.valid_record_args(Duties)
|
||||
)
|
||||
if not records.data:
|
||||
return JSONResponse(
|
||||
|
||||
@@ -28,9 +28,7 @@ class DutyListEventMethods(MethodToEvent):
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
Duty.filter_attr = list_options
|
||||
records = Duty.filter_active(
|
||||
*Duty.valid_record_args(Duty)
|
||||
)
|
||||
records = Duty.filter_all(system=True)
|
||||
return AlchemyJsonResponse(
|
||||
completed=True,
|
||||
message="Duty list is brought successfully",
|
||||
|
||||
@@ -29,9 +29,14 @@ class EmployeeListEventMethods(MethodToEvent):
|
||||
list_options: ListOptions,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
employees_staff = Staff.filter_all(
|
||||
Staff.duties_id.in_(token_dict.duty_id_list),
|
||||
*Staff.valid_record_args(Staff),
|
||||
).data
|
||||
Employees.filter_attr = list_options
|
||||
records = Employees.filter_active(
|
||||
Employees.company_id == token_dict.selected_company.company_id,
|
||||
records = Employees.filter_all(
|
||||
Employees.staff_id.in_([staff.id for staff in employees_staff]),
|
||||
*Employees.valid_record_args(Employees),
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
completed=True,
|
||||
@@ -210,7 +215,7 @@ class Employee2PeopleEmployEventMethods(MethodToEvent):
|
||||
detail="People record not found",
|
||||
)
|
||||
|
||||
find_one_employee = Employees.filter_active(
|
||||
find_one_employee = Employees.filter_all(
|
||||
Employees.staff_id == selected_staff.id,
|
||||
*Employees.valid_record_args(Employees),
|
||||
).data
|
||||
|
||||
@@ -25,7 +25,7 @@ class StaffListEventMethods(MethodToEvent):
|
||||
@classmethod
|
||||
def staff_list(cls, list_options: ListOptions, token_dict: EmployeeTokenObject):
|
||||
Staff.filter_attr = list_options
|
||||
records = Staff.filter_active(
|
||||
records = Staff.filter_all(
|
||||
*Staff.valid_record_args(Staff)
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
|
||||
Reference in New Issue
Block a user