event file updated
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from Events.Engine.abstract_class import Event
|
||||
from ApiLayers.LanguageModels.Request import (
|
||||
LoginRequestLanguageModel,
|
||||
)
|
||||
|
||||
from models import TemplateResponseModels, TemplateRequestModels
|
||||
from function_handlers import TemplateFunctions
|
||||
|
||||
|
||||
# Auth Login
|
||||
template_event = Event(
|
||||
name="authentication_login_super_user_event",
|
||||
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
|
||||
request_validator=TemplateRequestModels.TemplateRequestModelX,
|
||||
language_models=[LoginRequestLanguageModel],
|
||||
response_validation_static="LOGIN_SUCCESS",
|
||||
description="Login super user",
|
||||
)
|
||||
|
||||
|
||||
template_event.endpoint_callable = TemplateFunctions.template_example_function()
|
||||
@@ -0,0 +1,14 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
from info import template_page_info
|
||||
|
||||
|
||||
TemplateCluster = CategoryCluster(
|
||||
name="TemplateCluster",
|
||||
tags=["template"],
|
||||
prefix="/template",
|
||||
description="Template cluster",
|
||||
pageinfo=template_page_info,
|
||||
endpoints={},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
from ApiLayers.ApiValidations.Request import ListOptions
|
||||
from Events.base_request_model import BaseRouteModel, ListOptionsBase
|
||||
from Services.PostgresDb.Models.pagination import PaginationResult
|
||||
|
||||
|
||||
class Handlers:
|
||||
"""Class for handling authentication functions"""
|
||||
|
||||
@classmethod # Requires no auth context
|
||||
def handle_function(cls, **kwargs):
|
||||
"""Handle function with kwargs"""
|
||||
return
|
||||
|
||||
|
||||
class TemplateFunctions(BaseRouteModel):
|
||||
"""
|
||||
Class for handling authentication functions
|
||||
Is a template 4 TokenMiddleware.event_required decorator function groups.
|
||||
results as :
|
||||
STATIC_MESSAGE & LANG retrieved from redis
|
||||
{
|
||||
"completed": true,
|
||||
"message": STATIC_MESSAGE,
|
||||
"lang": LANG,
|
||||
"pagination": {
|
||||
"size": 10,
|
||||
"page": 2,
|
||||
"allCount": 28366,
|
||||
"totalCount": 18,
|
||||
"totalPages": 2,
|
||||
"pageCount": 8,
|
||||
"orderField": ["type_code", "neighborhood_name"],
|
||||
"orderType": ["asc", "desc"]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"created_at": "2025-01-12 09:39:48 +00:00",
|
||||
"active": true,
|
||||
"expiry_starts": "2025-01-12 09:39:48 +00:00",
|
||||
"locality_uu_id": "771fd152-aca1-4d75-a42e-9b29ea7112b5",
|
||||
"uu_id": "e1baa3bc-93ce-4099-a078-a11b71d3b1a8"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def template_example_function_list(cls, data: Optional[Union[dict, ListOptions]]) -> PaginationResult:
|
||||
from ApiLayers.Schemas import AddressNeighborhood
|
||||
list_options_base = ListOptionsBase(
|
||||
table=AddressNeighborhood, list_options=data, model_query=None,
|
||||
)
|
||||
db_session, query_options = list_options_base.init_list_options()
|
||||
if cls.context_retriever.token.is_occupant:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("10"),
|
||||
db=db_session,
|
||||
).query
|
||||
elif cls.context_retriever.token.is_employee:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("9"),
|
||||
db=db_session,
|
||||
).query
|
||||
records = AddressNeighborhood.filter_all(*query_options.convert(), db=db_session)
|
||||
return list_options_base.paginated_result(
|
||||
records=records, response_model=getattr(cls.context_retriever, 'RESPONSE_VALIDATOR', None)
|
||||
)
|
||||
11
Events/AllEvents/events/decision_book/book_payment/info.py
Normal file
11
Events/AllEvents/events/decision_book/book_payment/info.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from Events.Engine.abstract_class import PageInfo
|
||||
|
||||
|
||||
template_page_info = PageInfo(
|
||||
name="template",
|
||||
title={"en": "template"},
|
||||
description={"en": "template"},
|
||||
icon="",
|
||||
parent="",
|
||||
url="",
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
from Events.Engine.abstract_class import Event
|
||||
from ApiLayers.LanguageModels.Request import (
|
||||
LoginRequestLanguageModel,
|
||||
)
|
||||
|
||||
from models import TemplateResponseModels, TemplateRequestModels
|
||||
from function_handlers import TemplateFunctions
|
||||
|
||||
|
||||
# Auth Login
|
||||
template_event = Event(
|
||||
name="authentication_login_super_user_event",
|
||||
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
|
||||
request_validator=TemplateRequestModels.TemplateRequestModelX,
|
||||
language_models=[LoginRequestLanguageModel],
|
||||
response_validation_static="LOGIN_SUCCESS",
|
||||
description="Login super user",
|
||||
)
|
||||
|
||||
|
||||
template_event.endpoint_callable = TemplateFunctions.template_example_function()
|
||||
@@ -0,0 +1,14 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
from info import template_page_info
|
||||
|
||||
|
||||
TemplateCluster = CategoryCluster(
|
||||
name="TemplateCluster",
|
||||
tags=["template"],
|
||||
prefix="/template",
|
||||
description="Template cluster",
|
||||
pageinfo=template_page_info,
|
||||
endpoints={},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
from ApiLayers.ApiValidations.Request import ListOptions
|
||||
from Events.base_request_model import BaseRouteModel, ListOptionsBase
|
||||
from Services.PostgresDb.Models.pagination import PaginationResult
|
||||
|
||||
|
||||
class Handlers:
|
||||
"""Class for handling authentication functions"""
|
||||
|
||||
@classmethod # Requires no auth context
|
||||
def handle_function(cls, **kwargs):
|
||||
"""Handle function with kwargs"""
|
||||
return
|
||||
|
||||
|
||||
class TemplateFunctions(BaseRouteModel):
|
||||
"""
|
||||
Class for handling authentication functions
|
||||
Is a template 4 TokenMiddleware.event_required decorator function groups.
|
||||
results as :
|
||||
STATIC_MESSAGE & LANG retrieved from redis
|
||||
{
|
||||
"completed": true,
|
||||
"message": STATIC_MESSAGE,
|
||||
"lang": LANG,
|
||||
"pagination": {
|
||||
"size": 10,
|
||||
"page": 2,
|
||||
"allCount": 28366,
|
||||
"totalCount": 18,
|
||||
"totalPages": 2,
|
||||
"pageCount": 8,
|
||||
"orderField": ["type_code", "neighborhood_name"],
|
||||
"orderType": ["asc", "desc"]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"created_at": "2025-01-12 09:39:48 +00:00",
|
||||
"active": true,
|
||||
"expiry_starts": "2025-01-12 09:39:48 +00:00",
|
||||
"locality_uu_id": "771fd152-aca1-4d75-a42e-9b29ea7112b5",
|
||||
"uu_id": "e1baa3bc-93ce-4099-a078-a11b71d3b1a8"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def template_example_function_list(cls, data: Optional[Union[dict, ListOptions]]) -> PaginationResult:
|
||||
from ApiLayers.Schemas import AddressNeighborhood
|
||||
list_options_base = ListOptionsBase(
|
||||
table=AddressNeighborhood, list_options=data, model_query=None,
|
||||
)
|
||||
db_session, query_options = list_options_base.init_list_options()
|
||||
if cls.context_retriever.token.is_occupant:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("10"),
|
||||
db=db_session,
|
||||
).query
|
||||
elif cls.context_retriever.token.is_employee:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("9"),
|
||||
db=db_session,
|
||||
).query
|
||||
records = AddressNeighborhood.filter_all(*query_options.convert(), db=db_session)
|
||||
return list_options_base.paginated_result(
|
||||
records=records, response_model=getattr(cls.context_retriever, 'RESPONSE_VALIDATOR', None)
|
||||
)
|
||||
11
Events/AllEvents/events/decision_book/decision_book/info.py
Normal file
11
Events/AllEvents/events/decision_book/decision_book/info.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from Events.Engine.abstract_class import PageInfo
|
||||
|
||||
|
||||
template_page_info = PageInfo(
|
||||
name="template",
|
||||
title={"en": "template"},
|
||||
description={"en": "template"},
|
||||
icon="",
|
||||
parent="",
|
||||
url="",
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
from Events.Engine.abstract_class import Event
|
||||
from ApiLayers.LanguageModels.Request import (
|
||||
LoginRequestLanguageModel,
|
||||
)
|
||||
|
||||
from models import TemplateResponseModels, TemplateRequestModels
|
||||
from function_handlers import TemplateFunctions
|
||||
|
||||
|
||||
# Auth Login
|
||||
template_event = Event(
|
||||
name="authentication_login_super_user_event",
|
||||
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
|
||||
request_validator=TemplateRequestModels.TemplateRequestModelX,
|
||||
language_models=[LoginRequestLanguageModel],
|
||||
response_validation_static="LOGIN_SUCCESS",
|
||||
description="Login super user",
|
||||
)
|
||||
|
||||
|
||||
template_event.endpoint_callable = TemplateFunctions.template_example_function()
|
||||
@@ -0,0 +1,14 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
from info import template_page_info
|
||||
|
||||
|
||||
TemplateCluster = CategoryCluster(
|
||||
name="TemplateCluster",
|
||||
tags=["template"],
|
||||
prefix="/template",
|
||||
description="Template cluster",
|
||||
pageinfo=template_page_info,
|
||||
endpoints={},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
from ApiLayers.ApiValidations.Request import ListOptions
|
||||
from Events.base_request_model import BaseRouteModel, ListOptionsBase
|
||||
from Services.PostgresDb.Models.pagination import PaginationResult
|
||||
|
||||
|
||||
class Handlers:
|
||||
"""Class for handling authentication functions"""
|
||||
|
||||
@classmethod # Requires no auth context
|
||||
def handle_function(cls, **kwargs):
|
||||
"""Handle function with kwargs"""
|
||||
return
|
||||
|
||||
|
||||
class TemplateFunctions(BaseRouteModel):
|
||||
"""
|
||||
Class for handling authentication functions
|
||||
Is a template 4 TokenMiddleware.event_required decorator function groups.
|
||||
results as :
|
||||
STATIC_MESSAGE & LANG retrieved from redis
|
||||
{
|
||||
"completed": true,
|
||||
"message": STATIC_MESSAGE,
|
||||
"lang": LANG,
|
||||
"pagination": {
|
||||
"size": 10,
|
||||
"page": 2,
|
||||
"allCount": 28366,
|
||||
"totalCount": 18,
|
||||
"totalPages": 2,
|
||||
"pageCount": 8,
|
||||
"orderField": ["type_code", "neighborhood_name"],
|
||||
"orderType": ["asc", "desc"]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"created_at": "2025-01-12 09:39:48 +00:00",
|
||||
"active": true,
|
||||
"expiry_starts": "2025-01-12 09:39:48 +00:00",
|
||||
"locality_uu_id": "771fd152-aca1-4d75-a42e-9b29ea7112b5",
|
||||
"uu_id": "e1baa3bc-93ce-4099-a078-a11b71d3b1a8"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def template_example_function_list(cls, data: Optional[Union[dict, ListOptions]]) -> PaginationResult:
|
||||
from ApiLayers.Schemas import AddressNeighborhood
|
||||
list_options_base = ListOptionsBase(
|
||||
table=AddressNeighborhood, list_options=data, model_query=None,
|
||||
)
|
||||
db_session, query_options = list_options_base.init_list_options()
|
||||
if cls.context_retriever.token.is_occupant:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("10"),
|
||||
db=db_session,
|
||||
).query
|
||||
elif cls.context_retriever.token.is_employee:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("9"),
|
||||
db=db_session,
|
||||
).query
|
||||
records = AddressNeighborhood.filter_all(*query_options.convert(), db=db_session)
|
||||
return list_options_base.paginated_result(
|
||||
records=records, response_model=getattr(cls.context_retriever, 'RESPONSE_VALIDATOR', None)
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
from Events.Engine.abstract_class import PageInfo
|
||||
|
||||
|
||||
template_page_info = PageInfo(
|
||||
name="template",
|
||||
title={"en": "template"},
|
||||
description={"en": "template"},
|
||||
icon="",
|
||||
parent="",
|
||||
url="",
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
from Events.Engine.abstract_class import Event
|
||||
from ApiLayers.LanguageModels.Request import (
|
||||
LoginRequestLanguageModel,
|
||||
)
|
||||
|
||||
from models import TemplateResponseModels, TemplateRequestModels
|
||||
from function_handlers import TemplateFunctions
|
||||
|
||||
|
||||
# Auth Login
|
||||
template_event = Event(
|
||||
name="authentication_login_super_user_event",
|
||||
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
|
||||
request_validator=TemplateRequestModels.TemplateRequestModelX,
|
||||
language_models=[LoginRequestLanguageModel],
|
||||
response_validation_static="LOGIN_SUCCESS",
|
||||
description="Login super user",
|
||||
)
|
||||
|
||||
|
||||
template_event.endpoint_callable = TemplateFunctions.template_example_function()
|
||||
@@ -0,0 +1,14 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
from info import template_page_info
|
||||
|
||||
|
||||
TemplateCluster = CategoryCluster(
|
||||
name="TemplateCluster",
|
||||
tags=["template"],
|
||||
prefix="/template",
|
||||
description="Template cluster",
|
||||
pageinfo=template_page_info,
|
||||
endpoints={},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
from ApiLayers.ApiValidations.Request import ListOptions
|
||||
from Events.base_request_model import BaseRouteModel, ListOptionsBase
|
||||
from Services.PostgresDb.Models.pagination import PaginationResult
|
||||
|
||||
|
||||
class Handlers:
|
||||
"""Class for handling authentication functions"""
|
||||
|
||||
@classmethod # Requires no auth context
|
||||
def handle_function(cls, **kwargs):
|
||||
"""Handle function with kwargs"""
|
||||
return
|
||||
|
||||
|
||||
class TemplateFunctions(BaseRouteModel):
|
||||
"""
|
||||
Class for handling authentication functions
|
||||
Is a template 4 TokenMiddleware.event_required decorator function groups.
|
||||
results as :
|
||||
STATIC_MESSAGE & LANG retrieved from redis
|
||||
{
|
||||
"completed": true,
|
||||
"message": STATIC_MESSAGE,
|
||||
"lang": LANG,
|
||||
"pagination": {
|
||||
"size": 10,
|
||||
"page": 2,
|
||||
"allCount": 28366,
|
||||
"totalCount": 18,
|
||||
"totalPages": 2,
|
||||
"pageCount": 8,
|
||||
"orderField": ["type_code", "neighborhood_name"],
|
||||
"orderType": ["asc", "desc"]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"created_at": "2025-01-12 09:39:48 +00:00",
|
||||
"active": true,
|
||||
"expiry_starts": "2025-01-12 09:39:48 +00:00",
|
||||
"locality_uu_id": "771fd152-aca1-4d75-a42e-9b29ea7112b5",
|
||||
"uu_id": "e1baa3bc-93ce-4099-a078-a11b71d3b1a8"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def template_example_function_list(cls, data: Optional[Union[dict, ListOptions]]) -> PaginationResult:
|
||||
from ApiLayers.Schemas import AddressNeighborhood
|
||||
list_options_base = ListOptionsBase(
|
||||
table=AddressNeighborhood, list_options=data, model_query=None,
|
||||
)
|
||||
db_session, query_options = list_options_base.init_list_options()
|
||||
if cls.context_retriever.token.is_occupant:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("10"),
|
||||
db=db_session,
|
||||
).query
|
||||
elif cls.context_retriever.token.is_employee:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("9"),
|
||||
db=db_session,
|
||||
).query
|
||||
records = AddressNeighborhood.filter_all(*query_options.convert(), db=db_session)
|
||||
return list_options_base.paginated_result(
|
||||
records=records, response_model=getattr(cls.context_retriever, 'RESPONSE_VALIDATOR', None)
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
from Events.Engine.abstract_class import PageInfo
|
||||
|
||||
|
||||
template_page_info = PageInfo(
|
||||
name="template",
|
||||
title={"en": "template"},
|
||||
description={"en": "template"},
|
||||
icon="",
|
||||
parent="",
|
||||
url="",
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
from Events.Engine.abstract_class import Event
|
||||
from ApiLayers.LanguageModels.Request import (
|
||||
LoginRequestLanguageModel,
|
||||
)
|
||||
|
||||
from models import TemplateResponseModels, TemplateRequestModels
|
||||
from function_handlers import TemplateFunctions
|
||||
|
||||
|
||||
# Auth Login
|
||||
template_event = Event(
|
||||
name="authentication_login_super_user_event",
|
||||
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
|
||||
request_validator=TemplateRequestModels.TemplateRequestModelX,
|
||||
language_models=[LoginRequestLanguageModel],
|
||||
response_validation_static="LOGIN_SUCCESS",
|
||||
description="Login super user",
|
||||
)
|
||||
|
||||
|
||||
template_event.endpoint_callable = TemplateFunctions.template_example_function()
|
||||
@@ -0,0 +1,14 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
from info import template_page_info
|
||||
|
||||
|
||||
TemplateCluster = CategoryCluster(
|
||||
name="TemplateCluster",
|
||||
tags=["template"],
|
||||
prefix="/template",
|
||||
description="Template cluster",
|
||||
pageinfo=template_page_info,
|
||||
endpoints={},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
from ApiLayers.ApiValidations.Request import ListOptions
|
||||
from Events.base_request_model import BaseRouteModel, ListOptionsBase
|
||||
from Services.PostgresDb.Models.pagination import PaginationResult
|
||||
|
||||
|
||||
class Handlers:
|
||||
"""Class for handling authentication functions"""
|
||||
|
||||
@classmethod # Requires no auth context
|
||||
def handle_function(cls, **kwargs):
|
||||
"""Handle function with kwargs"""
|
||||
return
|
||||
|
||||
|
||||
class TemplateFunctions(BaseRouteModel):
|
||||
"""
|
||||
Class for handling authentication functions
|
||||
Is a template 4 TokenMiddleware.event_required decorator function groups.
|
||||
results as :
|
||||
STATIC_MESSAGE & LANG retrieved from redis
|
||||
{
|
||||
"completed": true,
|
||||
"message": STATIC_MESSAGE,
|
||||
"lang": LANG,
|
||||
"pagination": {
|
||||
"size": 10,
|
||||
"page": 2,
|
||||
"allCount": 28366,
|
||||
"totalCount": 18,
|
||||
"totalPages": 2,
|
||||
"pageCount": 8,
|
||||
"orderField": ["type_code", "neighborhood_name"],
|
||||
"orderType": ["asc", "desc"]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"created_at": "2025-01-12 09:39:48 +00:00",
|
||||
"active": true,
|
||||
"expiry_starts": "2025-01-12 09:39:48 +00:00",
|
||||
"locality_uu_id": "771fd152-aca1-4d75-a42e-9b29ea7112b5",
|
||||
"uu_id": "e1baa3bc-93ce-4099-a078-a11b71d3b1a8"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def template_example_function_list(cls, data: Optional[Union[dict, ListOptions]]) -> PaginationResult:
|
||||
from ApiLayers.Schemas import AddressNeighborhood
|
||||
list_options_base = ListOptionsBase(
|
||||
table=AddressNeighborhood, list_options=data, model_query=None,
|
||||
)
|
||||
db_session, query_options = list_options_base.init_list_options()
|
||||
if cls.context_retriever.token.is_occupant:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("10"),
|
||||
db=db_session,
|
||||
).query
|
||||
elif cls.context_retriever.token.is_employee:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("9"),
|
||||
db=db_session,
|
||||
).query
|
||||
records = AddressNeighborhood.filter_all(*query_options.convert(), db=db_session)
|
||||
return list_options_base.paginated_result(
|
||||
records=records, response_model=getattr(cls.context_retriever, 'RESPONSE_VALIDATOR', None)
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
from Events.Engine.abstract_class import PageInfo
|
||||
|
||||
|
||||
template_page_info = PageInfo(
|
||||
name="template",
|
||||
title={"en": "template"},
|
||||
description={"en": "template"},
|
||||
icon="",
|
||||
parent="",
|
||||
url="",
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
from Events.Engine.abstract_class import Event
|
||||
from ApiLayers.LanguageModels.Request import (
|
||||
LoginRequestLanguageModel,
|
||||
)
|
||||
|
||||
from models import TemplateResponseModels, TemplateRequestModels
|
||||
from function_handlers import TemplateFunctions
|
||||
|
||||
|
||||
# Auth Login
|
||||
template_event = Event(
|
||||
name="authentication_login_super_user_event",
|
||||
key="a5d2d0d1-3e9b-4b0f-8c7d-6d4a4b4c4d4e",
|
||||
request_validator=TemplateRequestModels.TemplateRequestModelX,
|
||||
language_models=[LoginRequestLanguageModel],
|
||||
response_validation_static="LOGIN_SUCCESS",
|
||||
description="Login super user",
|
||||
)
|
||||
|
||||
|
||||
template_event.endpoint_callable = TemplateFunctions.template_example_function()
|
||||
14
Events/AllEvents/events/decision_book/invitations/cluster.py
Normal file
14
Events/AllEvents/events/decision_book/invitations/cluster.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from Events.Engine.abstract_class import CategoryCluster
|
||||
from info import template_page_info
|
||||
|
||||
|
||||
TemplateCluster = CategoryCluster(
|
||||
name="TemplateCluster",
|
||||
tags=["template"],
|
||||
prefix="/template",
|
||||
description="Template cluster",
|
||||
pageinfo=template_page_info,
|
||||
endpoints={},
|
||||
include_in_schema=True,
|
||||
sub_category=[],
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
from typing import Union, Optional
|
||||
|
||||
from ApiLayers.ApiValidations.Request import ListOptions
|
||||
from Events.base_request_model import BaseRouteModel, ListOptionsBase
|
||||
from Services.PostgresDb.Models.pagination import PaginationResult
|
||||
|
||||
|
||||
class Handlers:
|
||||
"""Class for handling authentication functions"""
|
||||
|
||||
@classmethod # Requires no auth context
|
||||
def handle_function(cls, **kwargs):
|
||||
"""Handle function with kwargs"""
|
||||
return
|
||||
|
||||
|
||||
class TemplateFunctions(BaseRouteModel):
|
||||
"""
|
||||
Class for handling authentication functions
|
||||
Is a template 4 TokenMiddleware.event_required decorator function groups.
|
||||
results as :
|
||||
STATIC_MESSAGE & LANG retrieved from redis
|
||||
{
|
||||
"completed": true,
|
||||
"message": STATIC_MESSAGE,
|
||||
"lang": LANG,
|
||||
"pagination": {
|
||||
"size": 10,
|
||||
"page": 2,
|
||||
"allCount": 28366,
|
||||
"totalCount": 18,
|
||||
"totalPages": 2,
|
||||
"pageCount": 8,
|
||||
"orderField": ["type_code", "neighborhood_name"],
|
||||
"orderType": ["asc", "desc"]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"created_at": "2025-01-12 09:39:48 +00:00",
|
||||
"active": true,
|
||||
"expiry_starts": "2025-01-12 09:39:48 +00:00",
|
||||
"locality_uu_id": "771fd152-aca1-4d75-a42e-9b29ea7112b5",
|
||||
"uu_id": "e1baa3bc-93ce-4099-a078-a11b71d3b1a8"
|
||||
},
|
||||
...
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def template_example_function_list(cls, data: Optional[Union[dict, ListOptions]]) -> PaginationResult:
|
||||
from ApiLayers.Schemas import AddressNeighborhood
|
||||
list_options_base = ListOptionsBase(
|
||||
table=AddressNeighborhood, list_options=data, model_query=None,
|
||||
)
|
||||
db_session, query_options = list_options_base.init_list_options()
|
||||
if cls.context_retriever.token.is_occupant:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("10"),
|
||||
db=db_session,
|
||||
).query
|
||||
elif cls.context_retriever.token.is_employee:
|
||||
AddressNeighborhood.pre_query = AddressNeighborhood.filter_all(
|
||||
AddressNeighborhood.neighborhood_code.icontains("9"),
|
||||
db=db_session,
|
||||
).query
|
||||
records = AddressNeighborhood.filter_all(*query_options.convert(), db=db_session)
|
||||
return list_options_base.paginated_result(
|
||||
records=records, response_model=getattr(cls.context_retriever, 'RESPONSE_VALIDATOR', None)
|
||||
)
|
||||
11
Events/AllEvents/events/decision_book/invitations/info.py
Normal file
11
Events/AllEvents/events/decision_book/invitations/info.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from Events.Engine.abstract_class import PageInfo
|
||||
|
||||
|
||||
template_page_info = PageInfo(
|
||||
name="template",
|
||||
title={"en": "template"},
|
||||
description={"en": "template"},
|
||||
icon="",
|
||||
parent="",
|
||||
url="",
|
||||
)
|
||||
Reference in New Issue
Block a user