updated appenders service
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from ApiControllers.abstracts.event_clusters import EventCluster, RouterCluster
|
||||
from .supers_events import (
|
||||
ServiceEndpointListEvent,
|
||||
ServiceEndpointToEventsEvent,
|
||||
)
|
||||
|
||||
ServiceEndpointRouterCluster = RouterCluster(name="ServiceEndpointRouterCluster")
|
||||
@@ -8,4 +9,10 @@ ServiceEndpointEventClusterList = EventCluster(
|
||||
name="ServiceList", endpoint_uu_id="f4e4d332-70b1-4121-9fcc-a08850b72aaa"
|
||||
)
|
||||
ServiceEndpointEventClusterList.add_event(ServiceEndpointListEvent)
|
||||
|
||||
ServiceEndpointEventClusterToService = EventCluster(
|
||||
name="ServiceToEvents", endpoint_uu_id="7b6b0c6a-e3db-4353-a7df-ea49d2a67f8a"
|
||||
)
|
||||
ServiceEndpointEventClusterToService.add_event(ServiceEndpointToEventsEvent)
|
||||
|
||||
ServiceEndpointRouterCluster.set_event_cluster(ServiceEndpointEventClusterList)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from ApiControllers.abstracts.event_clusters import Event
|
||||
from Controllers.Postgres.pagination import Pagination, PaginationResult, PaginateOnly
|
||||
from Controllers.Postgres.response import EndpointResponse
|
||||
from Schemas import Services
|
||||
from Schemas import Services, Service2Events
|
||||
|
||||
|
||||
# List endpoint
|
||||
@@ -27,8 +27,35 @@ def service_endpoint_list_callable(data: PaginateOnly):
|
||||
pagination = Pagination(data=services_list)
|
||||
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
|
||||
|
||||
# To events endpoint
|
||||
ServiceEndpointToEventsEvent = Event(
|
||||
name="service_endpoint_to_events",
|
||||
key="7b6b0c6a-e3db-4353-a7df-ea49d2a67f8a",
|
||||
request_validator=None, # TODO: Add request validator
|
||||
response_validator=None, # TODO: Add response validator
|
||||
description="Super Users List events of a service endpoint given service UUID",
|
||||
)
|
||||
|
||||
|
||||
def service_endpoint_to_events_callable(data: PaginateOnly):
|
||||
"""
|
||||
List events of a service given service UUID
|
||||
"""
|
||||
list_options = PaginateOnly(**data.model_dump())
|
||||
with Service2Events.new_session() as db_session:
|
||||
if data.query:
|
||||
services_list = Service2Events.filter_all_system(*Service2Events.convert(data.query), db=db_session)
|
||||
else:
|
||||
services_list = Service2Events.filter_all_system(db=db_session)
|
||||
pagination = Pagination(data=services_list)
|
||||
pagination.change(**data.model_dump())
|
||||
pagination_result = PaginationResult(data=services_list, pagination=pagination)
|
||||
return EndpointResponse(message="MSG0003-LIST", pagination_result=pagination_result).response
|
||||
|
||||
|
||||
ServiceEndpointToEventsEvent.event_callable = service_endpoint_to_events_callable
|
||||
|
||||
Reference in New Issue
Block a user