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

@@ -17,7 +17,6 @@ from api_events.events.abstract_class import MethodToEvent, ActionsSchema
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
class DutiesListEventMethods(MethodToEvent):
event_type = "SELECT"
@@ -27,12 +26,14 @@ class DutiesListEventMethods(MethodToEvent):
@classmethod
def duties_list(
cls, list_options: ListOptions, token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
cls,
list_options: ListOptions,
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
):
Duties.filter_attr = list_options
records = Duties.filter_all(
*Duties.get_smart_query(smart_query=list_options.query),
Duties.company_id == token_dict.selected_company.company_id
Duties.company_id == token_dict.selected_company.company_id,
)
return {
"completed": True if records.count else False,
@@ -50,10 +51,12 @@ class DutiesGetByUUIDEventMethods(MethodToEvent):
@classmethod
def duties_get_by_uuid(
cls, data: SelectDuties, token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
cls,
data: SelectDuties,
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
):
duty = Duty.filter_one(Duty.uu_id==data.duty_uu_id).data
duty = Duty.filter_one(Duty.uu_id == data.duty_uu_id).data
if not duty:
return JSONResponse(
content={
@@ -93,10 +96,12 @@ class DutiesCreateEventMethods(MethodToEvent):
@classmethod
def duties_create(
cls, data: InsertDuties, token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
cls,
data: InsertDuties,
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
):
duty = Duty.filter_one(Duty.uu_id==data.duties_uu_id).data
department = Departments.filter_one(Duty.uu_id==data.department_uu_id).data
duty = Duty.filter_one(Duty.uu_id == data.duties_uu_id).data
department = Departments.filter_one(Duty.uu_id == data.department_uu_id).data
created_duties = Duties.find_or_create(
company_id=token_dict.selected_company.company_id,