event file updated
This commit is contained in:
@@ -13,23 +13,23 @@ from .function_handlers import (
|
||||
AccountListEventMethods,
|
||||
)
|
||||
|
||||
|
||||
class SelectResponseAccount(BaseModel):
|
||||
"""
|
||||
Response model for account list.
|
||||
"""
|
||||
neighborhood_code: str
|
||||
neighborhood_name: str
|
||||
type_code: str
|
||||
type_description: str
|
||||
|
||||
#
|
||||
# class SelectResponseAccount(BaseModel):
|
||||
# """
|
||||
# Response model for account list.
|
||||
# """
|
||||
# neighborhood_code: str
|
||||
# neighborhood_name: str
|
||||
# type_code: str
|
||||
# type_description: str
|
||||
#
|
||||
|
||||
# Auth Login
|
||||
account_insert_super_user_event = Event(
|
||||
name="account_insert_super_user_event",
|
||||
key="36a165fe-a2f3-437b-80ee-1ee44670fe70",
|
||||
request_validator=ListOptions,
|
||||
response_validator=SelectResponseAccount,
|
||||
request_validator=AccountRequestValidators.ListAccountRecord,
|
||||
# response_validator=SelectResponseAccount,
|
||||
# language_models=[AccountRecords.__language_model__],
|
||||
language_models=[],
|
||||
statics="ACCOUNTS_LIST",
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
"""
|
||||
Account records request and response models.
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
from typing import TYPE_CHECKING, Dict, Any, Optional
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ApiLayers.ApiValidations.Request import PydanticBaseModel
|
||||
from ApiLayers.ApiValidations.Request import PydanticBaseModel, ListOptions
|
||||
|
||||
|
||||
class InsertAccountRecord(PydanticBaseModel):
|
||||
@@ -88,44 +86,8 @@ class UpdateAccountRecord(PydanticBaseModel):
|
||||
build_decision_book_uu_id: Optional[str] = None
|
||||
|
||||
|
||||
class ListAccountRecord(PydanticBaseModel):
|
||||
|
||||
iban: Optional[str] = None
|
||||
bank_date: Optional[str] = None
|
||||
currency_value: Optional[float] = None
|
||||
bank_balance: Optional[float] = None
|
||||
currency: Optional[str] = None
|
||||
additional_balance: Optional[float] = None
|
||||
channel_branch: Optional[str] = None
|
||||
process_name: Optional[str] = None
|
||||
process_type: Optional[str] = None
|
||||
process_comment: Optional[str] = None
|
||||
bank_reference_code: Optional[str] = None
|
||||
|
||||
add_comment_note: Optional[str] = None
|
||||
is_receipt_mail_send: Optional[bool] = None
|
||||
found_from: Optional[str] = None
|
||||
similarity: Optional[float] = None
|
||||
remainder_balance: Optional[float] = None
|
||||
bank_date_y: Optional[int] = None
|
||||
bank_date_m: Optional[int] = None
|
||||
bank_date_w: Optional[int] = None
|
||||
bank_date_d: Optional[int] = None
|
||||
approving_accounting_record: Optional[bool] = None
|
||||
accounting_receipt_date: Optional[str] = None
|
||||
accounting_receipt_number: Optional[int] = None
|
||||
approved_record: Optional[bool] = None
|
||||
import_file_name: Optional[str] = None
|
||||
receive_debit_uu_id: Optional[str] = None
|
||||
budget_type_uu_id: Optional[str] = None
|
||||
company_uu_id: Optional[str] = None
|
||||
send_company_uu_id: Optional[str] = None
|
||||
customer_id: Optional[str] = None
|
||||
customer_uu_id: Optional[str] = None
|
||||
send_person_uu_id: Optional[str] = None
|
||||
approving_accounting_person_uu_id: Optional[str] = None
|
||||
build_parts_uu_id: Optional[str] = None
|
||||
build_decision_book_uu_id: Optional[str] = None
|
||||
class ListAccountRecord(ListOptions):
|
||||
pass
|
||||
|
||||
|
||||
class AccountRequestValidators:
|
||||
|
||||
21
Events/AllEvents/events/address/api_events.py
Normal file
21
Events/AllEvents/events/address/api_events.py
Normal file
@@ -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/address/cluster.py
Normal file
14
Events/AllEvents/events/address/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=[],
|
||||
)
|
||||
@@ -1,112 +0,0 @@
|
||||
"""
|
||||
Account records endpoint configurations.
|
||||
|
||||
"""
|
||||
|
||||
from ApiEvents.abstract_class import (
|
||||
RouteFactoryConfig,
|
||||
EndpointFactoryConfig,
|
||||
endpoint_wrapper,
|
||||
)
|
||||
from ApiEvents.base_request_model import EndpointBaseRequestModel
|
||||
|
||||
from Services.PostgresDb.Models.alchemy_response import DictJsonResponse
|
||||
from fastapi import Request, Path, Body
|
||||
|
||||
|
||||
@endpoint_wrapper("/address/list")
|
||||
async def address_list(request: "Request", data: EndpointBaseRequestModel):
|
||||
"""Handle address list endpoint."""
|
||||
auth_dict = address_list.auth
|
||||
code_dict = getattr(address_list, "func_code", {"function_code": None})
|
||||
return {"auth_dict": auth_dict, "code_dict": code_dict, "data": data}
|
||||
|
||||
|
||||
@endpoint_wrapper("/address/create")
|
||||
async def address_create(request: "Request", data: EndpointBaseRequestModel):
|
||||
"""Handle address creation endpoint."""
|
||||
return {
|
||||
"data": data,
|
||||
"request": str(request.headers),
|
||||
"request_url": str(request.url),
|
||||
"request_base_url": str(request.base_url),
|
||||
}
|
||||
|
||||
|
||||
@endpoint_wrapper("/address/update/{address_uu_id}")
|
||||
async def address_update(
|
||||
request: Request,
|
||||
address_uu_id: str = Path(..., description="UUID of the address to update"),
|
||||
request_data: EndpointBaseRequestModel = Body(..., description="Request body"),
|
||||
):
|
||||
"""
|
||||
Handle address update endpoint.
|
||||
|
||||
Args:
|
||||
request: FastAPI request object
|
||||
address_uu_id: UUID of the address to update
|
||||
request_data: Request body containing updated address data
|
||||
|
||||
Returns:
|
||||
DictJsonResponse: Response containing updated address info
|
||||
"""
|
||||
auth_dict = address_update.auth
|
||||
return DictJsonResponse(
|
||||
data={
|
||||
"address_uu_id": address_uu_id,
|
||||
"data": request_data.root,
|
||||
"request": str(request.headers),
|
||||
"request_url": str(request.url),
|
||||
"request_base_url": str(request.base_url),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
prefix = "/address"
|
||||
|
||||
|
||||
# Address Router Configuration
|
||||
ADDRESS_CONFIG = RouteFactoryConfig(
|
||||
name="address",
|
||||
prefix=prefix,
|
||||
tags=["Address"],
|
||||
include_in_schema=True,
|
||||
endpoints=[
|
||||
EndpointFactoryConfig(
|
||||
url_prefix=prefix,
|
||||
url_endpoint="/list",
|
||||
url_of_endpoint=f"{prefix}/list",
|
||||
endpoint="/list",
|
||||
method="POST",
|
||||
summary="List Active/Delete/Confirm Address",
|
||||
description="List Active/Delete/Confirm Address",
|
||||
is_auth_required=True,
|
||||
is_event_required=True,
|
||||
endpoint_function=address_list,
|
||||
),
|
||||
EndpointFactoryConfig(
|
||||
url_prefix=prefix,
|
||||
url_endpoint="/create",
|
||||
url_of_endpoint=f"{prefix}/create",
|
||||
endpoint="/create",
|
||||
method="POST",
|
||||
summary="Create Address with given auth levels",
|
||||
description="Create Address with given auth levels",
|
||||
is_auth_required=False,
|
||||
is_event_required=False,
|
||||
endpoint_function=address_create,
|
||||
),
|
||||
EndpointFactoryConfig(
|
||||
url_prefix=prefix,
|
||||
url_endpoint="/{address_uu_id}",
|
||||
url_of_endpoint="{prefix}/" + "{address_uu_id}",
|
||||
endpoint="/{address_uu_id}",
|
||||
method="PUT",
|
||||
summary="Update Address with given auth levels",
|
||||
description="Update Address with given auth levels",
|
||||
is_auth_required=True,
|
||||
is_event_required=True,
|
||||
endpoint_function=address_update,
|
||||
),
|
||||
],
|
||||
).as_dict()
|
||||
70
Events/AllEvents/events/address/function_handlers.py
Normal file
70
Events/AllEvents/events/address/function_handlers.py
Normal file
@@ -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/address/info.py
Normal file
11
Events/AllEvents/events/address/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/building/build_area/api_events.py
Normal file
21
Events/AllEvents/events/building/build_area/api_events.py
Normal file
@@ -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/building/build_area/cluster.py
Normal file
14
Events/AllEvents/events/building/build_area/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/building/build_area/info.py
Normal file
11
Events/AllEvents/events/building/build_area/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/building/build_parts/api_events.py
Normal file
21
Events/AllEvents/events/building/build_parts/api_events.py
Normal file
@@ -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/building/build_parts/cluster.py
Normal file
14
Events/AllEvents/events/building/build_parts/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/building/build_parts/info.py
Normal file
11
Events/AllEvents/events/building/build_parts/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/building/build_sites/api_events.py
Normal file
21
Events/AllEvents/events/building/build_sites/api_events.py
Normal file
@@ -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/building/build_sites/cluster.py
Normal file
14
Events/AllEvents/events/building/build_sites/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/building/build_sites/info.py
Normal file
11
Events/AllEvents/events/building/build_sites/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/building/build_types/api_events.py
Normal file
21
Events/AllEvents/events/building/build_types/api_events.py
Normal file
@@ -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/building/build_types/cluster.py
Normal file
14
Events/AllEvents/events/building/build_types/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/building/build_types/info.py
Normal file
11
Events/AllEvents/events/building/build_types/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/building/living_spaces/api_events.py
Normal file
21
Events/AllEvents/events/building/living_spaces/api_events.py
Normal file
@@ -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/building/living_spaces/cluster.py
Normal file
14
Events/AllEvents/events/building/living_spaces/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/building/living_spaces/info.py
Normal file
11
Events/AllEvents/events/building/living_spaces/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/company/company/api_events.py
Normal file
21
Events/AllEvents/events/company/company/api_events.py
Normal file
@@ -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/company/company/cluster.py
Normal file
14
Events/AllEvents/events/company/company/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=[],
|
||||
)
|
||||
70
Events/AllEvents/events/company/company/function_handlers.py
Normal file
70
Events/AllEvents/events/company/company/function_handlers.py
Normal file
@@ -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/company/company/info.py
Normal file
11
Events/AllEvents/events/company/company/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/company/department/api_events.py
Normal file
21
Events/AllEvents/events/company/department/api_events.py
Normal file
@@ -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/company/department/cluster.py
Normal file
14
Events/AllEvents/events/company/department/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/company/department/info.py
Normal file
11
Events/AllEvents/events/company/department/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/company/duties/api_events.py
Normal file
21
Events/AllEvents/events/company/duties/api_events.py
Normal file
@@ -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/company/duties/cluster.py
Normal file
14
Events/AllEvents/events/company/duties/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=[],
|
||||
)
|
||||
70
Events/AllEvents/events/company/duties/function_handlers.py
Normal file
70
Events/AllEvents/events/company/duties/function_handlers.py
Normal file
@@ -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/company/duties/info.py
Normal file
11
Events/AllEvents/events/company/duties/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/company/duty/api_events.py
Normal file
21
Events/AllEvents/events/company/duty/api_events.py
Normal file
@@ -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/company/duty/cluster.py
Normal file
14
Events/AllEvents/events/company/duty/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=[],
|
||||
)
|
||||
70
Events/AllEvents/events/company/duty/function_handlers.py
Normal file
70
Events/AllEvents/events/company/duty/function_handlers.py
Normal file
@@ -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/company/duty/info.py
Normal file
11
Events/AllEvents/events/company/duty/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/company/employee/api_events.py
Normal file
21
Events/AllEvents/events/company/employee/api_events.py
Normal file
@@ -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/company/employee/cluster.py
Normal file
14
Events/AllEvents/events/company/employee/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/company/employee/info.py
Normal file
11
Events/AllEvents/events/company/employee/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/company/staff/api_events.py
Normal file
21
Events/AllEvents/events/company/staff/api_events.py
Normal file
@@ -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/company/staff/cluster.py
Normal file
14
Events/AllEvents/events/company/staff/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=[],
|
||||
)
|
||||
70
Events/AllEvents/events/company/staff/function_handlers.py
Normal file
70
Events/AllEvents/events/company/staff/function_handlers.py
Normal file
@@ -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/company/staff/info.py
Normal file
11
Events/AllEvents/events/company/staff/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/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/identity/people/api_events.py
Normal file
21
Events/AllEvents/events/identity/people/api_events.py
Normal file
@@ -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/identity/people/cluster.py
Normal file
14
Events/AllEvents/events/identity/people/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=[],
|
||||
)
|
||||
70
Events/AllEvents/events/identity/people/function_handlers.py
Normal file
70
Events/AllEvents/events/identity/people/function_handlers.py
Normal file
@@ -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/identity/people/info.py
Normal file
11
Events/AllEvents/events/identity/people/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="",
|
||||
)
|
||||
21
Events/AllEvents/events/identity/users/api_events.py
Normal file
21
Events/AllEvents/events/identity/users/api_events.py
Normal file
@@ -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/identity/users/cluster.py
Normal file
14
Events/AllEvents/events/identity/users/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=[],
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user