event and service sendpoints added
This commit is contained in:
@@ -5,9 +5,7 @@ from ApiControllers.providers.token_provider import TokenProvider
|
||||
|
||||
from Controllers.Postgres.pagination import PaginateOnly, Pagination, PaginationResult
|
||||
from Controllers.Postgres.response import EndpointResponse
|
||||
from Schemas import (
|
||||
Applications
|
||||
)
|
||||
from Schemas import Applications
|
||||
from Validations.application.validations import (
|
||||
RequestApplication,
|
||||
)
|
||||
@@ -71,7 +69,7 @@ def application_create_route(
|
||||
Applications.application_code == data.application_code,
|
||||
Applications.site_url == data.site_url,
|
||||
]
|
||||
**created_application_dict
|
||||
** created_application_dict,
|
||||
)
|
||||
if created_application.meta_data.created:
|
||||
return EndpointResponse(
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
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
|
||||
from Validations.service_endpoints.validations import Event2Employee, Event2Occupant
|
||||
|
||||
# Create API router
|
||||
event_endpoint_route = APIRouter(prefix="/events", tags=["Event Actions"])
|
||||
|
||||
|
||||
@event_endpoint_route.post(
|
||||
path="/list",
|
||||
description="List events endpoint",
|
||||
operation_id="0659d5e4-671f-466c-a84f-47a1290a6f0d",
|
||||
)
|
||||
def event_list_route(
|
||||
data: PaginateOnly,
|
||||
headers: CommonHeaders = Depends(CommonHeaders.as_dependency),
|
||||
):
|
||||
"""
|
||||
List events 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 = EventEndpointRouterCluster.get_event_cluster("EventList")
|
||||
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||
return event_cluster_matched.event_callable(data=data)
|
||||
|
||||
|
||||
@event_endpoint_route.post(
|
||||
path="/bind/employee",
|
||||
description="Bind event to employee endpoint",
|
||||
operation_id="",
|
||||
)
|
||||
def event_bind_employee_route(
|
||||
data: Event2Employee,
|
||||
headers: CommonHeaders = Depends(CommonHeaders.as_dependency),
|
||||
):
|
||||
"""
|
||||
Bind event to employee
|
||||
"""
|
||||
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 = EventEndpointRouterCluster.get_event_cluster("EventBindEmployee")
|
||||
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||
return event_cluster_matched.event_callable(data=data)
|
||||
|
||||
|
||||
@event_endpoint_route.post(
|
||||
path="/bind/occupant",
|
||||
description="Bind event to occupant endpoint",
|
||||
operation_id="",
|
||||
)
|
||||
def event_bind_occupant_route(
|
||||
data: Event2Occupant,
|
||||
headers: CommonHeaders = Depends(CommonHeaders.as_dependency),
|
||||
):
|
||||
"""
|
||||
Bind event to occupant
|
||||
"""
|
||||
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 = EventEndpointRouterCluster.get_event_cluster("EventBindOccupant")
|
||||
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||
return event_cluster_matched.event_callable(data=data)
|
||||
@@ -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)
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
from Schemas import (
|
||||
Services,
|
||||
Employees,
|
||||
Event2Employee,
|
||||
Users,
|
||||
Events,
|
||||
Service2Events,
|
||||
Applications,
|
||||
Application2Employee,
|
||||
Application2Occupant,
|
||||
)
|
||||
from Validations.application.validations import (
|
||||
RequestApplication,
|
||||
)
|
||||
|
||||
# Create API router
|
||||
service_management_route = APIRouter(
|
||||
prefix="/managements/service", tags=["Service Management"]
|
||||
)
|
||||
Reference in New Issue
Block a user