events are updated
This commit is contained in:
@@ -13,7 +13,7 @@ from api_validations.validations_request import InsertPerson, UpdateUsers
|
||||
|
||||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||
from api_validations.core_response import return_json_response_from_alchemy
|
||||
from api_validations.core_response import AlchemyJsonResponse
|
||||
|
||||
|
||||
class PeopleListEventMethods(MethodToEvent):
|
||||
@@ -31,23 +31,31 @@ class PeopleListEventMethods(MethodToEvent):
|
||||
records = People.filter_active(
|
||||
*People.get_smart_query(smart_query=list_options.query)
|
||||
)
|
||||
return return_json_response_from_alchemy(
|
||||
response=records, pagination=list_options
|
||||
return AlchemyJsonResponse(
|
||||
completed=True,
|
||||
message="People are listed successfully",
|
||||
result=records,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def sales_users_people_list(cls, data, token_dict):
|
||||
|
||||
records = People.filter_active(*People.get_smart_query(smart_query=data.query))
|
||||
# records = [model_class(**record) for record in records.data]
|
||||
return return_json_response_from_alchemy(response=records, pagination=data)
|
||||
return AlchemyJsonResponse(
|
||||
completed=True,
|
||||
message="People are listed successfully",
|
||||
result=records,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def human_resources_users_people_list(cls, data, token_dict):
|
||||
|
||||
records = People.filter_active(*People.get_smart_query(smart_query=data.query))
|
||||
# records = [model_class(**record) for record in records.data]
|
||||
return return_json_response_from_alchemy(response=records, pagination=data)
|
||||
return AlchemyJsonResponse(
|
||||
completed=True,
|
||||
message="People are listed successfully",
|
||||
result=records,
|
||||
)
|
||||
|
||||
|
||||
class PeopleCreateEventMethods(MethodToEvent):
|
||||
@@ -91,7 +99,7 @@ class PeopleUpdateEventMethods(MethodToEvent):
|
||||
):
|
||||
find_one_user = Users.find_one_or_abort(uu_id=user_uu_id)
|
||||
access_authorized_company = Companies.select_action(
|
||||
duty_id=getattr(token_dict, "duty_id", 5),
|
||||
duty_id_list=[getattr(token_dict, "duty_id")],
|
||||
filter_expr=[Companies.id == find_one_user.id],
|
||||
)
|
||||
if access_authorized_company.count:
|
||||
|
||||
Reference in New Issue
Block a user