event file updated
This commit is contained in:
parent
af82f74eb6
commit
1fe88e226a
|
|
@ -6,9 +6,32 @@
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b5202e0c-6ddf-4a56-a13a-e18798c4c7cf" name="Changes" comment="">
|
<list default="true" id="b5202e0c-6ddf-4a56-a13a-e18798c4c7cf" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ApiLayers/Middleware/token_event_middleware.py" beforeDir="false" afterPath="$PROJECT_DIR$/ApiLayers/Middleware/token_event_middleware.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ApiLayers/ApiServices/Cluster/create_router.py" beforeDir="false" afterPath="$PROJECT_DIR$/ApiLayers/ApiServices/Cluster/create_router.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/account/function_handlers.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/account/function_handlers.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/account/api_events.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/account/api_events.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Events/AllEvents/template/template/function_handlers.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/template/template/function_handlers.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/account/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/account/models.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/address/endpoints.py" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/building/build_area.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/building/build_area/build_area.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/building/build_parts.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/building/build_parts/build_parts.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/building/build_sites.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/building/build_sites/build_sites.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/building/build_types.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/building/build_types/build_types.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/building/living_spaces.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/building/living_spaces/living_spaces.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/company/company.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/company/company/company.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/company/department.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/company/department/department.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/company/duties.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/company/duties/duties.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/company/duty.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/company/duty/duty.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/company/employee.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/company/employee/employee.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/company/staff.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/company/staff/staff.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/book_payment.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/book_payment/book_payment.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book/decision_book.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book_items.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book_items/decision_book_items.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book_items_debits.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book_items_debits/decision_book_items_debits.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book_person.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/decision_book_person/decision_book_person.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/invitations.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/decision_book/invitations/invitations.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/identity/people.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/identity/people/people.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/identity/users.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/identity/users/users.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book/project_decision_book.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book_items.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book_items/project_decision_book_items.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book_person.py" beforeDir="false" afterPath="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book_person/project_decision_book_person.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|
@ -33,16 +56,16 @@
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"Python.how_to.executor": "Run",
|
"Python.how_to.executor": "Run",
|
||||||
"Python.identity.executor": "Run",
|
"Python.identity.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"git-widget-placeholder": "development",
|
"git-widget-placeholder": "development",
|
||||||
"last_opened_file_path": "/home/berkay/git-gitea-evyos/wag-managment-api-service-version-5/ApiLayers/ApiValidations/Queries"
|
"last_opened_file_path": "/home/berkay/git-gitea-evyos/wag-managment-api-service-version-5/ApiLayers/ApiValidations/Queries"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="$PROJECT_DIR$/ApiLayers/ApiValidations/Queries" />
|
<recent name="$PROJECT_DIR$/ApiLayers/ApiValidations/Queries" />
|
||||||
|
|
@ -52,7 +75,11 @@
|
||||||
<recent name="$PROJECT_DIR$/ApiLayers/LanguageModels/templates" />
|
<recent name="$PROJECT_DIR$/ApiLayers/LanguageModels/templates" />
|
||||||
</key>
|
</key>
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
<recent name="$PROJECT_DIR$/ApiLayers/AllConfigs" />
|
<recent name="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book_person" />
|
||||||
|
<recent name="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book_items" />
|
||||||
|
<recent name="$PROJECT_DIR$/Events/AllEvents/events/project_decision_book/project_decision_book" />
|
||||||
|
<recent name="$PROJECT_DIR$/Events/AllEvents/events/building/living_spaces" />
|
||||||
|
<recent name="$PROJECT_DIR$/Events/AllEvents/events/building/build_types" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Python.how_to">
|
<component name="RunManager" selected="Python.how_to">
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ class CreateRouterFromCluster:
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.prefix = kwargs.get("prefix")
|
self.prefix = kwargs.get("prefix")
|
||||||
self.tags = kwargs.get("tags")
|
self.tags = kwargs.get("tags")
|
||||||
self.router = APIRouter(prefix=self.prefix, tags=self.tags)
|
self.include_in_schema = bool(kwargs.get("include_in_schema", True))
|
||||||
|
self.router = APIRouter(prefix=self.prefix, tags=self.tags, include_in_schema=self.include_in_schema)
|
||||||
|
|
||||||
|
|
||||||
class CreateEndpointFromCluster:
|
class CreateEndpointFromCluster:
|
||||||
|
|
|
||||||
|
|
@ -13,23 +13,23 @@ from .function_handlers import (
|
||||||
AccountListEventMethods,
|
AccountListEventMethods,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#
|
||||||
class SelectResponseAccount(BaseModel):
|
# class SelectResponseAccount(BaseModel):
|
||||||
"""
|
# """
|
||||||
Response model for account list.
|
# Response model for account list.
|
||||||
"""
|
# """
|
||||||
neighborhood_code: str
|
# neighborhood_code: str
|
||||||
neighborhood_name: str
|
# neighborhood_name: str
|
||||||
type_code: str
|
# type_code: str
|
||||||
type_description: str
|
# type_description: str
|
||||||
|
#
|
||||||
|
|
||||||
# Auth Login
|
# Auth Login
|
||||||
account_insert_super_user_event = Event(
|
account_insert_super_user_event = Event(
|
||||||
name="account_insert_super_user_event",
|
name="account_insert_super_user_event",
|
||||||
key="36a165fe-a2f3-437b-80ee-1ee44670fe70",
|
key="36a165fe-a2f3-437b-80ee-1ee44670fe70",
|
||||||
request_validator=ListOptions,
|
request_validator=AccountRequestValidators.ListAccountRecord,
|
||||||
response_validator=SelectResponseAccount,
|
# response_validator=SelectResponseAccount,
|
||||||
# language_models=[AccountRecords.__language_model__],
|
# language_models=[AccountRecords.__language_model__],
|
||||||
language_models=[],
|
language_models=[],
|
||||||
statics="ACCOUNTS_LIST",
|
statics="ACCOUNTS_LIST",
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
"""
|
"""
|
||||||
Account records request and response models.
|
Account records request and response models.
|
||||||
"""
|
"""
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Dict, Any, Optional
|
from ApiLayers.ApiValidations.Request import PydanticBaseModel, ListOptions
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from ApiLayers.ApiValidations.Request import PydanticBaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class InsertAccountRecord(PydanticBaseModel):
|
class InsertAccountRecord(PydanticBaseModel):
|
||||||
|
|
@ -88,44 +86,8 @@ class UpdateAccountRecord(PydanticBaseModel):
|
||||||
build_decision_book_uu_id: Optional[str] = None
|
build_decision_book_uu_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class ListAccountRecord(PydanticBaseModel):
|
class ListAccountRecord(ListOptions):
|
||||||
|
pass
|
||||||
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 AccountRequestValidators:
|
class AccountRequestValidators:
|
||||||
|
|
|
||||||
|
|
@ -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=[],
|
||||||
|
)
|
||||||
|
|
@ -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()
|
|
||||||
|
|
@ -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()
|
||||||
|
|
@ -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()
|
||||||
|
|
@ -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()
|
||||||
|
|
@ -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()
|
||||||
|
|
@ -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()
|
||||||
|
|
@ -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()
|
||||||
|
|
@ -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="",
|
||||||
|
)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue