updated service binders updated

This commit is contained in:
2025-05-03 23:35:03 +03:00
parent ac8c3fe1c3
commit 01f3e82a54
82 changed files with 735 additions and 3371 deletions

View File

@@ -17,7 +17,21 @@ def init_service_to_event_matches_for_super_user(super_user, db_session=None) ->
db=db_session,
).data
list_of_all_events = Events.filter_all(db=db_session).data
Service2Events.filter_all(db=db_session).query.delete()
Service2Events.save(db=db_session)
for list_of_event_code in list_of_all_events:
service_to_event_found = Service2Events.filter_one_system(
Service2Events.event_id == list_of_event_code.id,
Service2Events.service_id == service_match.id,
db=db_session,
)
if service_to_event_found.data:
service_to_event_found.destroy(db=db_session)
print(
f"UUID: {service_to_event_found.uu_id} event is deleted from {service_match.uu_id}"
)
created_service = Service2Events.find_or_create(
service_id=service_match.id,
service_uu_id=str(service_match.uu_id),
@@ -32,6 +46,7 @@ def init_service_to_event_matches_for_super_user(super_user, db_session=None) ->
print(
f"UUID: {created_service.uu_id} event is saved to {service_match.uu_id}"
)
employee_added_service = Event2Employee.find_or_create(
event_service_id=service_match.id,

View File

@@ -5,6 +5,7 @@ from ApiControllers.providers.token_provider import TokenProvider
from Controllers.Postgres.pagination import PaginateOnly, Pagination, PaginationResult
from Controllers.Postgres.response import EndpointResponse
from Events.service_endpoints.cluster import ServiceEndpointRouterCluster
# Create API router

View File

@@ -72,7 +72,7 @@ def application_list_callable(list_options: PaginateOnly):
data=applications_list,
pagination=pagination,
# response_model="",
).pagination.as_dict
)
return EndpointResponse(
message="MSG0003-LIST",
pagination_result=pagination_result,

View File

@@ -14,29 +14,21 @@ ServiceEndpointListEvent = Event(
)
def service_endpoint_list_callable(list_options: PaginateOnly):
def service_endpoint_list_callable(data: PaginateOnly):
"""
Example callable method
List services endpoint callable method
"""
list_options = PaginateOnly(**list_options.model_dump())
list_options = PaginateOnly(**data.model_dump())
with Services.new_session() as db_session:
if list_options.query:
services_list = Services.filter_all(
*Services.convert(list_options.query), db=db_session
)
if data.query:
services_list = Services.filter_all_system(*Services.convert(data.query), db=db_session)
else:
services_list = Services.filter_all(db=db_session)
services_list = Services.filter_all_system(db=db_session)
pagination = Pagination(data=services_list)
pagination.change(**list_options.model_dump())
pagination_result = PaginationResult(
data=services_list,
pagination=pagination,
# response_model="",
).pagination.as_dict
return EndpointResponse(
message="MSG0003-LIST",
pagination_result=pagination_result,
).response
pagination.change(**data.model_dump())
pagination_result = PaginationResult(data=services_list, pagination=pagination)
print("service pagination_result", pagination_result)
return EndpointResponse(message="MSG0003-LIST", pagination_result=pagination_result).response
ServiceEndpointListEvent.event_callable = service_endpoint_list_callable