services updated

This commit is contained in:
2025-03-25 10:43:25 +03:00
parent 92942af6f3
commit 79028493a9
298 changed files with 23435 additions and 5 deletions

View File

@@ -0,0 +1,39 @@
from fastapi import APIRouter
import uuid
from Events.Engine.abstract_class import CategoryCluster, MethodToEvent
class CreateRouterFromCluster:
def __init__(self, **kwargs):
self.prefix = kwargs.get("prefix")
self.tags = kwargs.get("tags")
self.include_in_schema = bool(kwargs.get("include_in_schema", True))
self.router = APIRouter(
prefix=self.prefix, tags=self.tags, include_in_schema=self.include_in_schema
)
class CreateEndpointFromCluster:
def __init__(self, **kwargs):
self.router: CategoryCluster = kwargs.get("router")
self.method_endpoint: MethodToEvent = kwargs.get("method_endpoint")
self.attach_router()
def attach_router(self):
method = getattr(self.router, self.method_endpoint.METHOD.lower())
# Create a unique operation ID based on the endpoint path, method, and a unique identifier
kwargs = {
"path": self.method_endpoint.URL,
"summary": self.method_endpoint.SUMMARY,
"description": self.method_endpoint.DESCRIPTION,
}
if (
hasattr(self.method_endpoint, "RESPONSE_MODEL")
and self.method_endpoint.RESPONSE_MODEL is not None
):
kwargs["response_model"] = self.method_endpoint.RESPONSE_MODEL
method(**kwargs)(self.method_endpoint.endpoint_callable)

View File

@@ -0,0 +1,4 @@
from Services.Redis import RedisActions, AccessToken
from Services.Redis.Models.cluster import RedisList
redis_list = RedisList(redis_key="test")