created design pattern
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from fastapi import Header, Depends, Request, Response
|
||||
from fastapi import Header, Request, Response
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ApiDefaults.config import api_config
|
||||
@@ -12,6 +12,10 @@ class CommonHeaders(BaseModel):
|
||||
request: Request | None = None
|
||||
response: Response | None = None
|
||||
operation_id: str | None = None
|
||||
|
||||
model_config = {
|
||||
"arbitrary_types_allowed": True
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def as_dependency(
|
||||
|
||||
@@ -33,13 +33,11 @@ class EventCluster:
|
||||
from Schemas import Events, EndpointRestriction
|
||||
|
||||
with Events.new_session() as db_session:
|
||||
print(f"Endpoint UUID: {self.endpoint_uu_id}")
|
||||
if to_save_endpoint := EndpointRestriction.filter_one(
|
||||
EndpointRestriction.operation_uu_id == self.endpoint_uu_id,
|
||||
db=db_session,
|
||||
).data:
|
||||
for event in self.events:
|
||||
print(f"event:", event.name)
|
||||
event_to_save_database = Events.find_or_create(
|
||||
function_code=event.key,
|
||||
function_class=event.name,
|
||||
@@ -109,6 +107,7 @@ class RouterCluster:
|
||||
"""
|
||||
Add an event cluster to the set
|
||||
"""
|
||||
print("Setting event cluster:", event_cluster.name)
|
||||
if event_cluster.name not in self.event_clusters:
|
||||
self.event_clusters[event_cluster.name] = event_cluster
|
||||
|
||||
|
||||
Reference in New Issue
Block a user