events updated
This commit is contained in:
@@ -87,9 +87,7 @@ class CompanyUpdateEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def company_update(
|
||||
cls,
|
||||
company_uu_id: str,
|
||||
data: UpdateCompany, token_dict: EmployeeTokenObject
|
||||
cls, company_uu_id: str, data: UpdateCompany, token_dict: EmployeeTokenObject
|
||||
):
|
||||
Companies.pre_query = Companies.select_action(
|
||||
duty_id_list=[
|
||||
@@ -106,7 +104,7 @@ class CompanyUpdateEventMethods(MethodToEvent):
|
||||
content={
|
||||
"completed": True,
|
||||
"message": "Update Company record",
|
||||
"data": {}
|
||||
"data": {},
|
||||
},
|
||||
status_code=200,
|
||||
)
|
||||
@@ -131,7 +129,7 @@ class CompanyPatchEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def company_patch(
|
||||
cls, company_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject
|
||||
cls, company_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject
|
||||
):
|
||||
find_one_company = Companies.find_one_or_abort(uu_id=company_uu_id)
|
||||
access_authorized_company = Companies.select_action(
|
||||
@@ -169,6 +167,7 @@ class CompanyPatchEventMethods(MethodToEvent):
|
||||
status_code=status.HTTP_200_OK,
|
||||
)
|
||||
|
||||
|
||||
CompanyPatchEventMethod = CompanyListEventMethods(
|
||||
action=ActionsSchema(endpoint="/company/list")
|
||||
)
|
||||
|
||||
@@ -59,7 +59,9 @@ class DepartmentCreateEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def super_user_department_create(
|
||||
cls, data: DepartmentsPydantic, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
data: DepartmentsPydantic,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
data_dict = data.excluded_dump()
|
||||
data_dict["company_id"] = token_dict.selected_company.company_id
|
||||
@@ -85,7 +87,10 @@ class DepartmentUpdateEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def department_update(
|
||||
cls, company_uu_id: str, data: DepartmentsPydantic, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
company_uu_id: str,
|
||||
data: DepartmentsPydantic,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
find_one_company = Departments.filter_one(Departments.uu_id == company_uu_id)
|
||||
access_authorized_company = Departments.select_action(
|
||||
@@ -119,7 +124,7 @@ class DepartmentPatchEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def department_patch(
|
||||
cls, company_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject
|
||||
cls, company_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject
|
||||
):
|
||||
find_one_company = Departments.find_one_or_abort(uu_id=company_uu_id)
|
||||
access_authorized_company = Departments.select_action(
|
||||
|
||||
@@ -143,10 +143,10 @@ class DutiesUpdateEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def duties_update(
|
||||
cls,
|
||||
duties_uu_id: str,
|
||||
data: UpdateDuties,
|
||||
token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
duties_uu_id: str,
|
||||
data: UpdateDuties,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
find_one_duties = Duties.find_one_or_abort(uu_id=duties_uu_id)
|
||||
access_authorized_duties = Duties.select_action(
|
||||
@@ -178,7 +178,10 @@ class DutiesPatchEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def duties_patch(
|
||||
cls, duties_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
duties_uu_id: str,
|
||||
data: PatchRecord,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
find_one_duties = Duties.find_one_or_abort(uu_id=duties_uu_id)
|
||||
access_authorized_duties = Duties.select_action(
|
||||
|
||||
@@ -108,7 +108,10 @@ class DutyPatchEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def duty_patch(
|
||||
cls, company_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
company_uu_id: str,
|
||||
data: PatchRecord,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
find_one_company = Duty.find_one_or_abort(uu_id=company_uu_id)
|
||||
access_authorized_company = Duty.select_action(
|
||||
|
||||
@@ -97,7 +97,10 @@ class EmployeeUpdateEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def employee_update(
|
||||
cls, employee_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
employee_uu_id: str,
|
||||
data: PatchRecord,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
find_one_employee = Employees.filter_one(
|
||||
Employees.uu_id == employee_uu_id,
|
||||
@@ -186,7 +189,9 @@ class Employee2PeopleEmployEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def company_employee_employ(
|
||||
cls, data: BindEmployees2People, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
data: BindEmployees2People,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
selected_staff = Staff.filter_one(
|
||||
Staff.uu_id == data.staff_uu_id,
|
||||
@@ -250,7 +255,9 @@ class Employee2PeopleFireEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def company_employee_fire(
|
||||
cls, data: BindEmployees2People, token_dict: EmployeeTokenObject,
|
||||
cls,
|
||||
data: BindEmployees2People,
|
||||
token_dict: EmployeeTokenObject,
|
||||
):
|
||||
selected_people = People.filter_one(
|
||||
People.uu_id == data.people_uu_id,
|
||||
|
||||
@@ -23,9 +23,7 @@ class StaffListEventMethods(MethodToEvent):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def staff_list(
|
||||
cls, list_options: ListOptions, token_dict: EmployeeTokenObject
|
||||
):
|
||||
def staff_list(cls, list_options: ListOptions, token_dict: EmployeeTokenObject):
|
||||
Staff.filter_attr = list_options
|
||||
records = Staff.filter_active(
|
||||
*Staff.get_smart_query(smart_query=list_options.query),
|
||||
@@ -44,9 +42,7 @@ class StaffCreateEventMethods(MethodToEvent):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def staff_create(
|
||||
cls, data: InsertStaff, token_dict: EmployeeTokenObject
|
||||
):
|
||||
def staff_create(cls, data: InsertStaff, token_dict: EmployeeTokenObject):
|
||||
data_dict = data.excluded_dump()
|
||||
duties = Duties.filter_one(
|
||||
Duties.uu_id == data.duties_uu_id,
|
||||
@@ -78,9 +74,7 @@ class StaffGetByUUIDEventMethods(MethodToEvent):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def staff_get_by_uu_id(
|
||||
cls, data: SelectStaff, token_dict: EmployeeTokenObject
|
||||
):
|
||||
def staff_get_by_uu_id(cls, data: SelectStaff, token_dict: EmployeeTokenObject):
|
||||
if data.duties_uu_id:
|
||||
duties_id = Duties.filter_one(
|
||||
Duties.uu_id == data.duties_uu_id, *Duties.valid_record_args(Duties)
|
||||
@@ -117,9 +111,7 @@ class StaffUpdateEventMethods(MethodToEvent):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def staff_update(
|
||||
cls, staff_uu_id: str, data, token_dict: EmployeeTokenObject
|
||||
):
|
||||
def staff_update(cls, staff_uu_id: str, data, token_dict: EmployeeTokenObject):
|
||||
return JSONResponse(
|
||||
content={"completed": True, "message": "Update Staff record", "data": {}},
|
||||
status_code=status.HTTP_200_OK,
|
||||
@@ -135,7 +127,7 @@ class StaffPatchEventMethods(MethodToEvent):
|
||||
|
||||
@classmethod
|
||||
def staff_patch(
|
||||
cls, staff_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject
|
||||
cls, staff_uu_id: str, data: PatchRecord, token_dict: EmployeeTokenObject
|
||||
):
|
||||
return JSONResponse(
|
||||
content={
|
||||
|
||||
Reference in New Issue
Block a user