event and service sendpoints added

This commit is contained in:
2025-04-30 18:19:31 +03:00
parent 36e63960f8
commit e815251123
24 changed files with 441 additions and 79 deletions

View File

@@ -0,0 +1,31 @@
from fastapi import APIRouter, Depends
from ApiControllers.abstracts.default_validations import CommonHeaders
from ApiControllers.providers.token_provider import TokenProvider
from Controllers.Postgres.pagination import PaginateOnly, Pagination, PaginationResult
from Controllers.Postgres.response import EndpointResponse
# Create API router
service_endpoint_route = APIRouter(prefix="/service", tags=["Service Actions"])
@service_endpoint_route.post(
path="/list",
description="List services endpoint",
operation_id="f4e4d332-70b1-4121-9fcc-a08850b72aaa",
)
def service_list_route(
data: PaginateOnly,
headers: CommonHeaders = Depends(CommonHeaders.as_dependency),
):
"""
List services with pagination and filtering options
"""
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
FoundCluster = ServiceEndpointRouterCluster.get_event_cluster("ServiceList")
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
return event_cluster_matched.event_callable(data=data)