more services added
This commit is contained in:
parent
4606f0721d
commit
5f7cb35ccc
|
|
@ -0,0 +1,31 @@
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# Install system dependencies and Poetry
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/* && pip install --no-cache-dir poetry
|
||||||
|
|
||||||
|
# Copy Poetry configuration
|
||||||
|
COPY /pyproject.toml ./pyproject.toml
|
||||||
|
|
||||||
|
# Configure Poetry and install dependencies with optimizations
|
||||||
|
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main && pip cache purge && rm -rf ~/.cache/pypoetry
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY /api_services/api_initializer /api_initializer
|
||||||
|
COPY /api_services/api_controllers /api_controllers
|
||||||
|
COPY /api_services/api_validations /api_validations
|
||||||
|
COPY /api_services/schemas /schemas
|
||||||
|
COPY /api_services/api_modules /api_modules
|
||||||
|
|
||||||
|
COPY /api_services/api_middlewares /api_middlewares
|
||||||
|
COPY /api_services/api_builds/account_service/endpoints /api_initializer/endpoints
|
||||||
|
COPY /api_services/api_builds/account_service/events /api_initializer/events
|
||||||
|
COPY /api_services/api_builds/account_service/validations /api_initializer/validations
|
||||||
|
COPY /api_services/api_builds/account_service/index.py /api_initializer/index.py
|
||||||
|
|
||||||
|
# Set Python path to include app directory
|
||||||
|
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
# Run the application using the configured uvicorn server
|
||||||
|
CMD ["poetry", "run", "python", "/api_initializer/app.py"]
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.account_records.cluster import AccountRecordsRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
account_records_router = APIRouter(prefix="/account/records", tags=["Account Cluster"])
|
||||||
|
|
||||||
|
|
||||||
|
account_records_list = "AccountRecordsList"
|
||||||
|
@account_records_router.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all account records endpoint",
|
||||||
|
operation_id=endpoints_index[account_records_list],
|
||||||
|
)
|
||||||
|
def people_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AccountRecordsRouterCluster.get_event_cluster(account_records_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, header=headers)
|
||||||
|
|
||||||
|
|
||||||
|
account_records_create = "AccountRecordsCreate"
|
||||||
|
@account_records_router.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create account records endpoint",
|
||||||
|
operation_id=endpoints_index[account_records_create],
|
||||||
|
)
|
||||||
|
def account_records_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AccountRecordsRouterCluster.get_event_cluster(account_records_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, header=headers)
|
||||||
|
|
||||||
|
|
||||||
|
account_records_update = "AccountRecordsUpdate"
|
||||||
|
@account_records_router.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update account records endpoint",
|
||||||
|
operation_id=endpoints_index[account_records_update],
|
||||||
|
)
|
||||||
|
def account_records_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AccountRecordsRouterCluster.get_event_cluster(account_records_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, header=headers)
|
||||||
|
|
||||||
|
|
||||||
|
account_records_delete = "AccountRecordsDelete"
|
||||||
|
@account_records_router.post(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete account records endpoint",
|
||||||
|
operation_id=endpoints_index[account_records_delete],
|
||||||
|
)
|
||||||
|
def account_records_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AccountRecordsRouterCluster.get_event_cluster(account_records_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, header=headers)
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from .account_records.router import account_records_router
|
||||||
|
|
||||||
|
def get_routes() -> list[APIRouter]:
|
||||||
|
return [account_records_router]
|
||||||
|
|
||||||
|
|
||||||
|
def get_safe_endpoint_urls() -> list[tuple[str, str]]:
|
||||||
|
return [
|
||||||
|
("/", "GET"),
|
||||||
|
("/docs", "GET"),
|
||||||
|
("/redoc", "GET"),
|
||||||
|
("/openapi.json", "GET"),
|
||||||
|
("/metrics", "GET"),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
from .account_records.cluster import AccountRecordsRouterCluster
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AccountRecordsRouterCluster",
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperAccountRecordsListEvent,
|
||||||
|
SuperAccountRecordsCreateEvent,
|
||||||
|
SuperAccountRecordsUpdateEvent,
|
||||||
|
SuperAccountRecordsDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
AccountRecordsRouterCluster = RouterCluster(name="AccountRecordsRouterCluster")
|
||||||
|
|
||||||
|
AccountRecordsListEventCluster = EventCluster(name="AccountRecordsListEventCluster", endpoint_uu_id=endpoints_index["AccountRecordsList"])
|
||||||
|
AccountRecordsListEventCluster.add_event(SuperAccountRecordsListEvent)
|
||||||
|
|
||||||
|
AccountRecordsCreateEventCluster = EventCluster(name="AccountRecordsCreateEventCluster", endpoint_uu_id=endpoints_index["AccountRecordsCreate"])
|
||||||
|
AccountRecordsCreateEventCluster.add_event(SuperAccountRecordsCreateEvent)
|
||||||
|
|
||||||
|
AccountRecordsUpdateEventCluster = EventCluster(name="AccountRecordsUpdateEventCluster", endpoint_uu_id=endpoints_index["AccountRecordsUpdate"])
|
||||||
|
AccountRecordsUpdateEventCluster.add_event(SuperAccountRecordsUpdateEvent)
|
||||||
|
|
||||||
|
AccountRecordsDeleteEventCluster = EventCluster(name="AccountRecordsDeleteEventCluster", endpoint_uu_id=endpoints_index["AccountRecordsDelete"])
|
||||||
|
AccountRecordsDeleteEventCluster.add_event(SuperAccountRecordsDeleteEvent)
|
||||||
|
|
||||||
|
AccountRecordsRouterCluster.set_event_cluster(AccountRecordsListEventCluster)
|
||||||
|
AccountRecordsRouterCluster.set_event_cluster(AccountRecordsCreateEventCluster)
|
||||||
|
AccountRecordsRouterCluster.set_event_cluster(AccountRecordsUpdateEventCluster)
|
||||||
|
AccountRecordsRouterCluster.set_event_cluster(AccountRecordsDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from schemas import AccountRecords
|
||||||
|
|
||||||
|
# List all account records endpoint Super Users
|
||||||
|
SuperAccountRecordsListEvent = Event(
|
||||||
|
name="super_account_records_list",
|
||||||
|
key="c5b6d9c7-9115-4825-bcc1-16f409a7004a",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Account Records List all flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create account records endpoint Super Users
|
||||||
|
SuperAccountRecordsCreateEvent = Event(
|
||||||
|
name="super_account_records_create",
|
||||||
|
key="1ab5c778-5a25-49d0-8bf8-799a74f430ad",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Account Records Create endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update account records endpoint Super Users
|
||||||
|
SuperAccountRecordsUpdateEvent = Event(
|
||||||
|
name="super_account_records_update",
|
||||||
|
key="137fca9b-110a-4a28-bddd-36fde7380e89",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Account Records Update endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete account records endpoint Super Users
|
||||||
|
SuperAccountRecordsDeleteEvent = Event(
|
||||||
|
name="super_account_records_delete",
|
||||||
|
key="8bf399a7-f79e-49d2-b481-f5974676599f",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Account Records Delete endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_account_records_list_callable(list_options: PaginateOnly, header: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-LIST",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAccountRecordsListEvent.event_callable = super_account_records_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_account_records_create_callable(data: AccountRecords, header: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-CREATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAccountRecordsCreateEvent.event_callable = super_account_records_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_account_records_update_callable(data: AccountRecords, header: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAccountRecordsUpdateEvent.event_callable = super_account_records_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_account_records_delete_callable(data: AccountRecords, header: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAccountRecordsDeleteEvent.event_callable = super_account_records_delete_callable
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
endpoints_index: dict = {
|
||||||
|
"AccountRecordsList": "7552d270-0e2a-4a40-bfd5-ec3493bc63ab",
|
||||||
|
"AccountRecordsCreate": "ddb956fb-73ef-4eec-a51b-ff54c3d65552",
|
||||||
|
"AccountRecordsUpdate": "6f120aca-b5a7-43ea-8214-9c17f9333c8a",
|
||||||
|
"AccountRecordsDelete": "5cc1de2d-de11-4bbe-9c19-5b8eec69e4a1",
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,8 @@ from schemas import (
|
||||||
Event2Occupant,
|
Event2Occupant,
|
||||||
Application2Employee,
|
Application2Employee,
|
||||||
RelationshipEmployee2Build,
|
RelationshipEmployee2Build,
|
||||||
|
Events,
|
||||||
|
EndpointRestriction,
|
||||||
)
|
)
|
||||||
from api_modules.token.password_module import PasswordModule
|
from api_modules.token.password_module import PasswordModule
|
||||||
from api_controllers.mongo.database import mongo_handler
|
from api_controllers.mongo.database import mongo_handler
|
||||||
|
|
@ -331,7 +333,11 @@ class LoginHandler:
|
||||||
ValueError("EYS_0010")
|
ValueError("EYS_0010")
|
||||||
|
|
||||||
# Get reachable events
|
# Get reachable events
|
||||||
reachable_event_codes = Event2Employee.get_event_codes(employee_id=int(result_with_keys_dict['Employees.id']), db=db_session)
|
# reachable_event_codes = Event2Employee.get_event_codes(employee_id=int(result_with_keys_dict['Employees.id']), db=db_session)
|
||||||
|
# TODO: erase this bypass later
|
||||||
|
filter_endpoints_and_events = db_session.query(EndpointRestriction.operation_uu_id, Events.function_code
|
||||||
|
).join(EndpointRestriction, EndpointRestriction.id == Events.endpoint_id).filter().all()
|
||||||
|
reachable_event_codes = {endpoint_name: function_code for endpoint_name, function_code in filter_endpoints_and_events}
|
||||||
# Get reachable applications
|
# Get reachable applications
|
||||||
reachable_app_codes = Application2Employee.get_application_codes(employee_id=int(result_with_keys_dict['Employees.id']), db=db_session)
|
reachable_app_codes = Application2Employee.get_application_codes(employee_id=int(result_with_keys_dict['Employees.id']), db=db_session)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# Install system dependencies and Poetry
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/* && pip install --no-cache-dir poetry
|
||||||
|
|
||||||
|
# Copy Poetry configuration
|
||||||
|
COPY /pyproject.toml ./pyproject.toml
|
||||||
|
|
||||||
|
# Configure Poetry and install dependencies with optimizations
|
||||||
|
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main && pip cache purge && rm -rf ~/.cache/pypoetry
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY /api_services/api_initializer /api_initializer
|
||||||
|
COPY /api_services/api_controllers /api_controllers
|
||||||
|
COPY /api_services/api_validations /api_validations
|
||||||
|
COPY /api_services/schemas /schemas
|
||||||
|
COPY /api_services/api_modules /api_modules
|
||||||
|
|
||||||
|
COPY /api_services/api_middlewares /api_middlewares
|
||||||
|
COPY /api_services/api_builds/building_service/endpoints /api_initializer/endpoints
|
||||||
|
COPY /api_services/api_builds/building_service/events /api_initializer/events
|
||||||
|
COPY /api_services/api_builds/building_service/validations /api_initializer/validations
|
||||||
|
COPY /api_services/api_builds/building_service/index.py /api_initializer/index.py
|
||||||
|
|
||||||
|
# Set Python path to include app directory
|
||||||
|
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
# Run the application using the configured uvicorn server
|
||||||
|
CMD ["poetry", "run", "python", "/api_initializer/app.py"]
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.areas.cluster import AreaRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
area_endpoint_route = APIRouter(prefix="/areas", tags=["Areas Cluster"])
|
||||||
|
|
||||||
|
area_list = "AreaList"
|
||||||
|
@area_endpoint_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all areas endpoint",
|
||||||
|
operation_id=endpoints_index[area_list],
|
||||||
|
)
|
||||||
|
def area_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AreaRouterCluster.get_event_cluster(area_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
area_create = "AreaCreate"
|
||||||
|
@area_endpoint_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create area endpoint",
|
||||||
|
operation_id=endpoints_index[area_create],
|
||||||
|
)
|
||||||
|
def area_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AreaRouterCluster.get_event_cluster(area_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
area_update = "AreaUpdate"
|
||||||
|
@area_endpoint_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update area endpoint",
|
||||||
|
operation_id=endpoints_index[area_update],
|
||||||
|
)
|
||||||
|
def area_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AreaRouterCluster.get_event_cluster(area_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
area_delete = "AreaDelete"
|
||||||
|
@area_endpoint_route.post(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete area endpoint",
|
||||||
|
operation_id=endpoints_index[area_delete],
|
||||||
|
)
|
||||||
|
def area_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = AreaRouterCluster.get_event_cluster(area_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, headers=headers)
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.building_parts.cluster import PartsRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
parts_endpoint_route = APIRouter(prefix="/parts", tags=["Parts Cluster"])
|
||||||
|
|
||||||
|
|
||||||
|
parts_list = "PartsList"
|
||||||
|
@parts_endpoint_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all parts endpoint",
|
||||||
|
operation_id=endpoints_index[parts_list],
|
||||||
|
)
|
||||||
|
def parts_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PartsRouterCluster.get_event_cluster(parts_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
parts_create = "PartsCreate"
|
||||||
|
@parts_endpoint_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create part endpoint",
|
||||||
|
operation_id=endpoints_index[parts_create],
|
||||||
|
)
|
||||||
|
def parts_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PartsRouterCluster.get_event_cluster(parts_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
parts_update = "PartsUpdate"
|
||||||
|
@parts_endpoint_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update part endpoint",
|
||||||
|
operation_id=endpoints_index[parts_update],
|
||||||
|
)
|
||||||
|
def parts_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PartsRouterCluster.get_event_cluster(parts_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
parts_delete = "PartsDelete"
|
||||||
|
@parts_endpoint_route.post(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete part endpoint",
|
||||||
|
operation_id=endpoints_index[parts_delete],
|
||||||
|
)
|
||||||
|
def parts_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PartsRouterCluster.get_event_cluster(parts_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, headers=headers)
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.builds.cluster import BuildRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
build_endpoint_route = APIRouter(prefix="/builds", tags=["Builds Cluster"])
|
||||||
|
|
||||||
|
build_list = "BuildList"
|
||||||
|
@build_endpoint_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all builds endpoint",
|
||||||
|
operation_id=endpoints_index[build_list],
|
||||||
|
)
|
||||||
|
def build_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = BuildRouterCluster.get_event_cluster(build_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
build_create = "BuildCreate"
|
||||||
|
@build_endpoint_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create build endpoint",
|
||||||
|
operation_id=endpoints_index[build_create],
|
||||||
|
)
|
||||||
|
def build_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = BuildRouterCluster.get_event_cluster(build_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
build_update = "BuildUpdate"
|
||||||
|
@build_endpoint_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update build endpoint",
|
||||||
|
operation_id=endpoints_index[build_update],
|
||||||
|
)
|
||||||
|
def build_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = BuildRouterCluster.get_event_cluster(build_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
build_delete = "BuildDelete"
|
||||||
|
@build_endpoint_route.post(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete build endpoint",
|
||||||
|
operation_id=endpoints_index[build_delete],
|
||||||
|
)
|
||||||
|
def build_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = BuildRouterCluster.get_event_cluster(build_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, headers=headers)
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.living_space.cluster import LivingSpaceRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
living_space_endpoint_route = APIRouter(prefix="/living-space", tags=["Living Space Cluster"])
|
||||||
|
|
||||||
|
|
||||||
|
living_space_list = "LivingSpaceList"
|
||||||
|
@living_space_endpoint_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all living spaces endpoint",
|
||||||
|
operation_id=endpoints_index[living_space_list],
|
||||||
|
)
|
||||||
|
def living_space_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = LivingSpaceRouterCluster.get_event_cluster(living_space_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
living_space_create = "LivingSpaceCreate"
|
||||||
|
@living_space_endpoint_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create living space endpoint",
|
||||||
|
operation_id=endpoints_index[living_space_create],
|
||||||
|
)
|
||||||
|
def living_space_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = LivingSpaceRouterCluster.get_event_cluster(living_space_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
living_space_update = "LivingSpaceUpdate"
|
||||||
|
@living_space_endpoint_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update living space endpoint",
|
||||||
|
operation_id=endpoints_index[living_space_update],
|
||||||
|
)
|
||||||
|
def living_space_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = LivingSpaceRouterCluster.get_event_cluster(living_space_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
living_space_delete = "LivingSpaceDelete"
|
||||||
|
@living_space_endpoint_route.post(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete living space endpoint",
|
||||||
|
operation_id=endpoints_index[living_space_delete],
|
||||||
|
)
|
||||||
|
def living_space_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = LivingSpaceRouterCluster.get_event_cluster(living_space_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, headers=headers)
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from .builds.router import build_endpoint_route
|
||||||
|
from .building_parts.router import parts_endpoint_route
|
||||||
|
from .areas.router import area_endpoint_route
|
||||||
|
from .living_space.router import living_space_endpoint_route
|
||||||
|
|
||||||
|
|
||||||
|
def get_routes() -> list[APIRouter]:
|
||||||
|
return [build_endpoint_route, parts_endpoint_route, area_endpoint_route, living_space_endpoint_route]
|
||||||
|
|
||||||
|
|
||||||
|
def get_safe_endpoint_urls() -> list[tuple[str, str]]:
|
||||||
|
return [
|
||||||
|
("/", "GET"),
|
||||||
|
("/docs", "GET"),
|
||||||
|
("/redoc", "GET"),
|
||||||
|
("/openapi.json", "GET"),
|
||||||
|
("/metrics", "GET"),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
from .builds.cluster import BuildRouterCluster
|
||||||
|
from .areas.cluster import AreaRouterCluster
|
||||||
|
from .living_space.cluster import LivingSpaceRouterCluster
|
||||||
|
from .building_parts.cluster import PartsRouterCluster
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"BuildRouterCluster",
|
||||||
|
"AreaRouterCluster",
|
||||||
|
"LivingSpaceRouterCluster",
|
||||||
|
"PartsRouterCluster",
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperAreaListEvent,
|
||||||
|
SuperAreaCreateEvent,
|
||||||
|
SuperAreaUpdateEvent,
|
||||||
|
SuperAreaDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
AreaRouterCluster = RouterCluster(name="AreaRouterCluster")
|
||||||
|
|
||||||
|
AreaListEventCluster = EventCluster(name="AreaListEventCluster", endpoint_uu_id=endpoints_index["AreaList"])
|
||||||
|
AreaListEventCluster.add_event(SuperAreaListEvent)
|
||||||
|
|
||||||
|
AreaCreateEventCluster = EventCluster(name="AreaCreateEventCluster", endpoint_uu_id=endpoints_index["AreaCreate"])
|
||||||
|
AreaCreateEventCluster.add_event(SuperAreaCreateEvent)
|
||||||
|
|
||||||
|
AreaUpdateEventCluster = EventCluster(name="AreaUpdateEventCluster", endpoint_uu_id=endpoints_index["AreaUpdate"])
|
||||||
|
AreaUpdateEventCluster.add_event(SuperAreaUpdateEvent)
|
||||||
|
|
||||||
|
AreaDeleteEventCluster = EventCluster(name="AreaDeleteEventCluster", endpoint_uu_id=endpoints_index["AreaDelete"])
|
||||||
|
AreaDeleteEventCluster.add_event(SuperAreaDeleteEvent)
|
||||||
|
|
||||||
|
AreaRouterCluster.set_event_cluster(AreaListEventCluster)
|
||||||
|
AreaRouterCluster.set_event_cluster(AreaCreateEventCluster)
|
||||||
|
AreaRouterCluster.set_event_cluster(AreaUpdateEventCluster)
|
||||||
|
AreaRouterCluster.set_event_cluster(AreaDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from schemas import (
|
||||||
|
BuildArea,
|
||||||
|
Build,
|
||||||
|
BuildParts,
|
||||||
|
AccountRecords,
|
||||||
|
)
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
|
||||||
|
|
||||||
|
# List all area Super User
|
||||||
|
SuperAreaListEvent = Event(
|
||||||
|
name="super_area_list",
|
||||||
|
key="0d5ba7be-028c-43ce-9a99-f495f812a835",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Area List all endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create area Super User
|
||||||
|
SuperAreaCreateEvent = Event(
|
||||||
|
name="super_area_create",
|
||||||
|
key="0ba2a06d-f4fa-47b9-a305-2225414ffc4a",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Area Create endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update area Super User
|
||||||
|
SuperAreaUpdateEvent = Event(
|
||||||
|
name="super_area_update",
|
||||||
|
key="ecec956a-eadf-4556-b4e1-4ee81a6b8fb2",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Area Update endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete area Super User
|
||||||
|
SuperAreaDeleteEvent = Event(
|
||||||
|
name="super_area_delete",
|
||||||
|
key="4b2ca548-4113-4942-8a76-1f4337fba98a",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Area Delete endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_area_list_callable(list_options: PaginateOnly, headers: CommonHeaders):
|
||||||
|
list_options = PaginateOnly(**list_options.model_dump())
|
||||||
|
if token.is_employee:
|
||||||
|
raise Exception("Forbidden for employees")
|
||||||
|
|
||||||
|
# TODO: Pydantic Model must be implemnted for list_options.query
|
||||||
|
with AccountRecords.new_session() as db_session:
|
||||||
|
AccountRecords.set_session(db_session)
|
||||||
|
list_of_fields = [
|
||||||
|
AccountRecords.iban,
|
||||||
|
AccountRecords.bank_date,
|
||||||
|
AccountRecords.currency,
|
||||||
|
AccountRecords.currency_value,
|
||||||
|
AccountRecords.process_comment,
|
||||||
|
AccountRecords.add_comment_note,
|
||||||
|
AccountRecords.receive_debit,
|
||||||
|
AccountRecords.is_email_send,
|
||||||
|
AccountRecords.is_notification_send,
|
||||||
|
]
|
||||||
|
account_records_query = db_session.query(*list_of_fields
|
||||||
|
).join(BuildParts, BuildParts.id == AccountRecords.build_parts_id
|
||||||
|
).filter(BuildParts.id == token.selected_occupant.build_part_id)
|
||||||
|
if list_options.query:
|
||||||
|
account_records_query = account_records_query.filter(*AccountRecords.convert(list_options.query))
|
||||||
|
|
||||||
|
pagination = Pagination(data=account_records_query)
|
||||||
|
pagination.change(**list_options.model_dump())
|
||||||
|
pagination_result = PaginationResult(data=account_records_query, pagination=pagination)
|
||||||
|
return EndpointResponse(message="MSG0003-LIST", pagination_result=pagination_result).response
|
||||||
|
|
||||||
|
|
||||||
|
SuperAreaListEvent.event_callable = super_area_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_area_create_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0001-INSERT",
|
||||||
|
"data": data,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAreaCreateEvent.event_callable = super_area_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_area_update_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0002-UPDATE",
|
||||||
|
"data": data,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAreaUpdateEvent.event_callable = super_area_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_area_delete_callable(uu_id: str, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-DELETE",
|
||||||
|
"data": data,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperAreaDeleteEvent.event_callable = super_area_delete_callable
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperPartsListEvent,
|
||||||
|
SuperPartsCreateEvent,
|
||||||
|
SuperPartsUpdateEvent,
|
||||||
|
SuperPartsDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
PartsRouterCluster = RouterCluster(name="PartsRouterCluster")
|
||||||
|
|
||||||
|
PartsListEventCluster = EventCluster(name="PartsListEventCluster", endpoint_uu_id=endpoints_index["PartsList"])
|
||||||
|
PartsListEventCluster.add_event(SuperPartsListEvent)
|
||||||
|
|
||||||
|
PartsCreateEventCluster = EventCluster(name="PartsCreateEventCluster", endpoint_uu_id=endpoints_index["PartsCreate"])
|
||||||
|
PartsCreateEventCluster.add_event(SuperPartsCreateEvent)
|
||||||
|
|
||||||
|
PartsUpdateEventCluster = EventCluster(name="PartsUpdateEventCluster", endpoint_uu_id=endpoints_index["PartsUpdate"])
|
||||||
|
PartsUpdateEventCluster.add_event(SuperPartsUpdateEvent)
|
||||||
|
|
||||||
|
PartsDeleteEventCluster = EventCluster(name="PartsDeleteEventCluster", endpoint_uu_id=endpoints_index["PartsDelete"])
|
||||||
|
PartsDeleteEventCluster.add_event(SuperPartsDeleteEvent)
|
||||||
|
|
||||||
|
PartsRouterCluster.set_event_cluster(PartsListEventCluster)
|
||||||
|
PartsRouterCluster.set_event_cluster(PartsCreateEventCluster)
|
||||||
|
PartsRouterCluster.set_event_cluster(PartsUpdateEventCluster)
|
||||||
|
PartsRouterCluster.set_event_cluster(PartsDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from schemas import (
|
||||||
|
Build,
|
||||||
|
BuildParts,
|
||||||
|
AccountRecords,
|
||||||
|
)
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
|
||||||
|
|
||||||
|
# List all endpoint Super Parts
|
||||||
|
SuperPartsListEvent = Event(
|
||||||
|
name="super_parts_list",
|
||||||
|
key="018e659d-380d-4b2a-b5a4-d77530cb8de0",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Parts List all endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create endpoint Super Parts
|
||||||
|
SuperPartsCreateEvent = Event(
|
||||||
|
name="super_parts_create",
|
||||||
|
key="fdfede54-f0e7-4d48-8eae-269479ad9abb",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Parts Create endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update endpoint Super Parts
|
||||||
|
SuperPartsUpdateEvent = Event(
|
||||||
|
name="super_parts_update",
|
||||||
|
key="ace6137c-fe8e-45bd-ae51-bc1c293f8373",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Parts Update endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete endpoint Super Parts
|
||||||
|
SuperPartsDeleteEvent = Event(
|
||||||
|
name="super_parts_delete",
|
||||||
|
key="8fb7f505-7a3a-4260-9959-ae0e5c8f9bfe",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Parts Delete endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_parts_list_callable(list_options: PaginateOnly, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-LIST",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPartsListEvent.event_callable = super_parts_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_parts_create_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0001-INSERT",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPartsCreateEvent.event_callable = super_parts_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_parts_update_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0002-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPartsUpdateEvent.event_callable = super_parts_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_parts_delete_callable(uu_id: str, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPartsDeleteEvent.event_callable = super_parts_delete_callable
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperBuildListEvent,
|
||||||
|
SuperBuildCreateEvent,
|
||||||
|
SuperBuildUpdateEvent,
|
||||||
|
SuperBuildDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
BuildRouterCluster = RouterCluster(name="BuildRouterCluster")
|
||||||
|
|
||||||
|
BuildListEventCluster = EventCluster(name="BuildListEventCluster", endpoint_uu_id=endpoints_index["BuildList"])
|
||||||
|
BuildListEventCluster.add_event(SuperBuildListEvent)
|
||||||
|
|
||||||
|
BuildCreateEventCluster = EventCluster(name="BuildCreateEventCluster", endpoint_uu_id=endpoints_index["BuildCreate"])
|
||||||
|
BuildCreateEventCluster.add_event(SuperBuildCreateEvent)
|
||||||
|
|
||||||
|
BuildUpdateEventCluster = EventCluster(name="BuildUpdateEventCluster", endpoint_uu_id=endpoints_index["BuildUpdate"])
|
||||||
|
BuildUpdateEventCluster.add_event(SuperBuildUpdateEvent)
|
||||||
|
|
||||||
|
BuildDeleteEventCluster = EventCluster(name="BuildDeleteEventCluster", endpoint_uu_id=endpoints_index["BuildDelete"])
|
||||||
|
BuildDeleteEventCluster.add_event(SuperBuildDeleteEvent)
|
||||||
|
|
||||||
|
BuildRouterCluster.set_event_cluster(BuildListEventCluster)
|
||||||
|
BuildRouterCluster.set_event_cluster(BuildCreateEventCluster)
|
||||||
|
BuildRouterCluster.set_event_cluster(BuildUpdateEventCluster)
|
||||||
|
BuildRouterCluster.set_event_cluster(BuildDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from schemas import (
|
||||||
|
Build,
|
||||||
|
BuildParts,
|
||||||
|
AccountRecords,
|
||||||
|
)
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
|
||||||
|
|
||||||
|
# List all endpoint FL-REP
|
||||||
|
SuperBuildListEvent = Event(
|
||||||
|
name="build_list",
|
||||||
|
key="e8586858-db39-4520-bb1a-338ab9c5f043",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Build List all endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
SuperBuildCreateEvent = Event(
|
||||||
|
name="build_create",
|
||||||
|
key="79519e0f-c4a6-4afc-a494-d0e547ba39bc",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Build Create endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
SuperBuildUpdateEvent = Event(
|
||||||
|
name="build_update",
|
||||||
|
key="ca51080e-11f2-46f7-a1ba-caa1c40b3fd6",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Build Update endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
SuperBuildDeleteEvent = Event(
|
||||||
|
name="build_delete",
|
||||||
|
key="a30d32cc-c931-41d6-8a66-d6c04479098f",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Build Delete endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_build_list_callable(list_options: PaginateOnly, headers: CommonHeaders):
|
||||||
|
list_options = PaginateOnly(**list_options.model_dump())
|
||||||
|
if token.is_employee:
|
||||||
|
raise Exception("Forbidden for employees")
|
||||||
|
|
||||||
|
# TODO: Pydantic Model must be implemnted for list_options.query
|
||||||
|
with AccountRecords.new_session() as db_session:
|
||||||
|
AccountRecords.set_session(db_session)
|
||||||
|
list_of_fields = [
|
||||||
|
AccountRecords.iban,
|
||||||
|
AccountRecords.bank_date,
|
||||||
|
AccountRecords.currency,
|
||||||
|
AccountRecords.currency_value,
|
||||||
|
AccountRecords.process_comment,
|
||||||
|
AccountRecords.add_comment_note,
|
||||||
|
AccountRecords.receive_debit,
|
||||||
|
AccountRecords.is_email_send,
|
||||||
|
AccountRecords.is_notification_send,
|
||||||
|
]
|
||||||
|
account_records_query = db_session.query(*list_of_fields
|
||||||
|
).join(BuildParts, BuildParts.id == AccountRecords.build_parts_id
|
||||||
|
).filter(BuildParts.id == token.selected_occupant.build_part_id)
|
||||||
|
if list_options.query:
|
||||||
|
account_records_query = account_records_query.filter(*AccountRecords.convert(list_options.query))
|
||||||
|
|
||||||
|
pagination = Pagination(data=account_records_query)
|
||||||
|
pagination.change(**list_options.model_dump())
|
||||||
|
pagination_result = PaginationResult(data=account_records_query, pagination=pagination)
|
||||||
|
return EndpointResponse(message="MSG0003-LIST", pagination_result=pagination_result).response
|
||||||
|
|
||||||
|
|
||||||
|
SuperBuildListEvent.event_callable = super_build_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_build_create_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0001-INSERT",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperBuildCreateEvent.event_callable = super_build_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_build_update_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0002-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperBuildUpdateEvent.event_callable = super_build_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_build_delete_callable(uu_id: str, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperBuildDeleteEvent.event_callable = super_build_delete_callable
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperLivingSpaceListEvent,
|
||||||
|
SuperLivingSpaceCreateEvent,
|
||||||
|
SuperLivingSpaceUpdateEvent,
|
||||||
|
SuperLivingSpaceDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
LivingSpaceRouterCluster = RouterCluster(name="LivingSpaceRouterCluster")
|
||||||
|
|
||||||
|
LivingSpaceListEventCluster = EventCluster(name="LivingSpaceListEventCluster", endpoint_uu_id=endpoints_index["LivingSpaceList"])
|
||||||
|
LivingSpaceListEventCluster.add_event(SuperLivingSpaceListEvent)
|
||||||
|
|
||||||
|
LivingSpaceCreateEventCluster = EventCluster(name="LivingSpaceCreateEventCluster", endpoint_uu_id=endpoints_index["LivingSpaceCreate"])
|
||||||
|
LivingSpaceCreateEventCluster.add_event(SuperLivingSpaceCreateEvent)
|
||||||
|
|
||||||
|
LivingSpaceUpdateEventCluster = EventCluster(name="LivingSpaceUpdateEventCluster", endpoint_uu_id=endpoints_index["LivingSpaceUpdate"])
|
||||||
|
LivingSpaceUpdateEventCluster.add_event(SuperLivingSpaceUpdateEvent)
|
||||||
|
|
||||||
|
LivingSpaceDeleteEventCluster = EventCluster(name="LivingSpaceDeleteEventCluster", endpoint_uu_id=endpoints_index["LivingSpaceDelete"])
|
||||||
|
LivingSpaceDeleteEventCluster.add_event(SuperLivingSpaceDeleteEvent)
|
||||||
|
|
||||||
|
LivingSpaceRouterCluster.set_event_cluster(LivingSpaceListEventCluster)
|
||||||
|
LivingSpaceRouterCluster.set_event_cluster(LivingSpaceCreateEventCluster)
|
||||||
|
LivingSpaceRouterCluster.set_event_cluster(LivingSpaceUpdateEventCluster)
|
||||||
|
LivingSpaceRouterCluster.set_event_cluster(LivingSpaceDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from schemas import (
|
||||||
|
Build,
|
||||||
|
BuildParts,
|
||||||
|
AccountRecords,
|
||||||
|
)
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
|
||||||
|
|
||||||
|
# List all endpoint FL-REP
|
||||||
|
SuperLivingSpaceListEvent = Event(
|
||||||
|
name="super_living_space_list",
|
||||||
|
key="e3eced11-c464-4893-8b49-d2858c160ed0",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Living Space List all endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
SuperLivingSpaceCreateEvent = Event(
|
||||||
|
name="super_living_space_create",
|
||||||
|
key="9e26f770-3475-4831-9da9-4684119b13ae",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Living Space Create endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
SuperLivingSpaceUpdateEvent = Event(
|
||||||
|
name="super_living_space_update",
|
||||||
|
key="ecd15d27-e5e8-4bd1-972b-9b4508cfac77",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Living Space Update endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
SuperLivingSpaceDeleteEvent = Event(
|
||||||
|
name="super_living_space_delete",
|
||||||
|
key="4fcadb8c-2e26-4af3-acb5-bcbf87cae0c0",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Living Space Delete endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_living_space_list_callable(list_options: PaginateOnly, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-LIST",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperLivingSpaceListEvent.event_callable = super_living_space_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_living_space_create_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0001-INSERT",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperLivingSpaceCreateEvent.event_callable = super_living_space_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_living_space_update_callable(data, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0002-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperLivingSpaceUpdateEvent.event_callable = super_living_space_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_living_space_delete_callable(uu_id: str, headers: CommonHeaders):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperLivingSpaceDeleteEvent.event_callable = super_living_space_delete_callable
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
|
||||||
|
endpoints_index: dict = {
|
||||||
|
"AreaList": "31382497-e0fd-4574-9684-072a85ce8f29",
|
||||||
|
"AreaCreate": "e8b1c9ee-a25a-4434-a018-31866826f1ed",
|
||||||
|
"AreaUpdate": "c57093e1-0e0b-459b-bedf-87280c040ab1",
|
||||||
|
"AreaDelete": "e5239349-99c8-4fe1-8db9-4876abf25686",
|
||||||
|
"BuildList": "b34319e8-1829-426e-b0ab-9c6a1a3a8cbd",
|
||||||
|
"BuildCreate": "66c3ed83-ce3c-4c3c-a158-aa5bef20a3e8",
|
||||||
|
"BuildUpdate": "d0587d29-da23-4c11-a861-c27fe7f81761",
|
||||||
|
"BuildDelete": "13382948-d259-484e-b30f-3b42f9e20a42",
|
||||||
|
"LivingSpaceList": "98d9ac9e-fca4-4b0a-bf1e-ba2b3348c873",
|
||||||
|
"LivingSpaceCreate": "319e3777-4a19-4f32-b7bd-e7af3a9e541c",
|
||||||
|
"LivingSpaceUpdate": "e4873948-7aa5-46cd-9c41-42c33339f4d6",
|
||||||
|
"LivingSpaceDelete": "ead99b10-efad-4ddb-8b7c-3c9474238a20",
|
||||||
|
"PartsList": "d8bb7636-b768-4083-9313-af63fea1d1c3",
|
||||||
|
"PartsCreate": "755588f0-aabb-4be0-9a49-2be47ea4aaee",
|
||||||
|
"PartsUpdate": "44493fe1-367c-4eb9-afbf-bc7f7daca158",
|
||||||
|
"PartsDelete": "f2cea40b-295b-4a55-9b13-02c82979c53e",
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# Install system dependencies and Poetry
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/* && pip install --no-cache-dir poetry
|
||||||
|
|
||||||
|
# Copy Poetry configuration
|
||||||
|
COPY /pyproject.toml ./pyproject.toml
|
||||||
|
|
||||||
|
# Configure Poetry and install dependencies with optimizations
|
||||||
|
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main && pip cache purge && rm -rf ~/.cache/pypoetry
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY /api_services/api_initializer /api_initializer
|
||||||
|
COPY /api_services/api_controllers /api_controllers
|
||||||
|
COPY /api_services/api_validations /api_validations
|
||||||
|
COPY /api_services/schemas /schemas
|
||||||
|
COPY /api_services/api_modules /api_modules
|
||||||
|
|
||||||
|
COPY /api_services/api_middlewares /api_middlewares
|
||||||
|
COPY /api_services/api_builds/identity_service/endpoints /api_initializer/endpoints
|
||||||
|
COPY /api_services/api_builds/identity_service/events /api_initializer/events
|
||||||
|
COPY /api_services/api_builds/identity_service/validations /api_initializer/validations
|
||||||
|
COPY /api_services/api_builds/identity_service/index.py /api_initializer/index.py
|
||||||
|
|
||||||
|
# Set Python path to include app directory
|
||||||
|
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
# Run the application using the configured uvicorn server
|
||||||
|
CMD ["poetry", "run", "python", "/api_initializer/app.py"]
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.people.cluster import PeopleRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
people_endpoint_route = APIRouter(prefix="/people", tags=["People Cluster"])
|
||||||
|
|
||||||
|
|
||||||
|
people_list = "PeopleList"
|
||||||
|
@people_endpoint_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all people endpoint",
|
||||||
|
operation_id=endpoints_index[people_list],
|
||||||
|
)
|
||||||
|
def people_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PeopleRouterCluster.get_event_cluster(people_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
people_create = "PeopleCreate"
|
||||||
|
@people_endpoint_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create people endpoint",
|
||||||
|
operation_id=endpoints_index[people_create],
|
||||||
|
)
|
||||||
|
def people_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PeopleRouterCluster.get_event_cluster(people_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
people_update = "PeopleUpdate"
|
||||||
|
@people_endpoint_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update people endpoint",
|
||||||
|
operation_id=endpoints_index[people_update],
|
||||||
|
)
|
||||||
|
def people_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PeopleRouterCluster.get_event_cluster(people_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, header=headers)
|
||||||
|
|
||||||
|
|
||||||
|
people_delete = "PeopleDelete"
|
||||||
|
@people_endpoint_route.delete(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete people endpoint",
|
||||||
|
operation_id=endpoints_index[people_delete],
|
||||||
|
)
|
||||||
|
def people_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = PeopleRouterCluster.get_event_cluster(people_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, headers=headers)
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from .people.router import people_endpoint_route
|
||||||
|
from .user.router import user_endpoint_route
|
||||||
|
|
||||||
|
|
||||||
|
def get_routes() -> list[APIRouter]:
|
||||||
|
return [people_endpoint_route, user_endpoint_route]
|
||||||
|
|
||||||
|
|
||||||
|
def get_safe_endpoint_urls() -> list[tuple[str, str]]:
|
||||||
|
return [
|
||||||
|
("/", "GET"),
|
||||||
|
("/docs", "GET"),
|
||||||
|
("/redoc", "GET"),
|
||||||
|
("/openapi.json", "GET"),
|
||||||
|
("/metrics", "GET"),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
from events.user.cluster import UserRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
user_endpoint_route = APIRouter(prefix="/users", tags=["User Cluster"])
|
||||||
|
|
||||||
|
|
||||||
|
user_list = "UserList"
|
||||||
|
@user_endpoint_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all users endpoint",
|
||||||
|
operation_id=endpoints_index[user_list],
|
||||||
|
)
|
||||||
|
def user_list_route(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = UserRouterCluster.get_event_cluster(user_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
user_create = "UserCreate"
|
||||||
|
@user_endpoint_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create user endpoint",
|
||||||
|
operation_id=endpoints_index[user_create],
|
||||||
|
)
|
||||||
|
def user_create_route(data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = UserRouterCluster.get_event_cluster(user_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
user_update = "UserUpdate"
|
||||||
|
@user_endpoint_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update user endpoint",
|
||||||
|
operation_id=endpoints_index[user_update],
|
||||||
|
)
|
||||||
|
def user_update_route(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = UserRouterCluster.get_event_cluster(user_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, data=data, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
user_delete = "UserDelete"
|
||||||
|
@user_endpoint_route.delete(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete user endpoint",
|
||||||
|
operation_id=endpoints_index[user_delete],
|
||||||
|
)
|
||||||
|
def user_delete_route(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders.as_dependency)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = UserRouterCluster.get_event_cluster(user_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(uu_id=uu_id, headers=headers)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
from .people.cluster import PeopleRouterCluster
|
||||||
|
from .user.cluster import UserRouterCluster
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"PeopleRouterCluster",
|
||||||
|
"UserRouterCluster",
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperPeopleListEvent,
|
||||||
|
SuperPeopleCreateEvent,
|
||||||
|
SuperPeopleUpdateEvent,
|
||||||
|
SuperPeopleDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
PeopleRouterCluster = RouterCluster(name="PeopleRouterCluster")
|
||||||
|
|
||||||
|
PeopleListEventCluster = EventCluster(name="PeopleListEventCluster", endpoint_uu_id=endpoints_index["PeopleList"])
|
||||||
|
PeopleListEventCluster.add_event(SuperPeopleListEvent)
|
||||||
|
|
||||||
|
PeopleCreateEventCluster = EventCluster(name="PeopleCreateEventCluster", endpoint_uu_id=endpoints_index["PeopleCreate"])
|
||||||
|
PeopleCreateEventCluster.add_event(SuperPeopleCreateEvent)
|
||||||
|
|
||||||
|
PeopleUpdateEventCluster = EventCluster(name="PeopleUpdateEventCluster", endpoint_uu_id=endpoints_index["PeopleUpdate"])
|
||||||
|
PeopleUpdateEventCluster.add_event(SuperPeopleUpdateEvent)
|
||||||
|
|
||||||
|
PeopleDeleteEventCluster = EventCluster(name="PeopleDeleteEventCluster", endpoint_uu_id=endpoints_index["PeopleDelete"])
|
||||||
|
PeopleDeleteEventCluster.add_event(SuperPeopleDeleteEvent)
|
||||||
|
|
||||||
|
PeopleRouterCluster.set_event_cluster(PeopleListEventCluster)
|
||||||
|
PeopleRouterCluster.set_event_cluster(PeopleCreateEventCluster)
|
||||||
|
PeopleRouterCluster.set_event_cluster(PeopleUpdateEventCluster)
|
||||||
|
PeopleRouterCluster.set_event_cluster(PeopleDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from api_validations.token.validations import TokenDictType
|
||||||
|
from schemas import (
|
||||||
|
Build,
|
||||||
|
BuildLivingSpace,
|
||||||
|
BuildParts,
|
||||||
|
People,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# List all endpoint Super User
|
||||||
|
SuperPeopleListEvent = Event(
|
||||||
|
name="super_people_list",
|
||||||
|
key="0f8a8b7f-0615-4507-916b-030d48cb5c1d",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super People List all flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create endpoint Super User
|
||||||
|
SuperPeopleCreateEvent = Event(
|
||||||
|
name="super_people_create",
|
||||||
|
key="e18657b7-7a5a-43b8-b43a-422cbc783326",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super People Create flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update endpoint Super User
|
||||||
|
SuperPeopleUpdateEvent = Event(
|
||||||
|
name="super_people_update",
|
||||||
|
key="02a774aa-1f7d-472b-98f1-7b4a58d43e31",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super People Update flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete endpoint Super User
|
||||||
|
SuperPeopleDeleteEvent = Event(
|
||||||
|
name="super_people_delete",
|
||||||
|
key="b56fd146-b11a-466a-84c9-4c72fb0b9ffa",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super People Delete flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_people_list_callable(list_options: PaginateOnly, token: TokenDictType):
|
||||||
|
list_options = PaginateOnly(**list_options.model_dump())
|
||||||
|
if token.is_employee:
|
||||||
|
raise Exception("Forbidden for employees")
|
||||||
|
|
||||||
|
# TODO: Pydantic Model must be implemnted for list_options.query
|
||||||
|
with People.new_session() as db_session:
|
||||||
|
People.set_session(db_session)
|
||||||
|
db_session.query(
|
||||||
|
).join(BuildParts, BuildParts.id == BuildLivingSpace.build_parts_id
|
||||||
|
).join(People, People.person_id == BuildLivingSpace.people_id
|
||||||
|
).filter()
|
||||||
|
if list_options.query:
|
||||||
|
people_list = People.query.filter(*People.convert(list_options.query))
|
||||||
|
else:
|
||||||
|
people_list = People.query.filter()
|
||||||
|
|
||||||
|
pagination = Pagination(data=people_list)
|
||||||
|
pagination.change(**list_options.model_dump())
|
||||||
|
pagination_result = PaginationResult(data=people_list, pagination=pagination)
|
||||||
|
return EndpointResponse(message="MSG0003-LIST", pagination_result=pagination_result).response
|
||||||
|
|
||||||
|
|
||||||
|
SuperPeopleListEvent.event_callable = super_people_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_people_create_callable(data: People, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0001-INSERT",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPeopleCreateEvent.event_callable = super_people_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_people_update_callable(data: People, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0002-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPeopleUpdateEvent.event_callable = super_people_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_people_delete_callable(data: People, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0004-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperPeopleDeleteEvent.event_callable = super_people_delete_callable
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperUserListEvent,
|
||||||
|
SuperUserCreateEvent,
|
||||||
|
SuperUserUpdateEvent,
|
||||||
|
SuperUserDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
UserRouterCluster = RouterCluster(name="UserRouterCluster")
|
||||||
|
|
||||||
|
UserListAllEventCluster = EventCluster(name="UserListAllEventCluster", endpoint_uu_id=endpoints_index["UserList"])
|
||||||
|
UserListAllEventCluster.add_event(SuperUserListEvent)
|
||||||
|
|
||||||
|
UserCreateEventCluster = EventCluster(name="UserCreateEventCluster", endpoint_uu_id=endpoints_index["UserCreate"])
|
||||||
|
UserCreateEventCluster.add_event(SuperUserCreateEvent)
|
||||||
|
|
||||||
|
UserUpdateEventCluster = EventCluster(name="UserUpdateEventCluster", endpoint_uu_id=endpoints_index["UserUpdate"])
|
||||||
|
UserUpdateEventCluster.add_event(SuperUserUpdateEvent)
|
||||||
|
|
||||||
|
UserDeleteEventCluster = EventCluster(name="UserDeleteEventCluster", endpoint_uu_id=endpoints_index["UserDelete"])
|
||||||
|
UserDeleteEventCluster.add_event(SuperUserDeleteEvent)
|
||||||
|
|
||||||
|
UserRouterCluster.set_event_cluster(UserListAllEventCluster)
|
||||||
|
UserRouterCluster.set_event_cluster(UserCreateEventCluster)
|
||||||
|
UserRouterCluster.set_event_cluster(UserUpdateEventCluster)
|
||||||
|
UserRouterCluster.set_event_cluster(UserDeleteEventCluster)
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from api_validations.token.validations import TokenDictType
|
||||||
|
from schemas import (
|
||||||
|
Build,
|
||||||
|
BuildLivingSpace,
|
||||||
|
BuildParts,
|
||||||
|
Users,
|
||||||
|
UsersTokens,
|
||||||
|
People,
|
||||||
|
)
|
||||||
|
|
||||||
|
# List all endpoint Super User
|
||||||
|
SuperUserListEvent = Event(
|
||||||
|
name="super_user_list",
|
||||||
|
key="202eec81-b382-4623-911b-709f1b841f3f",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users List all flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create endpoint Super User
|
||||||
|
SuperUserCreateEvent = Event(
|
||||||
|
name="super_user_create",
|
||||||
|
key="2f0a3691-114d-48b7-b166-9572fc889695",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users Create flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update endpoint Super User
|
||||||
|
SuperUserUpdateEvent = Event(
|
||||||
|
name="super_user_update",
|
||||||
|
key="8a8c8dd6-43ad-40df-86bd-345488273f52",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users Update flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete endpoint Super User
|
||||||
|
SuperUserDeleteEvent = Event(
|
||||||
|
name="super_user_delete",
|
||||||
|
key="e8c77554-4b0e-491f-aab5-67a5ef670999",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users Delete flat representative users endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_user_list_callable(list_options: PaginateOnly, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-LIST",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperUserListEvent.event_callable = super_user_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_user_create_callable(data: dict, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0001-INSERT",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperUserCreateEvent.event_callable = super_user_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_user_update_callable(data: dict, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0002-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperUserUpdateEvent.event_callable = super_user_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_user_delete_callable(data: dict, token: TokenDictType):
|
||||||
|
return {
|
||||||
|
"message": "MSG0004-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperUserDeleteEvent.event_callable = super_user_delete_callable
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
endpoints_index: dict = {
|
||||||
|
"UserList": "5a4ebed3-f764-473c-bc80-57b14082b636",
|
||||||
|
"UserCreate": "4fb2e886-98b4-49c7-a388-7e0607893af7",
|
||||||
|
"UserUpdate": "d4b046ac-0a93-4804-a233-8ee616152c5a",
|
||||||
|
"UserDelete": "98d5deac-8517-42da-8ce8-6a0ed79ba915",
|
||||||
|
"PeopleList": "155d7d42-9f41-4126-be3a-c3367a507f95",
|
||||||
|
"PeopleCreate": "b4d785a7-aac7-4d55-9aa3-bac871fe7252",
|
||||||
|
"PeopleUpdate": "448e1b4e-60b4-467f-a5cc-02c37522d5cc",
|
||||||
|
"PeopleDelete": "72a59bcd-52e5-42ec-b491-59c21c5e4014",
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
from typing import Any
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
|
from index import endpoints_index
|
||||||
|
# from events.services.cluster import ServicesEndpointRouterCluster
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
|
# Create API router
|
||||||
|
duty_types_route = APIRouter(prefix="/duty/types", tags=["Duty Types Cluster"])
|
||||||
|
|
@ -2,7 +2,7 @@ from typing import Any
|
||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from index import endpoints_index
|
from index import endpoints_index
|
||||||
# from events.services.cluster import ServicesEndpointRouterCluster
|
from events.services.cluster import ServicesRouterCluster
|
||||||
|
|
||||||
from api_validations.defaults.validations import CommonHeaders
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
from api_validations.response.pagination import PaginateOnly
|
from api_validations.response.pagination import PaginateOnly
|
||||||
|
|
@ -10,4 +10,65 @@ from api_middlewares.token_provider import TokenProvider
|
||||||
|
|
||||||
|
|
||||||
# Create API router
|
# Create API router
|
||||||
services_endpoint_route = APIRouter(prefix="/services", tags=["Service Cluster"])
|
services_route = APIRouter(prefix="/services", tags=["Service Cluster"])
|
||||||
|
|
||||||
|
|
||||||
|
services_list = "ServicesList"
|
||||||
|
@services_route.post(
|
||||||
|
path="/list",
|
||||||
|
description="List all services endpoint",
|
||||||
|
operation_id=endpoints_index[services_list],
|
||||||
|
)
|
||||||
|
def services_list(data: PaginateOnly, headers: CommonHeaders = Depends(CommonHeaders)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = ServicesRouterCluster.get_event_cluster(services_list)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data)
|
||||||
|
|
||||||
|
|
||||||
|
services_create = "ServicesCreate"
|
||||||
|
@services_route.post(
|
||||||
|
path="/create",
|
||||||
|
description="Create service endpoint",
|
||||||
|
operation_id=endpoints_index[services_create],
|
||||||
|
)
|
||||||
|
def services_create(data, headers: CommonHeaders = Depends(CommonHeaders)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = ServicesRouterCluster.get_event_cluster(services_create)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data)
|
||||||
|
|
||||||
|
|
||||||
|
services_update = "ServicesUpdate"
|
||||||
|
@services_route.post(
|
||||||
|
path="/update/{uu_id}",
|
||||||
|
description="Update service endpoint",
|
||||||
|
operation_id=endpoints_index[services_update],
|
||||||
|
)
|
||||||
|
def services_update(uu_id: str, data, headers: CommonHeaders = Depends(CommonHeaders)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = ServicesRouterCluster.get_event_cluster(services_update)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data)
|
||||||
|
|
||||||
|
|
||||||
|
services_delete = "ServicesDelete"
|
||||||
|
@services_route.post(
|
||||||
|
path="/delete/{uu_id}",
|
||||||
|
description="Delete service endpoint",
|
||||||
|
operation_id=endpoints_index[services_delete],
|
||||||
|
)
|
||||||
|
def services_delete(uu_id: str, headers: CommonHeaders = Depends(CommonHeaders)):
|
||||||
|
token_object = TokenProvider.get_dict_from_redis(token=headers.token)
|
||||||
|
event_founder_dict = dict(endpoint_code=headers.operation_id, token=token_object)
|
||||||
|
event_key = TokenProvider.retrieve_event_codes(**event_founder_dict)
|
||||||
|
FoundCluster = ServicesRouterCluster.get_event_cluster(services_delete)
|
||||||
|
event_cluster_matched = FoundCluster.match_event(event_key=event_key)
|
||||||
|
return event_cluster_matched.event_callable(list_options=data)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
from .events.cluster import EventsEndpointRouterCluster
|
||||||
|
from .application.cluster import ApplicationRouterCluster
|
||||||
|
# from .services.cluster import ServicesEndpointRouterCluster
|
||||||
|
|
||||||
|
__all__ = ["EventsEndpointRouterCluster", "ApplicationRouterCluster"]
|
||||||
__all__ = []
|
|
||||||
|
|
@ -103,10 +103,11 @@ ApplicationBindOccupantEvent = Event(
|
||||||
def application_list_all_callable(list_options: PaginateOnly):
|
def application_list_all_callable(list_options: PaginateOnly):
|
||||||
list_options = PaginateOnly(**list_options.model_dump())
|
list_options = PaginateOnly(**list_options.model_dump())
|
||||||
with Applications.new_session() as db_session:
|
with Applications.new_session() as db_session:
|
||||||
|
Applications.set_session(db_session)
|
||||||
if list_options.query:
|
if list_options.query:
|
||||||
applications_list = Applications.filter_all(*Applications.convert(list_options.query), db=db_session)
|
applications_list = Applications.query.filter(*Applications.convert(list_options.query))
|
||||||
else:
|
else:
|
||||||
applications_list = Applications.filter_all(db=db_session)
|
applications_list = Applications.query.filter()
|
||||||
pagination = Pagination(data=applications_list)
|
pagination = Pagination(data=applications_list)
|
||||||
pagination.change(**list_options.model_dump())
|
pagination.change(**list_options.model_dump())
|
||||||
pagination_result = PaginationResult(data=applications_list, pagination=pagination)
|
pagination_result = PaginationResult(data=applications_list, pagination=pagination)
|
||||||
|
|
@ -131,19 +132,13 @@ def application_list_available_callable(list_options: PaginateOnly):
|
||||||
list_options.query.pop("service_uu_id__ilike", None)
|
list_options.query.pop("service_uu_id__ilike", None)
|
||||||
list_options.query.pop("service_uu_id", None)
|
list_options.query.pop("service_uu_id", None)
|
||||||
with Applications.new_session() as db_session:
|
with Applications.new_session() as db_session:
|
||||||
service2applications = Service2Application.filter_all(
|
Service2Application.set_session(db_session)
|
||||||
*Service2Application.convert({"service_uu_id__ilike": service_uu_id}),
|
service2applications = Service2Application.query.filter(*Service2Application.convert({"service_uu_id__ilike": service_uu_id})).all()
|
||||||
db=db_session,
|
already_events = [service_to_application.application_id for service_to_application in service2applications]
|
||||||
)
|
|
||||||
already_events = [
|
|
||||||
service_to_application.application_id for service_to_application in service2applications.data
|
|
||||||
]
|
|
||||||
if list_options.query:
|
if list_options.query:
|
||||||
applications_list = Applications.filter_all(
|
applications_list = Applications.query.filter(*Applications.convert(list_options.query), Applications.id.not_in(already_events))
|
||||||
*Applications.convert(list_options.query), Applications.id.not_in(already_events), db=db_session
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
applications_list = Applications.filter_all(Applications.id.not_in(already_events), db=db_session)
|
applications_list = Applications.query.filter(Applications.id.not_in(already_events))
|
||||||
pagination = Pagination(data=applications_list)
|
pagination = Pagination(data=applications_list)
|
||||||
pagination.change(**list_options.model_dump())
|
pagination.change(**list_options.model_dump())
|
||||||
pagination_result = PaginationResult(data=applications_list, pagination=pagination)
|
pagination_result = PaginationResult(data=applications_list, pagination=pagination)
|
||||||
|
|
@ -167,21 +162,15 @@ def application_list_appended_callable(list_options: PaginateOnly):
|
||||||
}
|
}
|
||||||
list_options.query.pop("service_uu_id__ilike", None)
|
list_options.query.pop("service_uu_id__ilike", None)
|
||||||
list_options.query.pop("service_uu_id", None)
|
list_options.query.pop("service_uu_id", None)
|
||||||
|
with Service2Application.new_session() as db_session:
|
||||||
with Applications.new_session() as db_session:
|
Service2Application.set_session(db_session)
|
||||||
service2applications = Service2Application.filter_all(
|
Applications.set_session(db_session)
|
||||||
*Service2Application.convert({"service_uu_id__ilike": service_uu_id}),
|
service2applications = Service2Application.query.filter(*Service2Application.convert({"service_uu_id__ilike": service_uu_id})).all()
|
||||||
db=db_session,
|
already_events = [service_to_application.application_id for service_to_application in service2applications]
|
||||||
)
|
|
||||||
already_events = [
|
|
||||||
service_to_application.application_id for service_to_application in service2applications.data
|
|
||||||
]
|
|
||||||
if list_options.query:
|
if list_options.query:
|
||||||
applications_list = Applications.filter_all(
|
applications_list = Applications.query.filter(*Applications.convert(list_options.query), Applications.id.in_(already_events))
|
||||||
*Applications.convert(list_options.query), Applications.id.in_(already_events), db=db_session
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
applications_list = Applications.filter_all(Applications.id.in_(already_events), db=db_session)
|
applications_list = Applications.query.filter(Applications.id.in_(already_events))
|
||||||
pagination = Pagination(data=applications_list)
|
pagination = Pagination(data=applications_list)
|
||||||
pagination.change(**list_options.model_dump())
|
pagination.change(**list_options.model_dump())
|
||||||
pagination_result = PaginationResult(data=applications_list, pagination=pagination)
|
pagination_result = PaginationResult(data=applications_list, pagination=pagination)
|
||||||
|
|
@ -197,13 +186,10 @@ def application_create_callable(data: Any):
|
||||||
"""
|
"""
|
||||||
with Applications.new_session() as db_session:
|
with Applications.new_session() as db_session:
|
||||||
created_application_dict = data.model_dump()
|
created_application_dict = data.model_dump()
|
||||||
created_application = Applications.find_or_create(
|
Applications.set_session(db_session)
|
||||||
db=db_session,
|
created_application = Applications.create(**created_application_dict)
|
||||||
include_args=[Applications.application_for, Applications.application_code, Applications.site_url],
|
if created_application:
|
||||||
**created_application_dict,
|
created_application.save()
|
||||||
)
|
|
||||||
if created_application.meta_data.created:
|
|
||||||
created_application.save(db=db_session)
|
|
||||||
return {
|
return {
|
||||||
"completed": True,
|
"completed": True,
|
||||||
"message": "MSG0001-INSERT",
|
"message": "MSG0001-INSERT",
|
||||||
|
|
@ -224,22 +210,16 @@ def application_update_callable(data: Any, uu_id: str):
|
||||||
Update an existing application
|
Update an existing application
|
||||||
"""
|
"""
|
||||||
with Applications.new_session() as db_session:
|
with Applications.new_session() as db_session:
|
||||||
updated_application_dict = data.model_dump(
|
updated_application_dict = data.model_dump(exclude_unset=True, exclude_none=True)
|
||||||
exclude_unset=True, exclude_none=True
|
found_application = Applications.query.filter(Applications.uu_id == uu_id).first()
|
||||||
)
|
|
||||||
found_application = Applications.filter_one(
|
|
||||||
Applications.uu_id == uu_id, db=db_session
|
|
||||||
).data
|
|
||||||
if not found_application:
|
if not found_application:
|
||||||
return {
|
return {
|
||||||
"completed": False,
|
"completed": False,
|
||||||
"message": "MSG0002-FOUND",
|
"message": "MSG0002-FOUND",
|
||||||
"data": found_application,
|
"data": found_application,
|
||||||
}
|
}
|
||||||
updated_application = found_application.update(
|
updated_application = found_application.update(**updated_application_dict)
|
||||||
db=db_session, **updated_application_dict
|
updated_application.save()
|
||||||
)
|
|
||||||
updated_application.save(db_session)
|
|
||||||
if updated_application.meta_data.updated:
|
if updated_application.meta_data.updated:
|
||||||
return {
|
return {
|
||||||
"completed": True,
|
"completed": True,
|
||||||
|
|
@ -261,23 +241,32 @@ def application_register_service_callable(data: Any):
|
||||||
Register an application to a service
|
Register an application to a service
|
||||||
"""
|
"""
|
||||||
with Applications.new_session() as db_session:
|
with Applications.new_session() as db_session:
|
||||||
event = Applications.filter_one_system(Applications.uu_id == data.application_uu_id, db=db_session)
|
Applications.set_session(db_session)
|
||||||
if not event.data:
|
event = Applications.query.filter(Applications.uu_id == data.application_uu_id).first()
|
||||||
|
if not event:
|
||||||
return {
|
return {
|
||||||
"message": "MSG0003-NOT-FOUND",
|
"message": "MSG0003-NOT-FOUND",
|
||||||
"data": data.model_dump(),
|
"data": data.model_dump(),
|
||||||
"completed": False,
|
"completed": False,
|
||||||
}
|
}
|
||||||
service = Services.filter_one_system(Services.uu_id == data.service_uu_id, db=db_session)
|
service = Services.query.filter(Services.uu_id == data.service_uu_id).first()
|
||||||
if not service.data:
|
if not service:
|
||||||
return {
|
return {
|
||||||
"message": "MSG0003-NOT-FOUND",
|
"message": "MSG0003-NOT-FOUND",
|
||||||
"data": data.model_dump(),
|
"data": data.model_dump(),
|
||||||
"completed": False,
|
"completed": False,
|
||||||
}
|
}
|
||||||
service_to_application = Service2Application.find_or_create(
|
service_to_application = Service2Application.query.filter(
|
||||||
db=db_session,
|
Service2Application.service_id == service.data.id,
|
||||||
include_args=[Service2Application.service_uu_id, Service2Application.application_uu_id],
|
Service2Application.application_id == event.data.id,
|
||||||
|
).first()
|
||||||
|
if service_to_application:
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-ALREADY-FOUND",
|
||||||
|
"data": data.model_dump(),
|
||||||
|
"completed": False,
|
||||||
|
}
|
||||||
|
service_to_application = Service2Application.create(
|
||||||
service_id=service.data.id,
|
service_id=service.data.id,
|
||||||
service_uu_id=str(service.data.uu_id),
|
service_uu_id=str(service.data.uu_id),
|
||||||
application_id=event.data.id,
|
application_id=event.data.id,
|
||||||
|
|
@ -286,13 +275,7 @@ def application_register_service_callable(data: Any):
|
||||||
site_url=event.data.site_url,
|
site_url=event.data.site_url,
|
||||||
is_confirmed=True,
|
is_confirmed=True,
|
||||||
)
|
)
|
||||||
if not service_to_application.meta_data.created:
|
service_to_application.save()
|
||||||
return {
|
|
||||||
"message": "MSG0003-ALREADY-FOUND",
|
|
||||||
"data": data.model_dump(),
|
|
||||||
"completed": False,
|
|
||||||
}
|
|
||||||
service_to_application.save(db=db_session)
|
|
||||||
return {
|
return {
|
||||||
"message": "MSG0003-REGISTER",
|
"message": "MSG0003-REGISTER",
|
||||||
"data": data.model_dump(),
|
"data": data.model_dump(),
|
||||||
|
|
@ -308,26 +291,26 @@ def application_unregister_service_callable(data: Any):
|
||||||
Unregister an application from a service
|
Unregister an application from a service
|
||||||
"""
|
"""
|
||||||
with Applications.new_session() as db_session:
|
with Applications.new_session() as db_session:
|
||||||
application = Applications.filter_one_system(Applications.uu_id == data.application_uu_id, db=db_session)
|
Applications.set_session(db_session)
|
||||||
if not application.data:
|
application = Applications.query.filter(Applications.uu_id == data.application_uu_id).first()
|
||||||
|
if not application:
|
||||||
return {
|
return {
|
||||||
"message": "MSG0003-NOT-FOUND",
|
"message": "MSG0003-NOT-FOUND",
|
||||||
"data": data.model_dump(),
|
"data": data.model_dump(),
|
||||||
"completed": False,
|
"completed": False,
|
||||||
}
|
}
|
||||||
service = Services.filter_one_system(Services.uu_id == data.service_uu_id, db=db_session)
|
service = Services.query.filter(Services.uu_id == data.service_uu_id).first()
|
||||||
if not service.data:
|
if not service:
|
||||||
return {
|
return {
|
||||||
"message": "MSG0003-NOT-FOUND",
|
"message": "MSG0003-NOT-FOUND",
|
||||||
"data": data.model_dump(),
|
"data": data.model_dump(),
|
||||||
"completed": False,
|
"completed": False,
|
||||||
}
|
}
|
||||||
service_to_application = Service2Application.filter_one_system(
|
service_to_application = Service2Application.query.filter(
|
||||||
Service2Application.service_id == service.data.id,
|
Service2Application.service_id == service.data.id,
|
||||||
Service2Application.application_id == application.data.id,
|
Service2Application.application_id == application.data.id,
|
||||||
db=db_session,
|
).first()
|
||||||
)
|
if not service_to_application:
|
||||||
if not service_to_application.data:
|
|
||||||
return {
|
return {
|
||||||
"message": "MSG0003-NOT-FOUND",
|
"message": "MSG0003-NOT-FOUND",
|
||||||
"data": data.model_dump(),
|
"data": data.model_dump(),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
from api_initializer.event_clusters import EventCluster, RouterCluster
|
||||||
|
from index import endpoints_index
|
||||||
|
from .supers_events import (
|
||||||
|
SuperServiceListEvent,
|
||||||
|
SuperServiceCreateEvent,
|
||||||
|
SuperServiceUpdateEvent,
|
||||||
|
SuperServiceDeleteEvent,
|
||||||
|
)
|
||||||
|
|
||||||
|
ServicesRouterCluster = RouterCluster(name="ServicesRouterCluster")
|
||||||
|
|
||||||
|
ServicesEventClusterList = EventCluster(name="ServicesList", endpoint_uu_id=endpoints_index["ServicesList"])
|
||||||
|
ServicesEventClusterList.add_event(SuperServiceListEvent)
|
||||||
|
|
||||||
|
ServicesEventClusterCreate = EventCluster(name="ServicesCreate", endpoint_uu_id=endpoints_index["ServicesCreate"])
|
||||||
|
ServicesEventClusterCreate.add_event(SuperServiceCreateEvent)
|
||||||
|
|
||||||
|
ServicesEventClusterUpdate = EventCluster(name="ServicesUpdate", endpoint_uu_id=endpoints_index["ServicesUpdate"])
|
||||||
|
ServicesEventClusterUpdate.add_event(SuperServiceUpdateEvent)
|
||||||
|
|
||||||
|
ServicesEventClusterDelete = EventCluster(name="ServicesDelete", endpoint_uu_id=endpoints_index["ServicesDelete"])
|
||||||
|
ServicesEventClusterDelete.add_event(SuperServiceDeleteEvent)
|
||||||
|
|
||||||
|
ServicesRouterCluster.set_event_cluster(ServicesEventClusterList)
|
||||||
|
ServicesRouterCluster.set_event_cluster(ServicesEventClusterCreate)
|
||||||
|
ServicesRouterCluster.set_event_cluster(ServicesEventClusterUpdate)
|
||||||
|
ServicesRouterCluster.set_event_cluster(ServicesEventClusterDelete)
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from api_validations.defaults.validations import CommonHeaders
|
||||||
|
from api_initializer.event_clusters import Event
|
||||||
|
from api_validations.response import (
|
||||||
|
PaginateOnly,
|
||||||
|
Pagination,
|
||||||
|
PaginationResult,
|
||||||
|
PostgresResponseSingle,
|
||||||
|
PostgresResponse,
|
||||||
|
EndpointResponse
|
||||||
|
)
|
||||||
|
from schemas import (
|
||||||
|
Events,
|
||||||
|
Event2Employee,
|
||||||
|
Event2Occupant,
|
||||||
|
Event2EmployeeExtra,
|
||||||
|
Event2OccupantExtra,
|
||||||
|
Service2Events,
|
||||||
|
Services,
|
||||||
|
)
|
||||||
|
|
||||||
|
# List services endpoint
|
||||||
|
SuperServiceListEvent = Event(
|
||||||
|
name="super_service_list",
|
||||||
|
key="ea24f5e6-279a-47e7-a5bd-8a5c1bd72d05",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users List available events endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create service endpoint
|
||||||
|
SuperServiceCreateEvent = Event(
|
||||||
|
name="super_service_create",
|
||||||
|
key="086051f4-f1ec-4d56-b706-09ce53d5e66c",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users Create service endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update service endpoint
|
||||||
|
SuperServiceUpdateEvent = Event(
|
||||||
|
name="super_service_update",
|
||||||
|
key="267956e5-32b7-4b60-ab75-3b56b935d5c1",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users Update service endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete service endpoint
|
||||||
|
SuperServiceDeleteEvent = Event(
|
||||||
|
name="super_service_delete",
|
||||||
|
key="6c333122-272e-4690-9d71-7f5e14cc64c8",
|
||||||
|
request_validator=None, # TODO: Add request validator
|
||||||
|
response_validator=None, # TODO: Add response validator
|
||||||
|
description="Super Users Delete service endpoint",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def super_service_list_callable(list_options: PaginateOnly, headers: CommonHeaders):
|
||||||
|
"""List available events with pagination and filtering options"""
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-LIST",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperServiceListEvent.event_callable = super_service_list_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_service_create_callable(data: Any, headers: CommonHeaders):
|
||||||
|
"""Create service"""
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-CREATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperServiceCreateEvent.event_callable = super_service_create_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_service_update_callable(data: Any, headers: CommonHeaders):
|
||||||
|
"""Update service"""
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-UPDATE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperServiceUpdateEvent.event_callable = super_service_update_callable
|
||||||
|
|
||||||
|
|
||||||
|
def super_service_delete_callable(data: Any, headers: CommonHeaders):
|
||||||
|
"""Delete service"""
|
||||||
|
return {
|
||||||
|
"message": "MSG0003-DELETE",
|
||||||
|
"data": None,
|
||||||
|
"completed": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperServiceDeleteEvent.event_callable = super_service_delete_callable
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
endpoints_index: dict = {
|
endpoints_index: dict = {
|
||||||
"AccountRecordsAll": "d538deb4-38f4-4913-a1af-bbef14cf6873",
|
"AccountRecordsAll": "d538deb4-38f4-4913-a1af-bbef14cf6873",
|
||||||
"AccountRecordsMonthly": "c0f5ccb1-1e56-4653-af13-ec0bf5e6aa51",
|
"AccountRecordsMonthly": "c0f5ccb1-1e56-4653-af13-ec0bf5e6aa51",
|
||||||
|
|
@ -16,4 +17,8 @@ endpoints_index: dict = {
|
||||||
"ApplicationUpdate": "83281757-696a-41ed-9706-e145ac54c3a9",
|
"ApplicationUpdate": "83281757-696a-41ed-9706-e145ac54c3a9",
|
||||||
"ApplicationBindEmployee": "80427237-5ab6-4d17-8084-cdb87bda22a3",
|
"ApplicationBindEmployee": "80427237-5ab6-4d17-8084-cdb87bda22a3",
|
||||||
"ApplicationBindOccupant": "ae0fb101-cb13-47ab-86bd-233a5dbef269",
|
"ApplicationBindOccupant": "ae0fb101-cb13-47ab-86bd-233a5dbef269",
|
||||||
|
"ServicesList": "7af16881-2c0f-463f-859f-7aca475e65eb",
|
||||||
|
"ServicesCreate": "effca319-2074-4862-bb80-dde77f0e8407",
|
||||||
|
"ServicesUpdate": "24dc83e9-c159-4bb3-8982-a8adf6555029",
|
||||||
|
"ServicesDelete": "f4c9b2c4-d18a-43c6-abf9-030f71a1c381",
|
||||||
}
|
}
|
||||||
|
|
@ -19,10 +19,10 @@ COPY /api_services/api_modules /api_modules
|
||||||
COPY /api_services/schemas /schemas
|
COPY /api_services/schemas /schemas
|
||||||
|
|
||||||
COPY /api_services/api_middlewares /api_middlewares
|
COPY /api_services/api_middlewares /api_middlewares
|
||||||
COPY /api_services/api_builds/restriction-service/endpoints /api_initializer/endpoints
|
COPY /api_services/api_builds/restriction_service/endpoints /api_initializer/endpoints
|
||||||
COPY /api_services/api_builds/restriction-service/events /api_initializer/events
|
COPY /api_services/api_builds/restriction_service/events /api_initializer/events
|
||||||
COPY /api_services/api_builds/restriction-service/validations /api_initializer/validations
|
COPY /api_services/api_builds/restriction_service/validations /api_initializer/validations
|
||||||
COPY /api_services/api_builds/restriction-service/index.py /api_initializer/index.py
|
COPY /api_services/api_builds/restriction_service/index.py /api_initializer/index.py
|
||||||
|
|
||||||
# Set Python path to include app directory
|
# Set Python path to include app directory
|
||||||
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
|
|
||||||
|
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
@ -22,7 +22,7 @@ class Configs(BaseSettings):
|
||||||
EMAIL_HOST: str = ""
|
EMAIL_HOST: str = ""
|
||||||
DATETIME_FORMAT: str = ""
|
DATETIME_FORMAT: str = ""
|
||||||
FORGOT_LINK: str = ""
|
FORGOT_LINK: str = ""
|
||||||
ALLOW_ORIGINS: list = ["http://localhost:3000", "http://localhost:3001"]
|
ALLOW_ORIGINS: list = ["http://localhost:3000", "http://localhost:3001", "http://localhost:3001/api", "http://localhost:3001/api/"]
|
||||||
VERSION: str = "0.1.001"
|
VERSION: str = "0.1.001"
|
||||||
DESCRIPTION: str = ""
|
DESCRIPTION: str = ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,6 @@ class EventCluster:
|
||||||
from schemas import Events, EndpointRestriction
|
from schemas import Events, EndpointRestriction
|
||||||
|
|
||||||
with Events.new_session() as db_session:
|
with Events.new_session() as db_session:
|
||||||
# if to_save_endpoint := EndpointRestriction.filter_one(
|
|
||||||
# EndpointRestriction.operation_uu_id == self.endpoint_uu_id,
|
|
||||||
# db=db_session,
|
|
||||||
# ).data:
|
|
||||||
Events.set_session(db_session)
|
Events.set_session(db_session)
|
||||||
EndpointRestriction.set_session(db_session)
|
EndpointRestriction.set_session(db_session)
|
||||||
|
|
||||||
|
|
@ -55,27 +51,14 @@ class EventCluster:
|
||||||
is_confirmed=True,
|
is_confirmed=True,
|
||||||
)
|
)
|
||||||
print('set_events_to_database event_dict_to_save', event_dict_to_save)
|
print('set_events_to_database event_dict_to_save', event_dict_to_save)
|
||||||
|
check_event = Events.query.filter(Events.endpoint_uu_id == event_dict_to_save["endpoint_uu_id"]).first()
|
||||||
# event_found = Events.filter_one(
|
if check_event:
|
||||||
# Events.function_code == event_dict_to_save["function_code"],
|
check_event.update(**event_dict_to_save)
|
||||||
# db=db_session,
|
check_event.save()
|
||||||
# ).data
|
else:
|
||||||
# if event_found:
|
event_created = Events.create(**event_dict_to_save)
|
||||||
# event_found.update(**event_dict_to_save)
|
print(f"UUID: {event_created.uu_id} event is saved to {to_save_endpoint.uu_id}")
|
||||||
# event_found.save(db=db_session)
|
event_created.save()
|
||||||
# else:
|
|
||||||
# event_to_save_database = Events.find_or_create(
|
|
||||||
# **event_dict_to_save,
|
|
||||||
# include_args=[
|
|
||||||
# Events.function_code,
|
|
||||||
# Events.function_class,
|
|
||||||
# Events.endpoint_code,
|
|
||||||
# Events.endpoint_uu_id,
|
|
||||||
# ]
|
|
||||||
# )
|
|
||||||
# if event_to_save_database.meta_data.created:
|
|
||||||
# print(f"UUID: {event_to_save_database.uu_id} event is saved to {to_save_endpoint.uu_id}")
|
|
||||||
# event_to_save_database.save(db=db_session)
|
|
||||||
|
|
||||||
def match_event(self, event_key: str) -> "Event":
|
def match_event(self, event_key: str) -> "Event":
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,7 @@ async def token_middleware(request: Request, call_next):
|
||||||
|
|
||||||
token = request.headers.get(api_config.ACCESS_TOKEN_TAG, None)
|
token = request.headers.get(api_config.ACCESS_TOKEN_TAG, None)
|
||||||
if not token:
|
if not token:
|
||||||
return JSONResponse(
|
return JSONResponse(content={"error": "EYS_0002"}, status_code=status.HTTP_401_UNAUTHORIZED)
|
||||||
content={
|
|
||||||
"error": "EYS_0002",
|
|
||||||
},
|
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
||||||
)
|
|
||||||
|
|
||||||
response = await call_next(request)
|
response = await call_next(request)
|
||||||
return response
|
return response
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
from typing import Optional, Union, Type, Any, Dict, TypeVar
|
from typing import Optional, Union, Type, Any, Dict, TypeVar
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from sqlalchemy.orm import Query
|
from sqlalchemy.orm import Query
|
||||||
|
from sqlalchemy import asc, desc
|
||||||
|
|
||||||
from .pagination import default_paginate_config
|
from .pagination import default_paginate_config
|
||||||
from .base import PostgresResponse
|
from .base import PostgresResponse
|
||||||
|
from .pagination import PaginationConfig
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
@ -25,7 +27,7 @@ class Pagination:
|
||||||
MAX_SIZE = default_paginate_config.MAX_SIZE
|
MAX_SIZE = default_paginate_config.MAX_SIZE
|
||||||
|
|
||||||
def __init__(self, data: PostgresResponse):
|
def __init__(self, data: PostgresResponse):
|
||||||
self.data = data
|
self.query = data
|
||||||
self.size: int = self.DEFAULT_SIZE
|
self.size: int = self.DEFAULT_SIZE
|
||||||
self.page: int = 1
|
self.page: int = 1
|
||||||
self.orderField: Optional[Union[tuple[str], list[str]]] = ["uu_id"]
|
self.orderField: Optional[Union[tuple[str], list[str]]] = ["uu_id"]
|
||||||
|
|
@ -45,20 +47,20 @@ class Pagination:
|
||||||
else self.DEFAULT_SIZE
|
else self.DEFAULT_SIZE
|
||||||
)
|
)
|
||||||
self.page = config.page
|
self.page = config.page
|
||||||
self.orderField = config.order_field
|
self.orderField = config.orderField
|
||||||
self.orderType = config.order_type
|
self.orderType = config.orderType
|
||||||
self._update_page_counts()
|
self._update_page_counts()
|
||||||
|
|
||||||
def feed(self, data: PostgresResponse) -> None:
|
def feed(self, data: PostgresResponse) -> None:
|
||||||
"""Calculate pagination based on data source."""
|
"""Calculate pagination based on data source."""
|
||||||
self.data = data
|
self.query = data
|
||||||
self._update_page_counts()
|
self._update_page_counts()
|
||||||
|
|
||||||
def _update_page_counts(self) -> None:
|
def _update_page_counts(self) -> None:
|
||||||
"""Update page counts and validate current page."""
|
"""Update page counts and validate current page."""
|
||||||
if self.data:
|
if self.query:
|
||||||
self.total_count = self.data.count
|
self.total_count = self.query.count()
|
||||||
self.all_count = self.data.total_count
|
self.all_count = self.query.count()
|
||||||
|
|
||||||
self.size = (
|
self.size = (
|
||||||
self.size
|
self.size
|
||||||
|
|
@ -131,11 +133,12 @@ class PaginationResult:
|
||||||
self,
|
self,
|
||||||
data: PostgresResponse,
|
data: PostgresResponse,
|
||||||
pagination: Pagination,
|
pagination: Pagination,
|
||||||
|
is_list: bool = True,
|
||||||
response_model: Type[T] = None,
|
response_model: Type[T] = None,
|
||||||
):
|
):
|
||||||
self._query = data.query
|
self._query = data
|
||||||
self.pagination = pagination
|
self.pagination = pagination
|
||||||
self.response_type = data.is_list
|
self.response_type = is_list
|
||||||
self.limit = self.pagination.size
|
self.limit = self.pagination.size
|
||||||
self.offset = self.pagination.size * (self.pagination.page - 1)
|
self.offset = self.pagination.size * (self.pagination.page - 1)
|
||||||
self.order_by = self.pagination.orderField
|
self.order_by = self.pagination.orderField
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,102 @@
|
||||||
services:
|
services:
|
||||||
client_frontend:
|
|
||||||
container_name: client_frontend
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: web_services/client_frontend/Dockerfile
|
|
||||||
networks:
|
|
||||||
- wag-services
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
environment:
|
|
||||||
- NODE_ENV=development
|
|
||||||
- WEB_BASE_URL=http://localhost:3000
|
|
||||||
- API_BASE_URL=http://localhost:3000/api
|
|
||||||
cpus: 1
|
|
||||||
mem_limit: 2048m
|
|
||||||
|
|
||||||
management_frontend:
|
# client_frontend:
|
||||||
container_name: management_frontend
|
# container_name: client_frontend
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: web_services/client_frontend/Dockerfile
|
||||||
|
# networks:
|
||||||
|
# - wag-services
|
||||||
|
# ports:
|
||||||
|
# - "3000:3000"
|
||||||
|
# environment:
|
||||||
|
# - NODE_ENV=development
|
||||||
|
# - WEB_BASE_URL=http://localhost:3000
|
||||||
|
# - API_BASE_URL=http://localhost:3000/api
|
||||||
|
# cpus: 1.5
|
||||||
|
# mem_limit: 2048m
|
||||||
|
|
||||||
|
# management_frontend:
|
||||||
|
# container_name: management_frontend
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: web_services/management_frontend/Dockerfile
|
||||||
|
# networks:
|
||||||
|
# - wag-services
|
||||||
|
# ports:
|
||||||
|
# - "3001:3000"
|
||||||
|
# environment:
|
||||||
|
# - NODE_ENV=development
|
||||||
|
# - WEB_BASE_URL=http://localhost:3001
|
||||||
|
# - API_BASE_URL=http://localhost:3001/api
|
||||||
|
# cpus: 1
|
||||||
|
# mem_limit: 2048m
|
||||||
|
|
||||||
|
account_service:
|
||||||
|
container_name: account_service
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: web_services/management_frontend/Dockerfile
|
dockerfile: api_services/api_builds/account_service/Dockerfile
|
||||||
|
env_file:
|
||||||
|
- api_env.env
|
||||||
networks:
|
networks:
|
||||||
- wag-services
|
- wag-services
|
||||||
ports:
|
|
||||||
- "3001:3000"
|
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- API_PATH=app:app
|
||||||
- WEB_BASE_URL=http://localhost:3000
|
- API_HOST=0.0.0.0
|
||||||
- API_BASE_URL=http://localhost:3000/api
|
- API_PORT=8004
|
||||||
cpus: 1
|
- API_LOG_LEVEL=info
|
||||||
mem_limit: 2048m
|
- API_RELOAD=1
|
||||||
|
- API_APP_NAME=evyos-account-api-gateway
|
||||||
|
- API_TITLE=WAG API Account Api Gateway
|
||||||
|
- API_DESCRIPTION=This api is serves as web account api gateway only to evyos web services.
|
||||||
|
- API_APP_URL=https://account_service
|
||||||
|
ports:
|
||||||
|
- "8004:8004"
|
||||||
|
|
||||||
|
building_service:
|
||||||
|
container_name: building_service
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: api_services/api_builds/building_service/Dockerfile
|
||||||
|
env_file:
|
||||||
|
- api_env.env
|
||||||
|
networks:
|
||||||
|
- wag-services
|
||||||
|
environment:
|
||||||
|
- API_PATH=app:app
|
||||||
|
- API_HOST=0.0.0.0
|
||||||
|
- API_PORT=8006
|
||||||
|
- API_LOG_LEVEL=info
|
||||||
|
- API_RELOAD=1
|
||||||
|
- API_APP_NAME=evyos-building-api-gateway
|
||||||
|
- API_TITLE=WAG API Building Api Gateway
|
||||||
|
- API_DESCRIPTION=This api is serves as web building api gateway only to evyos web services.
|
||||||
|
- API_APP_URL=https://building_service
|
||||||
|
ports:
|
||||||
|
- "8006:8006"
|
||||||
|
|
||||||
|
identity_service:
|
||||||
|
container_name: identity_service
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: api_services/api_builds/identity_service/Dockerfile
|
||||||
|
env_file:
|
||||||
|
- api_env.env
|
||||||
|
networks:
|
||||||
|
- wag-services
|
||||||
|
environment:
|
||||||
|
- API_PATH=app:app
|
||||||
|
- API_HOST=0.0.0.0
|
||||||
|
- API_PORT=8009
|
||||||
|
- API_LOG_LEVEL=info
|
||||||
|
- API_RELOAD=1
|
||||||
|
- API_APP_NAME=evyos-identity-api-gateway
|
||||||
|
- API_TITLE=WAG API Identity Api Gateway
|
||||||
|
- API_DESCRIPTION=This api is serves as web identity api gateway only to evyos web services.
|
||||||
|
- API_APP_URL=https://identity_service
|
||||||
|
ports:
|
||||||
|
- "8009:8009"
|
||||||
|
|
||||||
auth_service:
|
auth_service:
|
||||||
container_name: auth_service
|
container_name: auth_service
|
||||||
|
|
@ -101,19 +168,107 @@ services:
|
||||||
- "8003:8003"
|
- "8003:8003"
|
||||||
# restart: unless-stopped
|
# restart: unless-stopped
|
||||||
|
|
||||||
initializer_service:
|
# initializer_service:
|
||||||
container_name: initializer_service
|
# container_name: initializer_service
|
||||||
build:
|
# build:
|
||||||
context: .
|
# context: .
|
||||||
dockerfile: api_services/api_builds/initial_service/Dockerfile
|
# dockerfile: api_services/api_builds/initial_service/Dockerfile
|
||||||
environment:
|
# environment:
|
||||||
- SET_ALEMBIC=0
|
# - SET_ALEMBIC=0
|
||||||
networks:
|
# networks:
|
||||||
- wag-services
|
# - wag-services
|
||||||
env_file:
|
# env_file:
|
||||||
- api_env.env
|
# - api_env.env
|
||||||
mem_limit: 512m
|
# mem_limit: 512m
|
||||||
cpus: 0.5
|
# cpus: 0.5
|
||||||
|
|
||||||
|
# address_service:
|
||||||
|
# container_name: address_service
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: api_services/api_builds/address_service/Dockerfile
|
||||||
|
# env_file:
|
||||||
|
# - api_env.env
|
||||||
|
# networks:
|
||||||
|
# - wag-services
|
||||||
|
# environment:
|
||||||
|
# - API_PATH=app:app
|
||||||
|
# - API_HOST=0.0.0.0
|
||||||
|
# - API_PORT=8009
|
||||||
|
# - API_LOG_LEVEL=info
|
||||||
|
# - API_RELOAD=1
|
||||||
|
# - API_APP_NAME=evyos-address-api-gateway
|
||||||
|
# - API_TITLE=WAG API Address Api Gateway
|
||||||
|
# - API_DESCRIPTION=This api is serves as web address api gateway only to evyos web services.
|
||||||
|
# - API_APP_URL=https://address_service
|
||||||
|
# ports:
|
||||||
|
# - "8009:8009"
|
||||||
|
|
||||||
|
# decision_book_service:
|
||||||
|
# container_name: decision_book_service
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: api_services/api_builds/decision_book_service/Dockerfile
|
||||||
|
# env_file:
|
||||||
|
# - api_env.env
|
||||||
|
# networks:
|
||||||
|
# - wag-services
|
||||||
|
# environment:
|
||||||
|
# - API_PATH=app:app
|
||||||
|
# - API_HOST=0.0.0.0
|
||||||
|
# - API_PORT=8007
|
||||||
|
# - API_LOG_LEVEL=info
|
||||||
|
# - API_RELOAD=1
|
||||||
|
# - API_APP_NAME=evyos-decision-book-api-gateway
|
||||||
|
# - API_TITLE=WAG API Decision Book Api Gateway
|
||||||
|
# - API_DESCRIPTION=This api is serves as web decision book api gateway only to evyos web services.
|
||||||
|
# - API_APP_URL=https://decision_book_service
|
||||||
|
# ports:
|
||||||
|
# - "8007:8007"
|
||||||
|
|
||||||
|
# project_decision_book_service:
|
||||||
|
# container_name: project_decision_book_service
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: api_services/api_builds/project_decision_book_service/Dockerfile
|
||||||
|
# env_file:
|
||||||
|
# - api_env.env
|
||||||
|
# networks:
|
||||||
|
# - wag-services
|
||||||
|
# environment:
|
||||||
|
# - API_PATH=app:app
|
||||||
|
# - API_HOST=0.0.0.0
|
||||||
|
# - API_PORT=8008
|
||||||
|
# - API_LOG_LEVEL=info
|
||||||
|
# - API_RELOAD=1
|
||||||
|
# - API_APP_NAME=evyos-project-decision-book-api-gateway
|
||||||
|
# - API_TITLE=WAG API Project Decision Book Api Gateway
|
||||||
|
# - API_DESCRIPTION=This api is serves as web project decision book api gateway only to evyos web services.
|
||||||
|
# - API_APP_URL=https://project_decision_book_service
|
||||||
|
# ports:
|
||||||
|
# - "8008:8008"
|
||||||
|
|
||||||
|
# company_service:
|
||||||
|
# container_name: company_service
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: api_services/api_builds/company_service/Dockerfile
|
||||||
|
# env_file:
|
||||||
|
# - api_env.env
|
||||||
|
# networks:
|
||||||
|
# - wag-services
|
||||||
|
# environment:
|
||||||
|
# - API_PATH=app:app
|
||||||
|
# - API_HOST=0.0.0.0
|
||||||
|
# - API_PORT=8005
|
||||||
|
# - API_LOG_LEVEL=info
|
||||||
|
# - API_RELOAD=1
|
||||||
|
# - API_APP_NAME=evyos-company-api-gateway
|
||||||
|
# - API_TITLE=WAG API Company Api Gateway
|
||||||
|
# - API_DESCRIPTION=This api is serves as web company api gateway only to evyos web services.
|
||||||
|
# - API_APP_URL=https://company_service
|
||||||
|
# ports:
|
||||||
|
# - "8005:8005"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
wag-services:
|
wag-services:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
|
||||||
|
// Toplanti Başkani Toplanti Başkani MT-PRS
|
||||||
|
// Toplanti Katip Toplantida tutanak tutan kişi MT-WRT
|
||||||
|
// Toplanti Katilimcisi Toplantida sadece katilan kişi MT-ATT
|
||||||
|
// Toplanti Danişman Toplantida danişmanlik yapan kişi MT-ADV
|
||||||
|
// Toplanti Seçilmiş Başkani Toplanti Seçilmiş Başkani MT-VPR
|
||||||
|
// Daire Sahibi Daire Sahibi FL-OWN
|
||||||
|
// Daire Kiracisi Daire Kiracisi FL-TEN
|
||||||
|
// Daire Sakini Daire Sakini FL-RES
|
||||||
|
// Daire Sakini Vekili Daire Sakini Vekili FL-REP
|
||||||
|
// Bina Avukati Bina Avukati BU-ATT
|
||||||
|
// Bina Avukati Yardimcisi Bina Avukati Yardimcisi BU-ATA
|
||||||
|
// Bina Denetmen Yardimcisi Bina Denetmen Yardimcisi BU-SPA
|
||||||
|
// Bina Denetmeni Bina Denetmeni BU-SPV
|
||||||
|
// Bina Yönetici Yardimcisi Bina Yönetici Yardimcisi BU-MNA
|
||||||
|
// Bina Yöneticisi Bina Yöneticisi BU-MNG
|
||||||
|
// Bina Muhasabecisi Bina Muhasabecisi BU-ACC
|
||||||
|
// Proje Lideri Proje Lideri PRJ-LDR
|
||||||
|
// Proje Sorumlusu Proje Sorumlusu PRJ-RES
|
||||||
|
// Proje Ekibi Proje Ekibi PRJ-EMP
|
||||||
|
// Proje Finans Sorumlusu Proje Finans Sorumlusu PRJ-FIN
|
||||||
|
// Proje Teknik Sorumlusu Proje Teknik Sorumlusu PRJ-TEC
|
||||||
|
// Daire Mülkiyet Vekili Daire Mülkiyet Vekili FL-DEP
|
||||||
|
// Bina Teknik Sorumlusu Bina Teknik Sorumlusu BU-TEC
|
||||||
|
// Bina Teknik Elemani Bina Teknik Elemani BU-EMP
|
||||||
|
// Bina Teknik Freelancer Bina Teknik Freelancer BU-FLC
|
||||||
|
|
||||||
|
|
||||||
|
const occ_types = {
|
||||||
|
"MT-PRS": "Toplanti Başkani",
|
||||||
|
"MT-WRT": "Toplanti Katip",
|
||||||
|
"MT-ATT": "Toplanti Katilimcisi",
|
||||||
|
"MT-ADV": "Toplanti Danişman",
|
||||||
|
"MT-VPR": "Toplanti Seçilmiş Başkani",
|
||||||
|
"FL-OWN": "Daire Sahibi",
|
||||||
|
"FL-TEN": "Daire Kiracisi",
|
||||||
|
"FL-RES": "Daire Sakini",
|
||||||
|
"FL-REP": "Daire Sakini Vekili",
|
||||||
|
"BU-ATT": "Bina Avukati",
|
||||||
|
"BU-ATA": "Bina Avukati Yardimcisi",
|
||||||
|
"BU-SPA": "Bina Denetmen Yardimcisi",
|
||||||
|
"BU-SPV": "Bina Denetmeni",
|
||||||
|
"BU-MNA": "Bina Yönetici Yardimcisi",
|
||||||
|
"BU-MNG": "Bina Yöneticisi",
|
||||||
|
"BU-ACC": "Bina Muhasabecisi",
|
||||||
|
"PRJ-LDR": "Proje Lideri",
|
||||||
|
"PRJ-RES": "Proje Sorumlusu",
|
||||||
|
"PRJ-EMP": "Proje Ekibi",
|
||||||
|
"PRJ-FIN": "Proje Finans Sorumlusu",
|
||||||
|
"PRJ-TEC": "Proje Teknik Sorumlusu",
|
||||||
|
"FL-DEP": "Daire Mülkiyet Vekili",
|
||||||
|
"BU-TEC": "Bina Teknik Sorumlusu",
|
||||||
|
"BU-EMP": "Bina Teknik Elemani",
|
||||||
|
"BU-FLC": "Bina Teknik Freelancer",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const thirdMenuItems = {
|
||||||
|
"Birey": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"Yetki": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Apartman": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Daire": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Alan": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Yönetim Cari Hareketler": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Yönetim Bütçe işlemleri": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Daire cari Hareketler": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Yillik Olağan Toplanti Tanimlama ve Davet": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Yillik Olağan Toplanti kapatma ve Cari Yaratma": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Acil Toplanti Tanimlama ve Davet": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Acil Olağan Toplanti kapatma ve Cari Yaratma": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"Toplanti Katilim İşlemleri": [
|
||||||
|
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -6,11 +6,20 @@ const formatServiceUrl = (url: string) => {
|
||||||
const baseUrlAuth = formatServiceUrl(
|
const baseUrlAuth = formatServiceUrl(
|
||||||
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "auth_service:8001"
|
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "auth_service:8001"
|
||||||
);
|
);
|
||||||
const baseUrlPeople = formatServiceUrl(
|
const baseUrlRestriction = formatServiceUrl(
|
||||||
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "identity_service:8002"
|
process.env.NEXT_PUBLIC_RESTRICTION_SERVICE_URL || "restriction_service:8002"
|
||||||
);
|
);
|
||||||
const baseUrlApplication = formatServiceUrl(
|
const baseUrlApplication = formatServiceUrl(
|
||||||
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8004"
|
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8003"
|
||||||
|
);
|
||||||
|
const baseUrlAccount = formatServiceUrl(
|
||||||
|
process.env.NEXT_PUBLIC_ACCOUNT_SERVICE_URL || "account_service:8004"
|
||||||
|
);
|
||||||
|
const baseUrlBuilding = formatServiceUrl(
|
||||||
|
process.env.NEXT_PUBLIC_BUILDING_SERVICE_URL || "building_service:8006"
|
||||||
|
);
|
||||||
|
const baseUrlPeople = formatServiceUrl(
|
||||||
|
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "identity_service:8009"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Types for better type safety
|
// Types for better type safety
|
||||||
|
|
@ -62,6 +71,9 @@ export {
|
||||||
baseUrlAuth,
|
baseUrlAuth,
|
||||||
baseUrlPeople,
|
baseUrlPeople,
|
||||||
baseUrlApplication,
|
baseUrlApplication,
|
||||||
|
baseUrlAccount,
|
||||||
|
baseUrlBuilding,
|
||||||
|
baseUrlRestriction,
|
||||||
tokenSecret,
|
tokenSecret,
|
||||||
cookieObject,
|
cookieObject,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
||||||
import { resolveWhichPageToRenderSingle } from "@/pages/resolver/resolver";
|
import { resolveWhichPageToRenderSingle } from "@/pages/resolver/resolver";
|
||||||
|
|
||||||
const PageToBeChildrendSingle: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
const PageToBeChildrendSingle: React.FC<ContentProps> = async ({ lang, translations, activePageUrl, mode }) => {
|
||||||
const ApplicationToRender = resolveWhichPageToRenderSingle({ activePageUrl })
|
const ApplicationToRender = await resolveWhichPageToRenderSingle({ activePageUrl })
|
||||||
if (ApplicationToRender) {
|
if (ApplicationToRender) {
|
||||||
return <ApplicationToRender lang={lang} translations={translations} activePageUrl={activePageUrl} />
|
return <ApplicationToRender lang={lang} translations={translations} activePageUrl={activePageUrl} mode={mode} />
|
||||||
}
|
}
|
||||||
else { return <ContentToRenderNoPage lang={lang} /> }
|
return <ContentToRenderNoPage lang={lang} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PageToBeChildrendSingle
|
export default PageToBeChildrendSingle
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import PageToBeChildrendSingle from "./PageToBeChildrendSingle";
|
||||||
import PageToBeChildrendMulti from "./PageToBeChildrendMulti";
|
import PageToBeChildrendMulti from "./PageToBeChildrendMulti";
|
||||||
|
|
||||||
const ContentComponent: FC<ContentProps> = async ({ lang, translations, activePageUrl, isMulti, mode }) => {
|
const ContentComponent: FC<ContentProps> = async ({ lang, translations, activePageUrl, isMulti, mode }) => {
|
||||||
const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'list'
|
const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'shortList'
|
||||||
const renderProps = { lang, translations, activePageUrl, mode: modeFromQuery as ModeTypes }
|
const renderProps = { lang, translations, activePageUrl, mode: modeFromQuery as ModeTypes }
|
||||||
const PageToBeChildrend = isMulti ? PageToBeChildrendMulti : PageToBeChildrendSingle
|
const PageToBeChildrend = isMulti ? PageToBeChildrendMulti : PageToBeChildrendSingle
|
||||||
const loadingContent = <LoadingContent height="h-16" size="w-36 h-48" plane="h-full w-full" />
|
const loadingContent = <LoadingContent height="h-16" size="w-36 h-48" plane="h-full w-full" />
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,18 @@ import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
|
|
||||||
import pageIndexMulti from "@/pages/multi/index";
|
import pageIndexMulti from "@/pages/multi/index";
|
||||||
import pageIndexSingle from "@/pages/single/index";
|
import pageIndexSingle from "@/pages/single/index";
|
||||||
|
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
||||||
|
|
||||||
function resolveWhichPageToRenderSingle({
|
async function resolveWhichPageToRenderSingle({ activePageUrl }: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||||
activePageUrl,
|
try {
|
||||||
}: ResolverProps): React.FC<ContentProps> {
|
return `${activePageUrl}` in pageIndexSingle ? pageIndexSingle[`${activePageUrl}`] : ContentToRenderNoPage
|
||||||
const ApplicationToRender = pageIndexSingle[activePageUrl]
|
} catch (error) {
|
||||||
return ApplicationToRender
|
console.error(error)
|
||||||
|
}
|
||||||
|
return ContentToRenderNoPage
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveWhichPageToRenderMulti({
|
async function resolveWhichPageToRenderMulti({ activePageUrl }: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||||
activePageUrl,
|
|
||||||
}: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
|
||||||
const pageToRender = await retrievePageToRender(activePageUrl) // TODO: Retrieve page to render
|
const pageToRender = await retrievePageToRender(activePageUrl) // TODO: Retrieve page to render
|
||||||
try {
|
try {
|
||||||
const ApplicationToRender = pageIndexMulti[activePageUrl][pageToRender]
|
const ApplicationToRender = pageIndexMulti[activePageUrl][pageToRender]
|
||||||
|
|
@ -23,7 +24,7 @@ async function resolveWhichPageToRenderMulti({
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
return null
|
return ContentToRenderNoPage
|
||||||
}
|
}
|
||||||
|
|
||||||
export { resolveWhichPageToRenderSingle, resolveWhichPageToRenderMulti };
|
export { resolveWhichPageToRenderSingle, resolveWhichPageToRenderMulti };
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,20 @@ const formatServiceUrl = (url: string) => {
|
||||||
const baseUrlAuth = formatServiceUrl(
|
const baseUrlAuth = formatServiceUrl(
|
||||||
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "auth_service:8001"
|
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "auth_service:8001"
|
||||||
);
|
);
|
||||||
const baseUrlPeople = formatServiceUrl(
|
const baseUrlRestriction = formatServiceUrl(
|
||||||
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "identity_service:8002"
|
process.env.NEXT_PUBLIC_RESTRICTION_SERVICE_URL || "restriction_service:8002"
|
||||||
);
|
);
|
||||||
const baseUrlApplication = formatServiceUrl(
|
const baseUrlApplication = formatServiceUrl(
|
||||||
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8004"
|
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8003"
|
||||||
|
);
|
||||||
|
const baseUrlAccount = formatServiceUrl(
|
||||||
|
process.env.NEXT_PUBLIC_ACCOUNT_SERVICE_URL || "account_service:8004"
|
||||||
|
);
|
||||||
|
const baseUrlBuilding = formatServiceUrl(
|
||||||
|
process.env.NEXT_PUBLIC_BUILDING_SERVICE_URL || "building_service:8006"
|
||||||
|
);
|
||||||
|
const baseUrlPeople = formatServiceUrl(
|
||||||
|
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "identity_service:8009"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Types for better type safety
|
// Types for better type safety
|
||||||
|
|
@ -62,6 +71,9 @@ export {
|
||||||
baseUrlAuth,
|
baseUrlAuth,
|
||||||
baseUrlPeople,
|
baseUrlPeople,
|
||||||
baseUrlApplication,
|
baseUrlApplication,
|
||||||
|
baseUrlAccount,
|
||||||
|
baseUrlBuilding,
|
||||||
|
baseUrlRestriction,
|
||||||
tokenSecret,
|
tokenSecret,
|
||||||
cookieObject,
|
cookieObject,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ interface AppendApplicationToService {
|
||||||
interface RemoveApplicationFromService extends AppendApplicationToService { }
|
interface RemoveApplicationFromService extends AppendApplicationToService { }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function listApplicationsAvailable(payload: PaginationParams): Promise<PaginatedApiResponse<any>> {
|
async function listApplicationsAvailable(payload: PaginationParams): Promise<PaginatedApiResponse<any>> {
|
||||||
if (!payload.query.service_uu_id__ilike) {
|
if (!payload.query.service_uu_id__ilike) {
|
||||||
console.warn('Missing service_uu_id in query parameters');
|
console.warn('Missing service_uu_id in query parameters');
|
||||||
|
|
@ -135,8 +134,8 @@ async function listAllApplications(payload: PaginationParams): Promise<Paginated
|
||||||
query: payload.query,
|
query: payload.query,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Sending request to backend with service_uu_id:', payload.query.service_uu_id);
|
// console.log('Sending request to backend with service_uu_id:', payload.query.service_uu_id);
|
||||||
console.log('Full request body:', JSON.stringify(requestBody, null, 2));
|
// console.log('Full request body:', JSON.stringify(requestBody, null, 2));
|
||||||
|
|
||||||
const response = await fetchDataWithToken(
|
const response = await fetchDataWithToken(
|
||||||
applicationListEndpoint,
|
applicationListEndpoint,
|
||||||
|
|
@ -147,7 +146,6 @@ async function listAllApplications(payload: PaginationParams): Promise<Paginated
|
||||||
|
|
||||||
if (response?.status === 200 || response?.status === 202) {
|
if (response?.status === 200 || response?.status === 202) {
|
||||||
const responseData = response.data as PaginatedApiResponse<any>;
|
const responseData = response.data as PaginatedApiResponse<any>;
|
||||||
console.log('list_events_available responseData:', JSON.stringify(responseData, null, 2));
|
|
||||||
return {
|
return {
|
||||||
data: responseData.data || [],
|
data: responseData.data || [],
|
||||||
pagination: collectPaginationFromApiResponse(responseData)
|
pagination: collectPaginationFromApiResponse(responseData)
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,10 @@ import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
||||||
import { resolveWhichPageToRenderSingle } from "@/pages/resolver/resolver";
|
import { resolveWhichPageToRenderSingle } from "@/pages/resolver/resolver";
|
||||||
|
|
||||||
const PageToBeChildrendSingle: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
const PageToBeChildrendSingle: React.FC<ContentProps> = async ({ lang, translations, activePageUrl, mode }) => {
|
||||||
const ApplicationToRender = resolveWhichPageToRenderSingle({ activePageUrl })
|
const ApplicationToRender = await resolveWhichPageToRenderSingle({ activePageUrl })
|
||||||
if (ApplicationToRender) {
|
if (!ApplicationToRender) return <ContentToRenderNoPage lang={lang} />
|
||||||
return <ApplicationToRender lang={lang} translations={translations} activePageUrl={activePageUrl} />
|
return <ApplicationToRender lang={lang} translations={translations} activePageUrl={activePageUrl} mode={mode} />
|
||||||
}
|
|
||||||
else { return <ContentToRenderNoPage lang={lang} /> }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PageToBeChildrendSingle
|
export default PageToBeChildrendSingle
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,14 @@ import PageToBeChildrendSingle from "./PageToBeChildrendSingle";
|
||||||
import PageToBeChildrendMulti from "./PageToBeChildrendMulti";
|
import PageToBeChildrendMulti from "./PageToBeChildrendMulti";
|
||||||
|
|
||||||
const ContentComponent: FC<ContentProps> = async ({ lang, translations, activePageUrl, isMulti, mode }) => {
|
const ContentComponent: FC<ContentProps> = async ({ lang, translations, activePageUrl, isMulti, mode }) => {
|
||||||
const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'list'
|
const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'shortList'
|
||||||
const renderProps = { lang, translations, activePageUrl, mode: modeFromQuery as ModeTypes }
|
const renderProps = { lang, translations, activePageUrl, mode: modeFromQuery as ModeTypes }
|
||||||
const PageToBeChildrend = isMulti ? PageToBeChildrendMulti : PageToBeChildrendSingle
|
const PageToBeChildrend = isMulti ? PageToBeChildrendMulti : PageToBeChildrendSingle
|
||||||
const loadingContent = <LoadingContent height="h-16" size="w-36 h-48" plane="h-full w-full" />
|
const loadingContent = <LoadingContent height="h-16" size="w-36 h-48" plane="h-full w-full" />
|
||||||
const classNameDiv = "fixed top-24 left-80 right-0 py-10 px-15 border-emerald-150 border-l-2 overflow-y-auto h-[calc(100vh-64px)]"
|
const classNameDiv = "fixed top-24 left-80 right-0 py-10 px-15 border-emerald-150 border-l-2 overflow-y-auto h-[calc(100vh-64px)]"
|
||||||
return <div className={classNameDiv}><Suspense fallback={loadingContent}><PageToBeChildrend {...renderProps} /></Suspense></div>;
|
return <div className={classNameDiv}><Suspense fallback={loadingContent}><PageToBeChildrend {...renderProps} /></Suspense></div>;
|
||||||
|
|
||||||
|
// return <div className={classNameDiv}><Suspense fallback={loadingContent}><PageToBeChildrend {...renderProps} /></Suspense></div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ContentComponent;
|
export default ContentComponent;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import { MenuSingleProps, SingleLayerItemProps } from "@/validations/mutual/dash
|
||||||
import { langGetKey } from "@/lib/langGet";
|
import { langGetKey } from "@/lib/langGet";
|
||||||
|
|
||||||
const SingleLayerItem: FC<SingleLayerItemProps> = ({ isActive, innerText, url }) => {
|
const SingleLayerItem: FC<SingleLayerItemProps> = ({ isActive, innerText, url }) => {
|
||||||
console.log({ isActive, innerText, url })
|
|
||||||
let className = "py-3 px-4 text-sm rounded-xl cursor-pointer transition-colors duration-200 flex justify-between items-center w-full";
|
let className = "py-3 px-4 text-sm rounded-xl cursor-pointer transition-colors duration-200 flex justify-between items-center w-full";
|
||||||
if (isActive) { className += " bg-black text-white font-medium" }
|
if (isActive) { className += " bg-black text-white font-medium" }
|
||||||
else { className += " bg-emerald-800 text-white hover:bg-emerald-700" }
|
else { className += " bg-emerald-800 text-white hover:bg-emerald-700" }
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ const TableComponent: React.FC<TableComponentProps> = ({
|
||||||
setPagination({ ...pagination, page: pagination.page < apiPagination.totalPage ? pagination.page + 1 : pagination.page });
|
setPagination({ ...pagination, page: pagination.page < apiPagination.totalPage ? pagination.page + 1 : pagination.page });
|
||||||
await fetchData();
|
await fetchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
console.log('urls', urls)
|
||||||
const response = await apiPostFetcher({
|
const response = await apiPostFetcher({
|
||||||
url: urls.list,
|
url: urls.list,
|
||||||
isNoCache: true,
|
isNoCache: true,
|
||||||
|
|
@ -56,8 +58,9 @@ const TableComponent: React.FC<TableComponentProps> = ({
|
||||||
query: pagination.query,
|
query: pagination.query,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (response && response.data) {
|
console.log('response.data', response)
|
||||||
const oldData = response.data.data
|
if (response.success && response.data) {
|
||||||
|
const oldData = response.data
|
||||||
setOrgTableData(oldData)
|
setOrgTableData(oldData)
|
||||||
if (schemas.table) {
|
if (schemas.table) {
|
||||||
const newData = Object.entries(oldData).map(([key]) => {
|
const newData = Object.entries(oldData).map(([key]) => {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ const CreateForm: React.FC<CreateFormProps> = ({ schemas, labels, selectedRow })
|
||||||
const handleSubmit = (data: any) => {
|
const handleSubmit = (data: any) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
const form = useForm<FormData>({
|
const form = useForm({
|
||||||
resolver: zodResolver(createSchema),
|
resolver: zodResolver(createSchema),
|
||||||
defaultValues: {},
|
defaultValues: {},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,30 +11,18 @@ const ComponentTablePlain: React.FC<TableProps> = ({
|
||||||
setTableData(data);
|
setTableData(data);
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const renderColumns = () => {
|
const renderColumns = () => [translations?.rows, ...columns].map((column, index) => <TableHead key={`headers-${index}`}>{column}</TableHead>)
|
||||||
return [translations?.rows, ...columns].map((column, index) => {
|
|
||||||
return (
|
|
||||||
<TableHead key={`headers-${index}`}>{column}</TableHead>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const renderRows = () => (
|
const renderRows = () => (
|
||||||
<>{tableData?.map((item: any, index: number) => {
|
<>{tableData?.map((item: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<TableRow key={`${index}-row`} >
|
<TableRow key={`${index}-row`} >
|
||||||
<TableCell>{index + 1}</TableCell>
|
<TableCell>{index + 1}</TableCell>
|
||||||
{
|
{
|
||||||
Object.entries(item).map(([key, value]: [string, any]) => (
|
Object.entries(item).map(([key, value]: [string, any]) => (<TableCell key={`${index}-column-${key}`}>{value}</TableCell>))
|
||||||
<TableCell key={`${index}-column-${key}`}>{value}</TableCell>
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Object.values(redirectUrls?.table || {}).map((redirectUrl: any, index: number) => {
|
Object.values(redirectUrls?.table || {}).map((redirectUrl: any, index: number) => {
|
||||||
return (
|
return <TableCell className="cursor-pointer w-4" key={`${index}-action-${index}`} onClick={() => setSelectedRow?.(orgData[index])}>{redirectUrl}</TableCell>
|
||||||
<TableCell className="cursor-pointer w-4" key={`${index}-action-${index}`}
|
|
||||||
onClick={() => setSelectedRow?.(orgData[index])}>{redirectUrl}</TableCell>
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
@ -48,9 +36,7 @@ const ComponentTablePlain: React.FC<TableProps> = ({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex flex-row justify-between gap-2">
|
<div className="flex flex-row justify-between gap-2">
|
||||||
{Object.values(redirectUrls?.page || {}).map((action, index) => (
|
{Object.values(redirectUrls?.page || {}).map((action, index) => (<div className="flex flex-row justify-center items-center gap-2" key={`page-action-${index}`}>{action}</div>))}
|
||||||
<div className="flex flex-row justify-center items-center gap-2" key={`page-action-${index}`}>{action}</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
{tableData ? renderTable : noDataFound}
|
{tableData ? renderTable : noDataFound}
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const UpdateForm: React.FC<UpdateFormProps> = ({ schemas, selectedRow, rollbackT
|
||||||
const handleSubmit = (data: any) => {
|
const handleSubmit = (data: any) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
const form = useForm<FormData>({
|
const form = useForm({
|
||||||
resolver: zodResolver(updateSchema),
|
resolver: zodResolver(updateSchema),
|
||||||
defaultValues: selectedRow,
|
defaultValues: selectedRow,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const BASE_URL = "http://localhost:3000";
|
const BASE_URL = "http://localhost:3001";
|
||||||
const API_URL = "http://localhost:3000/api";
|
const API_URL = "http://localhost:3001/api";
|
||||||
export const WEB_BASE_URL = process.env.WEB_BASE_URL || BASE_URL;
|
export const WEB_BASE_URL = process.env.WEB_BASE_URL || BASE_URL;
|
||||||
export const API_BASE_URL = process.env.API_BASE_URL || API_URL;
|
export const API_BASE_URL = process.env.API_BASE_URL || API_URL;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { footerDefaultEn } from "@/languages/mutual/footer/english";
|
||||||
|
import { headerDefaultEn } from "@/languages/mutual/header/english";
|
||||||
|
import { contentDefaultEn } from "@/languages/mutual/content/english";
|
||||||
|
|
||||||
|
const contentApplicationEn = {
|
||||||
|
...contentDefaultEn,
|
||||||
|
title: "Application",
|
||||||
|
content: "Application Content",
|
||||||
|
button: "Application Button",
|
||||||
|
};
|
||||||
|
const footerApplicationEn = {
|
||||||
|
...footerDefaultEn,
|
||||||
|
page: "Application Footer",
|
||||||
|
};
|
||||||
|
const headerApplicationEn = {
|
||||||
|
...headerDefaultEn,
|
||||||
|
page: "Application Header",
|
||||||
|
};
|
||||||
|
|
||||||
|
const menuApplicationEn = {
|
||||||
|
application: "Application",
|
||||||
|
};
|
||||||
|
|
||||||
|
const applicationEn = {
|
||||||
|
header: headerApplicationEn,
|
||||||
|
menu: menuApplicationEn,
|
||||||
|
content: contentApplicationEn,
|
||||||
|
footer: footerApplicationEn,
|
||||||
|
};
|
||||||
|
|
||||||
|
const applicationFieldsEn = {
|
||||||
|
uu_id: "UUID",
|
||||||
|
name: "Name",
|
||||||
|
application_code: "Application Code",
|
||||||
|
site_url: "Site URL",
|
||||||
|
application_type: "Application Type",
|
||||||
|
application_for: "Application For",
|
||||||
|
description: "Description",
|
||||||
|
active: "Active",
|
||||||
|
deleted: "Deleted",
|
||||||
|
created_at: "Created At",
|
||||||
|
updated_at: "Updated At",
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
contentApplicationEn,
|
||||||
|
footerApplicationEn,
|
||||||
|
headerApplicationEn,
|
||||||
|
menuApplicationEn,
|
||||||
|
applicationEn,
|
||||||
|
applicationFieldsEn,
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { applicationTr } from "./turkish";
|
||||||
|
import { applicationEn } from "./english";
|
||||||
|
|
||||||
|
const application = {
|
||||||
|
tr: applicationTr,
|
||||||
|
en: applicationEn,
|
||||||
|
};
|
||||||
|
|
||||||
|
export { application };
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { footerDefaultTr } from "@/languages/mutual/footer/turkish";
|
||||||
|
import { headerDefaultTr } from "@/languages/mutual/header/turkish";
|
||||||
|
import { contentDefaultTr } from "@/languages/mutual/content/turkish";
|
||||||
|
|
||||||
|
const contentApplicationTr = {
|
||||||
|
...contentDefaultTr,
|
||||||
|
title: "Uygulama",
|
||||||
|
description: "Uygulama",
|
||||||
|
button: "Uygulama Buton",
|
||||||
|
};
|
||||||
|
const footerApplicationTr = {
|
||||||
|
...footerDefaultTr,
|
||||||
|
page: "Uygulama Footer",
|
||||||
|
};
|
||||||
|
const headerApplicationTr = {
|
||||||
|
...headerDefaultTr,
|
||||||
|
page: "Uygulama Header",
|
||||||
|
};
|
||||||
|
|
||||||
|
const menuApplicationTr = {
|
||||||
|
application: "Uygulama",
|
||||||
|
};
|
||||||
|
const applicationTr = {
|
||||||
|
header: headerApplicationTr,
|
||||||
|
menu: menuApplicationTr,
|
||||||
|
content: contentApplicationTr,
|
||||||
|
footer: footerApplicationTr,
|
||||||
|
};
|
||||||
|
|
||||||
|
const applicationFieldsTr = {
|
||||||
|
uu_id: "UUID",
|
||||||
|
name: "İsim",
|
||||||
|
application_code: "Uygulama Kodu",
|
||||||
|
site_url: "Site URL",
|
||||||
|
application_type: "Uygulama Tipi",
|
||||||
|
application_for: "Uygulama için",
|
||||||
|
description: "Açıklama",
|
||||||
|
active: "Aktif",
|
||||||
|
deleted: "Silindi",
|
||||||
|
created_at: "Oluşturulma Tarihi",
|
||||||
|
updated_at: "Güncellenme Tarihi",
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
contentApplicationTr,
|
||||||
|
footerApplicationTr,
|
||||||
|
headerApplicationTr,
|
||||||
|
menuApplicationTr,
|
||||||
|
applicationTr,
|
||||||
|
applicationFieldsTr,
|
||||||
|
};
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
const buildingEn = {
|
|
||||||
building: "Building First Layer Label",
|
|
||||||
};
|
|
||||||
|
|
||||||
const buildingPartsEn = {
|
|
||||||
...buildingEn,
|
|
||||||
parts: "Parts Second Layer Label",
|
|
||||||
};
|
|
||||||
|
|
||||||
const buildingPartsFieldsEn = {
|
|
||||||
"Users.uuid": "UUID",
|
|
||||||
"Users.firstName": "First Name",
|
|
||||||
"Users.lastName": "Last Name",
|
|
||||||
"Users.email": "Email",
|
|
||||||
"Users.phoneNumber": "Phone Number",
|
|
||||||
"Users.country": "Country",
|
|
||||||
"Users.description": "Description",
|
|
||||||
"Users.isDeleted": "Is Deleted",
|
|
||||||
"Users.isConfirmed": "Is Confirmed",
|
|
||||||
"Users.createdAt": "Created At",
|
|
||||||
"Users.updatedAt": "Updated At",
|
|
||||||
};
|
|
||||||
|
|
||||||
export { buildingEn, buildingPartsEn, buildingPartsFieldsEn };
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
const buildingTr = {
|
|
||||||
building: "Bina Birinci Seviye",
|
|
||||||
};
|
|
||||||
const buildingPartsTr = {
|
|
||||||
...buildingTr,
|
|
||||||
parts: "Parçalar İkinci Seviye",
|
|
||||||
};
|
|
||||||
|
|
||||||
const buildingPartsFieldsTr = {
|
|
||||||
"Users.uuid": "UUID",
|
|
||||||
"Users.firstName": "Ad",
|
|
||||||
"Users.lastName": "Soyad",
|
|
||||||
"Users.email": "Email",
|
|
||||||
"Users.phoneNumber": "Telefon Numarası",
|
|
||||||
"Users.country": "Ülke",
|
|
||||||
"Users.description": "Açıklama",
|
|
||||||
"Users.isDeleted": "Silindi",
|
|
||||||
"Users.isConfirmed": "Onaylandı",
|
|
||||||
"Users.createdAt": "Oluşturulma Tarihi",
|
|
||||||
"Users.updatedAt": "Güncellenme Tarihi",
|
|
||||||
};
|
|
||||||
|
|
||||||
export { buildingTr, buildingPartsTr, buildingPartsFieldsTr };
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import { LanguageTypes } from "@/validations/mutual/language/validations";
|
import { LanguageTypes } from "@/validations/mutual/language/validations";
|
||||||
import { DynamicPage } from "@/validations/mutual/menu/menu";
|
import { DynamicPage } from "@/validations/mutual/menu/menu";
|
||||||
import { managementAccountTenantMain } from "./management/account/tenantSomething/index";
|
import { application } from "./application";
|
||||||
import { managementAccountTenantMainSecond } from "./management/account/tenantSomethingSecond/index";
|
|
||||||
|
|
||||||
const dynamicPagesIndex: Record<string, Record<LanguageTypes, DynamicPage>> = {
|
const dynamicPagesIndex: Record<string, Record<LanguageTypes, DynamicPage>> = {
|
||||||
dashboard: managementAccountTenantMain,
|
dashboard: application,
|
||||||
application: managementAccountTenantMain,
|
application: application,
|
||||||
services: managementAccountTenantMainSecond,
|
services: application,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { dynamicPagesIndex };
|
export { dynamicPagesIndex };
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
import { footerDefaultEn } from "@/languages/mutual/footer/english";
|
|
||||||
import { headerDefaultEn } from "@/languages/mutual/header/english";
|
|
||||||
import { managementAccountEn, managementAccountFieldsEn } from "../../english";
|
|
||||||
import { contentDefaultEn } from "@/languages/mutual/content/english";
|
|
||||||
|
|
||||||
const contentManagementAccountTenantSomethingEn = {
|
|
||||||
...managementAccountFieldsEn,
|
|
||||||
title: "Management Account Tenant Something",
|
|
||||||
content: "Management Account Tenant Something Content",
|
|
||||||
button: "Management Account Tenant Something Button",
|
|
||||||
};
|
|
||||||
const footerManagementAccountTenantSomethingEn = {
|
|
||||||
...footerDefaultEn,
|
|
||||||
page: "Management Account Tenant Something Footer",
|
|
||||||
};
|
|
||||||
const headerManagementAccountTenantSomethingEn = {
|
|
||||||
...headerDefaultEn,
|
|
||||||
page: "Management Account Tenant Something Header",
|
|
||||||
};
|
|
||||||
|
|
||||||
const menuManagementAccountTenantSomethingEn = {
|
|
||||||
...managementAccountEn,
|
|
||||||
"tenant/something": "Tenant Info",
|
|
||||||
};
|
|
||||||
|
|
||||||
const managementAccountTenantMainEn = {
|
|
||||||
header: headerManagementAccountTenantSomethingEn,
|
|
||||||
menu: menuManagementAccountTenantSomethingEn,
|
|
||||||
content: contentManagementAccountTenantSomethingEn,
|
|
||||||
footer: footerManagementAccountTenantSomethingEn,
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
contentManagementAccountTenantSomethingEn,
|
|
||||||
footerManagementAccountTenantSomethingEn,
|
|
||||||
headerManagementAccountTenantSomethingEn,
|
|
||||||
menuManagementAccountTenantSomethingEn,
|
|
||||||
managementAccountTenantMainEn,
|
|
||||||
};
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import { managementAccountTenantMainTr } from "./turkish";
|
|
||||||
import { managementAccountTenantMainEn } from "./english";
|
|
||||||
|
|
||||||
const managementAccountTenantMain = {
|
|
||||||
tr: managementAccountTenantMainTr,
|
|
||||||
en: managementAccountTenantMainEn,
|
|
||||||
}
|
|
||||||
|
|
||||||
export { managementAccountTenantMain }
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
import { footerDefaultTr } from "@/languages/mutual/footer/turkish";
|
|
||||||
import { headerDefaultTr } from "@/languages/mutual/header/turkish";
|
|
||||||
import { managementAccountTr } from "../../turkish";
|
|
||||||
|
|
||||||
const contentManagementAccountTenantSomethingTr = {
|
|
||||||
title: "Yönetim Hesap Kiracı Bilgileri",
|
|
||||||
description: "Yönetim Hesap Kiracı Bilgileri",
|
|
||||||
button: "Yönetim Hesap Kiracı Bilgileri Buton",
|
|
||||||
};
|
|
||||||
const footerManagementAccountTenantSomethingTr = {
|
|
||||||
...footerDefaultTr,
|
|
||||||
page: "Yönetim Hesap Kiracı Bilgileri Footer",
|
|
||||||
};
|
|
||||||
const headerManagementAccountTenantSomethingTr = {
|
|
||||||
...headerDefaultTr,
|
|
||||||
page: "Yönetim Hesap Kiracı Bilgileri Header",
|
|
||||||
};
|
|
||||||
|
|
||||||
const menuManagementAccountTenantSomethingTr = {
|
|
||||||
...managementAccountTr,
|
|
||||||
"tenant/something": "Kiracı Bilgileri",
|
|
||||||
};
|
|
||||||
const managementAccountTenantMainTr = {
|
|
||||||
header: headerManagementAccountTenantSomethingTr,
|
|
||||||
menu: menuManagementAccountTenantSomethingTr,
|
|
||||||
content: contentManagementAccountTenantSomethingTr,
|
|
||||||
footer: footerManagementAccountTenantSomethingTr,
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
contentManagementAccountTenantSomethingTr,
|
|
||||||
footerManagementAccountTenantSomethingTr,
|
|
||||||
headerManagementAccountTenantSomethingTr,
|
|
||||||
menuManagementAccountTenantSomethingTr,
|
|
||||||
managementAccountTenantMainTr,
|
|
||||||
};
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
import { footerDefaultEn } from "@/languages/mutual/footer/english";
|
|
||||||
import { headerDefaultEn } from "@/languages/mutual/header/english";
|
|
||||||
import { contentDefaultEn } from "@/languages/mutual/content/english";
|
|
||||||
import { managementAccountEn, managementAccountFieldsEn } from "../../english";
|
|
||||||
|
|
||||||
const contentManagementAccountTenantSomethingSecondEn = {
|
|
||||||
...contentDefaultEn,
|
|
||||||
...managementAccountFieldsEn,
|
|
||||||
title: "Management Account Tenant Something",
|
|
||||||
content: "Management Account Tenant Something Content",
|
|
||||||
button: "Management Account Tenant Something Button",
|
|
||||||
};
|
|
||||||
const footerManagementAccountTenantSomethingSecondEn = {
|
|
||||||
...footerDefaultEn,
|
|
||||||
page: "Management Account Tenant Something Second Footer",
|
|
||||||
};
|
|
||||||
const headerManagementAccountTenantSomethingSecondEn = {
|
|
||||||
...headerDefaultEn,
|
|
||||||
page: "Management Account Tenant Something Second Header",
|
|
||||||
};
|
|
||||||
|
|
||||||
const menuManagementAccountTenantSomethingSecondEn = {
|
|
||||||
...managementAccountEn,
|
|
||||||
"tenant/somethingSecond": "Tenant Info Second",
|
|
||||||
};
|
|
||||||
|
|
||||||
const managementAccountTenantMainSecondEn = {
|
|
||||||
header: headerManagementAccountTenantSomethingSecondEn,
|
|
||||||
menu: menuManagementAccountTenantSomethingSecondEn,
|
|
||||||
content: contentManagementAccountTenantSomethingSecondEn,
|
|
||||||
footer: footerManagementAccountTenantSomethingSecondEn,
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
contentManagementAccountTenantSomethingSecondEn,
|
|
||||||
footerManagementAccountTenantSomethingSecondEn,
|
|
||||||
headerManagementAccountTenantSomethingSecondEn,
|
|
||||||
menuManagementAccountTenantSomethingSecondEn,
|
|
||||||
managementAccountTenantMainSecondEn,
|
|
||||||
};
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
import { managementAccountTenantMainSecondTr } from "./turkish";
|
|
||||||
import { managementAccountTenantMainSecondEn } from "./english";
|
|
||||||
|
|
||||||
const managementAccountTenantMainSecond = {
|
|
||||||
tr: managementAccountTenantMainSecondTr,
|
|
||||||
en: managementAccountTenantMainSecondEn,
|
|
||||||
};
|
|
||||||
|
|
||||||
export { managementAccountTenantMainSecond };
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
import { footerDefaultTr } from "@/languages/mutual/footer/turkish";
|
|
||||||
import { headerDefaultTr } from "@/languages/mutual/header/turkish";
|
|
||||||
import { managementAccountTr, managementAccountFieldsTr } from "../../turkish";
|
|
||||||
|
|
||||||
const contentManagementAccountTenantSomethingSecondTr = {
|
|
||||||
...managementAccountFieldsTr,
|
|
||||||
title: "Yönetim Hesap Kiracı Bilgileri",
|
|
||||||
description: "Yönetim Hesap Kiracı Bilgileri",
|
|
||||||
button: "Yönetim Hesap Kiracı Bilgileri Buton",
|
|
||||||
};
|
|
||||||
const footerManagementAccountTenantSomethingSecondTr = {
|
|
||||||
...footerDefaultTr,
|
|
||||||
page: "Yönetim Hesap Kiracı Bilgileri Footer",
|
|
||||||
};
|
|
||||||
const headerManagementAccountTenantSomethingSecondTr = {
|
|
||||||
...headerDefaultTr,
|
|
||||||
page: "Yönetim Hesap Kiracı Bilgileri Header",
|
|
||||||
};
|
|
||||||
|
|
||||||
const menuManagementAccountTenantSomethingSecondTr = {
|
|
||||||
...managementAccountTr,
|
|
||||||
"tenant/somethingSecond": "İkinci Kiracı Bilgileri",
|
|
||||||
};
|
|
||||||
const managementAccountTenantMainSecondTr = {
|
|
||||||
header: headerManagementAccountTenantSomethingSecondTr,
|
|
||||||
menu: menuManagementAccountTenantSomethingSecondTr,
|
|
||||||
content: contentManagementAccountTenantSomethingSecondTr,
|
|
||||||
footer: footerManagementAccountTenantSomethingSecondTr,
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
contentManagementAccountTenantSomethingSecondTr,
|
|
||||||
footerManagementAccountTenantSomethingSecondTr,
|
|
||||||
headerManagementAccountTenantSomethingSecondTr,
|
|
||||||
menuManagementAccountTenantSomethingSecondTr,
|
|
||||||
managementAccountTenantMainSecondTr,
|
|
||||||
};
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
const managementEn = {
|
|
||||||
management: "Management First Layer Label",
|
|
||||||
};
|
|
||||||
|
|
||||||
const managementAccountEn = {
|
|
||||||
...managementEn,
|
|
||||||
account: "Account Second Layer Label",
|
|
||||||
};
|
|
||||||
|
|
||||||
const managementAccountFieldsEn = {
|
|
||||||
"User.firstName": "First Name",
|
|
||||||
"User.lastName": "Last Name",
|
|
||||||
"User.email": "Email",
|
|
||||||
"User.phoneNumber": "Phone Number",
|
|
||||||
"User.country": "Country",
|
|
||||||
"User.description": "Description",
|
|
||||||
"User.isDeleted": "Is Deleted",
|
|
||||||
"User.isConfirmed": "Is Confirmed",
|
|
||||||
"User.createdAt": "Created At",
|
|
||||||
"User.updatedAt": "Updated At",
|
|
||||||
};
|
|
||||||
|
|
||||||
export { managementEn, managementAccountEn, managementAccountFieldsEn };
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
const managementTr = {
|
|
||||||
management: "Management Birinci Seviye",
|
|
||||||
};
|
|
||||||
const managementAccountTr = {
|
|
||||||
...managementTr,
|
|
||||||
account: "Account İkinci Seviye",
|
|
||||||
};
|
|
||||||
|
|
||||||
const managementAccountFieldsTr = {
|
|
||||||
"User.firstName": "Ad",
|
|
||||||
"User.lastName": "Soyad",
|
|
||||||
"User.email": "Email",
|
|
||||||
"User.phoneNumber": "Telefon Numarası",
|
|
||||||
"User.country": "Ülke",
|
|
||||||
"User.description": "Açıklama",
|
|
||||||
"User.isDeleted": "Silindi",
|
|
||||||
"User.isConfirmed": "Onaylandı",
|
|
||||||
"User.createdAt": "Oluşturulma Tarihi",
|
|
||||||
"User.updatedAt": "Güncellenme Tarihi",
|
|
||||||
};
|
|
||||||
|
|
||||||
export { managementTr, managementAccountTr, managementAccountFieldsTr };
|
|
||||||
|
|
@ -1,18 +1,8 @@
|
||||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
import superUserTenantSomething from "./management/account/tenantSomething/page";
|
|
||||||
import superUserTenantSomethingSecond from "./management/account/tenantSomethingSecond/page";
|
|
||||||
import superUserBuildingPartsTenantSomething from "./building/parts/tenantSomething/page";
|
|
||||||
|
|
||||||
const pageIndexMulti: Record<string, Record<string, React.FC<ContentProps>>> = {
|
const pageIndexMulti: Record<
|
||||||
"management/account/tenant/something": {
|
string,
|
||||||
superUserTenantSomething: superUserTenantSomething,
|
Record<string, React.FC<ContentProps>>
|
||||||
},
|
> = {};
|
||||||
"management/account/tenant/somethingSecond": {
|
|
||||||
superUserTenantSomething: superUserTenantSomethingSecond,
|
|
||||||
},
|
|
||||||
"building/parts/tenant/something": {
|
|
||||||
superUserTenantSomething: superUserBuildingPartsTenantSomething,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default pageIndexMulti;
|
export default pageIndexMulti;
|
||||||
|
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
'use client';
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import TableComponent from "@/components/mutual/tableView/FullTableComp/component";
|
|
||||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
|
||||||
import { EyeIcon, PencilIcon, PlusCircle, ArrowLeftFromLineIcon } from "lucide-react";
|
|
||||||
import Link from "next/link";
|
|
||||||
import CreateForm from "@/components/mutual/tableView/mutual/CreateForm";
|
|
||||||
import UpdateForm from "@/components/mutual/tableView/mutual/UpdateForm";
|
|
||||||
import ViewForm from "@/components/mutual/tableView/mutual/ViewForm";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
// This is a mock page dont use it
|
|
||||||
const superUserTenantSomething: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
|
||||||
const router = useRouter()
|
|
||||||
const [selectedRow, setSelectedRow] = useState<any>(null);
|
|
||||||
const pageUrl = `/${lang}/${activePageUrl}?mode=list`
|
|
||||||
const urls = { list: "http://localhost:3000/api/tst" }
|
|
||||||
const initPaginationDefault = { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} }
|
|
||||||
const renderLastRowComponent = (reDirectUrl: string, IconToWrap: any) => {
|
|
||||||
return (<Link className="flex items-center gap-2" replace href={reDirectUrl} ><IconToWrap /></Link>)
|
|
||||||
}
|
|
||||||
const redirectUrls = {
|
|
||||||
table: {
|
|
||||||
update: renderLastRowComponent(`/${lang}/${activePageUrl}?mode=update`, PencilIcon),
|
|
||||||
view: renderLastRowComponent(`/${lang}/${activePageUrl}?mode=view`, EyeIcon),
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
create: renderLastRowComponent(`/${lang}/${activePageUrl}?mode=create`, PlusCircle),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const schemas = { list: {} }
|
|
||||||
const columns = [
|
|
||||||
"firstName",
|
|
||||||
"lastName",
|
|
||||||
"email",
|
|
||||||
"phoneNumber",
|
|
||||||
"country",
|
|
||||||
"description",
|
|
||||||
"isDeleted",
|
|
||||||
"isConfirmed",
|
|
||||||
"createdAt",
|
|
||||||
"updatedAt",
|
|
||||||
]
|
|
||||||
const ListWithTableProps = {
|
|
||||||
urls: {
|
|
||||||
list: "http://localhost:3000/api/tst",
|
|
||||||
},
|
|
||||||
schemas: schemas,
|
|
||||||
translations: translations,
|
|
||||||
columns: columns,
|
|
||||||
redirectUrls: redirectUrls,
|
|
||||||
initPagination: initPaginationDefault,
|
|
||||||
setSelectedRow: setSelectedRow,
|
|
||||||
}
|
|
||||||
const CreateFormProps = {
|
|
||||||
schemas: schemas,
|
|
||||||
selectedRow: selectedRow,
|
|
||||||
}
|
|
||||||
const UpdateFormProps = {
|
|
||||||
rollbackTo: pageUrl,
|
|
||||||
schemas: schemas,
|
|
||||||
selectedRow: selectedRow,
|
|
||||||
}
|
|
||||||
const ViewFormProps = {
|
|
||||||
rollbackTo: pageUrl,
|
|
||||||
schemas: schemas,
|
|
||||||
selectedRow: selectedRow,
|
|
||||||
}
|
|
||||||
|
|
||||||
const RenderBackToList = <div onClick={() => setSelectedRow(null)}>
|
|
||||||
{renderLastRowComponent(pageUrl, ArrowLeftFromLineIcon)}
|
|
||||||
</div>
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{JSON.stringify(translations)}
|
|
||||||
{mode !== 'list' ? RenderBackToList : <TableComponent {...ListWithTableProps} />}
|
|
||||||
{mode === 'create' && <CreateForm {...CreateFormProps} />}
|
|
||||||
{mode === 'update' && <UpdateForm {...UpdateFormProps} />}
|
|
||||||
{mode === 'view' && <ViewForm {...ViewFormProps} />}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default superUserTenantSomething
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
import FullCardTableComp from "@/components/mutual/tableView/FullCardTableComp/component";
|
|
||||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
|
||||||
|
|
||||||
// This is a mock page dont use it
|
|
||||||
const superUserTenantSomethingSecond: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
|
||||||
const urls = {
|
|
||||||
list: "http://localhost:3000/api/tst",
|
|
||||||
}
|
|
||||||
const tableTranslations = {
|
|
||||||
firstName: "First Name",
|
|
||||||
lastName: "Last Name",
|
|
||||||
email: "Email",
|
|
||||||
phoneNumber: "Phone Number",
|
|
||||||
country: "Country",
|
|
||||||
description: "Description",
|
|
||||||
isDeleted: "Is Deleted",
|
|
||||||
isConfirmed: "Is Confirmed",
|
|
||||||
createdAt: "Created At",
|
|
||||||
updatedAt: "Updated At",
|
|
||||||
}
|
|
||||||
const columns = [
|
|
||||||
"firstName",
|
|
||||||
"lastName",
|
|
||||||
"email",
|
|
||||||
"phoneNumber",
|
|
||||||
"country",
|
|
||||||
"description",
|
|
||||||
"isDeleted",
|
|
||||||
"isConfirmed",
|
|
||||||
"createdAt",
|
|
||||||
"updatedAt",
|
|
||||||
]
|
|
||||||
const redirectUrls = {}
|
|
||||||
const schemas = {}
|
|
||||||
const initPaginationDefault = { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} }
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{JSON.stringify(translations)}
|
|
||||||
<FullCardTableComp urls={urls} translations={tableTranslations} columns={columns}
|
|
||||||
initPagination={initPaginationDefault} schemas={schemas} redirectUrls={redirectUrls} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default superUserTenantSomethingSecond
|
|
||||||
|
|
@ -7,21 +7,24 @@ import pageIndexMulti from "@/pages/multi/index";
|
||||||
import pageIndexSingle from "@/pages/single/index";
|
import pageIndexSingle from "@/pages/single/index";
|
||||||
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
||||||
|
|
||||||
function resolveWhichPageToRenderSingle({
|
async function resolveWhichPageToRenderSingle({ activePageUrl }: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||||
activePageUrl,
|
|
||||||
}: ResolverProps): React.FC<ContentProps> {
|
|
||||||
return activePageUrl in pageIndexSingle ? pageIndexSingle[activePageUrl] : ContentToRenderNoPage
|
|
||||||
}
|
|
||||||
|
|
||||||
async function resolveWhichPageToRenderMulti({
|
|
||||||
activePageUrl,
|
|
||||||
}: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
|
||||||
const pageToRender = await retrievePageToRender(activePageUrl) // TODO: Retrieve page to render
|
|
||||||
try {
|
try {
|
||||||
const ApplicationToRender = pageIndexMulti[activePageUrl][pageToRender]
|
console.log('activePageUrl', activePageUrl)
|
||||||
|
const ApplicationToRender = pageIndexSingle[`/${activePageUrl}`]
|
||||||
return ApplicationToRender
|
return ApplicationToRender
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error('resolveWhichPageToRenderSingle', error)
|
||||||
|
}
|
||||||
|
return ContentToRenderNoPage
|
||||||
|
}
|
||||||
|
|
||||||
|
async function resolveWhichPageToRenderMulti({ activePageUrl }: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||||
|
const pageToRender = await retrievePageToRender(activePageUrl)
|
||||||
|
try {
|
||||||
|
const ApplicationToRender = pageIndexMulti[`${activePageUrl}`][pageToRender]
|
||||||
|
return ApplicationToRender
|
||||||
|
} catch (error) {
|
||||||
|
console.error('resolveWhichPageToRenderMulti', error)
|
||||||
}
|
}
|
||||||
return ContentToRenderNoPage
|
return ContentToRenderNoPage
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@ import { getSchemaByLanguage } from "@/schemas/custom/application/schemas";
|
||||||
import { API_BASE_URL } from "@/config/config";
|
import { API_BASE_URL } from "@/config/config";
|
||||||
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
||||||
|
|
||||||
|
|
||||||
// This is a mock page dont use it
|
// This is a mock page dont use it
|
||||||
const superUserApplicationRegister: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
const SuperUserApplicationPage: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||||
const [selectedRow, setSelectedRow] = useState<any>(null);
|
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||||
|
|
||||||
const getSchema = getSchemaByLanguage(lang)
|
const getSchema = getSchemaByLanguage(lang)
|
||||||
|
|
@ -33,7 +32,8 @@ const superUserApplicationRegister: React.FC<ContentProps> = ({ lang, translatio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const listWithTableProps = {
|
const listWithTableProps = {
|
||||||
urls: { list: `${API_BASE_URL}/application/register` },
|
urls: { list: `${API_BASE_URL}/applications/pages` },
|
||||||
|
schemas: { table: getSchema.shortSchema },
|
||||||
translations: translations,
|
translations: translations,
|
||||||
redirectUrls: redirectUrls,
|
redirectUrls: redirectUrls,
|
||||||
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
||||||
|
|
@ -70,4 +70,4 @@ const superUserApplicationRegister: React.FC<ContentProps> = ({ lang, translatio
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default superUserApplicationRegister
|
export default SuperUserApplicationPage
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
'use client';
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import TableComponent from "@/components/mutual/tableView/FullTableComp/component";
|
||||||
|
import CreateForm from "@/components/mutual/tableView/mutual/CreateForm";
|
||||||
|
import UpdateForm from "@/components/mutual/tableView/mutual/UpdateForm";
|
||||||
|
import ViewForm from "@/components/mutual/tableView/mutual/ViewForm";
|
||||||
|
|
||||||
|
import { EyeIcon, PencilIcon, PlusCircle, ArrowLeftFromLineIcon, ExpandIcon } from "lucide-react";
|
||||||
|
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
|
import { getSchemaByLanguage } from "@/schemas/custom/application/schemas";
|
||||||
|
import { API_BASE_URL } from "@/config/config";
|
||||||
|
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
||||||
|
|
||||||
|
|
||||||
|
// This is a mock page dont use it
|
||||||
|
const SuperUserDashboardPage: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||||
|
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||||
|
|
||||||
|
const getSchema = getSchemaByLanguage(lang)
|
||||||
|
const basePageUrl = `/panel/${lang}/${activePageUrl}?mode=`
|
||||||
|
const isList = mode === 'shortList' || mode === 'fullList'
|
||||||
|
const changeList = mode === 'shortList' ? `${basePageUrl}fullList` : `${basePageUrl}shortList`
|
||||||
|
|
||||||
|
const RenderBackToList = renderLastRowComponent(`${basePageUrl}shortList`, ArrowLeftFromLineIcon, "backToList")
|
||||||
|
const redirectUrls = {
|
||||||
|
table: {
|
||||||
|
update: renderLastRowComponent(`${basePageUrl}update`, PencilIcon, "update"),
|
||||||
|
view: renderLastRowComponent(`${basePageUrl}view`, EyeIcon, "view"),
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
create: renderLastRowComponent(`${basePageUrl}create`, PlusCircle, "create"),
|
||||||
|
size: renderLastRowComponent(changeList, ExpandIcon, "size-table"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const listWithTableProps = {
|
||||||
|
urls: { list: `${API_BASE_URL}/applications/pages` },
|
||||||
|
schemas: { table: getSchema.shortSchema },
|
||||||
|
translations: translations,
|
||||||
|
redirectUrls: redirectUrls,
|
||||||
|
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
||||||
|
setSelectedRow: setSelectedRow,
|
||||||
|
}
|
||||||
|
const CreateFormProps = {
|
||||||
|
schemas: { create: getSchema.createSchema },
|
||||||
|
labels: getSchema.labels,
|
||||||
|
selectedRow: selectedRow,
|
||||||
|
}
|
||||||
|
const UpdateFormProps = {
|
||||||
|
rollbackTo: changeList,
|
||||||
|
schemas: { update: getSchema.updateSchema },
|
||||||
|
labels: getSchema.labels,
|
||||||
|
selectedRow: selectedRow,
|
||||||
|
}
|
||||||
|
const ViewFormProps = {
|
||||||
|
rollbackTo: changeList,
|
||||||
|
schemas: { view: getSchema.detailSchema },
|
||||||
|
selectedRow: selectedRow,
|
||||||
|
labels: getSchema.labels,
|
||||||
|
}
|
||||||
|
const shortAddProps = { ...listWithTableProps, schemas: { table: getSchema.shortSchema }, columns: { table: getSchema.shortColumns } }
|
||||||
|
const fullAddProps = { ...listWithTableProps, schemas: { table: getSchema.detailSchema }, columns: { table: getSchema.columns } }
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{!isList && RenderBackToList}
|
||||||
|
{isList && mode === 'shortList' && <TableComponent {...shortAddProps} />}
|
||||||
|
{isList && mode === 'fullList' && <TableComponent {...fullAddProps} />}
|
||||||
|
{mode === 'create' && <CreateForm {...CreateFormProps} />}
|
||||||
|
{mode === 'update' && <UpdateForm {...UpdateFormProps} />}
|
||||||
|
{mode === 'view' && <ViewForm {...ViewFormProps} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SuperUserDashboardPage
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
import superUserTenantSomething from "./management/account/tenantSomething/page";
|
import SuperUserApplicationPage from "./application/page";
|
||||||
import superUserTenantSomethingSecond from "./management/account/tenantSomethingSecond/page";
|
import SuperUserServicePage from "./services/page";
|
||||||
import superUserBuildingPartsTenantSomething from "./building/parts/tenantSomething/page";
|
import SuperUserDashboardPage from "./dashboard/page";
|
||||||
|
|
||||||
const pageIndexSingle: Record<string, React.FC<ContentProps>> = {
|
const pageIndexSingle: Record<string, React.FC<ContentProps>> = {
|
||||||
dashboard: superUserTenantSomething,
|
"/dashboard": SuperUserDashboardPage,
|
||||||
application: superUserTenantSomethingSecond,
|
"/application": SuperUserApplicationPage,
|
||||||
service: superUserBuildingPartsTenantSomething,
|
"/service": SuperUserServicePage,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default pageIndexSingle;
|
export default pageIndexSingle;
|
||||||
|
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
|
||||||
|
|
||||||
// This is a mock page dont use it
|
|
||||||
const superUserTenantSomething: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
|
||||||
return <>
|
|
||||||
<h1 className="text-4xl font-bold mb-10">{JSON.stringify(translations)}{" "}{lang}{" "}{activePageUrl}</h1>
|
|
||||||
<div className="h-16">Some Content 1</div>
|
|
||||||
<div className="h-16">Some Content 2</div>
|
|
||||||
<div className="h-16">Some Content 3</div>
|
|
||||||
<div className="h-16">Some Content 4</div>
|
|
||||||
<div className="h-16">Some Content 5</div>
|
|
||||||
<div className="h-16">Some Content 6</div>
|
|
||||||
<div className="h-16">Some Content 7</div>
|
|
||||||
<div className="h-16">Some Content 8</div>
|
|
||||||
<div className="h-16">Some Content 9</div>
|
|
||||||
<div className="h-16">Some Content 10</div>
|
|
||||||
<div className="h-16">Some Content 11</div>
|
|
||||||
<div className="h-16">Some Content 12</div>
|
|
||||||
<div className="h-16">Some Content 13</div>
|
|
||||||
<div className="h-16">Some Content 14</div>
|
|
||||||
<div className="h-16">Some Content 15</div>
|
|
||||||
<div className="h-16">Some Content 16</div>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default superUserTenantSomething
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
|
||||||
|
|
||||||
// This is a mock page dont use it
|
|
||||||
const superUserTenantSomethingSecond: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
|
||||||
return <>
|
|
||||||
<h1 className="text-4xl font-bold mb-10">{JSON.stringify(translations)}{" "}{lang}{" "}{activePageUrl}</h1>
|
|
||||||
<div className="h-16">Some Content 1</div>
|
|
||||||
<div className="h-16">Some Content 2</div>
|
|
||||||
<div className="h-16">Some Content 3</div>
|
|
||||||
<div className="h-16">Some Content 4</div>
|
|
||||||
<div className="h-16">Some Content 5</div>
|
|
||||||
<div className="h-16">Some Content 6</div>
|
|
||||||
<div className="h-16">Some Content 7</div>
|
|
||||||
<div className="h-16">Some Content 8</div>
|
|
||||||
<div className="h-16">Some Content 9</div>
|
|
||||||
<div className="h-16">Some Content 10</div>
|
|
||||||
<div className="h-16">Some Content 11</div>
|
|
||||||
<div className="h-16">Some Content 12</div>
|
|
||||||
<div className="h-16">Some Content 13</div>
|
|
||||||
<div className="h-16">Some Content 14</div>
|
|
||||||
<div className="h-16">Some Content 15</div>
|
|
||||||
<div className="h-16">Some Content 16</div>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default superUserTenantSomethingSecond
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
'use client';
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import TableComponent from "@/components/mutual/tableView/FullTableComp/component";
|
||||||
|
import CreateForm from "@/components/mutual/tableView/mutual/CreateForm";
|
||||||
|
import UpdateForm from "@/components/mutual/tableView/mutual/UpdateForm";
|
||||||
|
import ViewForm from "@/components/mutual/tableView/mutual/ViewForm";
|
||||||
|
|
||||||
|
import { EyeIcon, PencilIcon, PlusCircle, ArrowLeftFromLineIcon, ExpandIcon } from "lucide-react";
|
||||||
|
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||||
|
import { getSchemaByLanguage } from "@/schemas/custom/application/schemas";
|
||||||
|
import { API_BASE_URL } from "@/config/config";
|
||||||
|
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
||||||
|
|
||||||
|
|
||||||
|
// This is a mock page dont use it
|
||||||
|
const SuperUserServicePage: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||||
|
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||||
|
|
||||||
|
const getSchema = getSchemaByLanguage(lang)
|
||||||
|
const basePageUrl = `/panel/${lang}/${activePageUrl}?mode=`
|
||||||
|
const isList = mode === 'shortList' || mode === 'fullList'
|
||||||
|
const changeList = mode === 'shortList' ? `${basePageUrl}fullList` : `${basePageUrl}shortList`
|
||||||
|
|
||||||
|
const RenderBackToList = renderLastRowComponent(`${basePageUrl}shortList`, ArrowLeftFromLineIcon, "backToList")
|
||||||
|
const redirectUrls = {
|
||||||
|
table: {
|
||||||
|
update: renderLastRowComponent(`${basePageUrl}update`, PencilIcon, "update"),
|
||||||
|
view: renderLastRowComponent(`${basePageUrl}view`, EyeIcon, "view"),
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
create: renderLastRowComponent(`${basePageUrl}create`, PlusCircle, "create"),
|
||||||
|
size: renderLastRowComponent(changeList, ExpandIcon, "size-table"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const listWithTableProps = {
|
||||||
|
urls: { list: `${API_BASE_URL}/applications/pages` },
|
||||||
|
schemas: { table: getSchema.shortSchema },
|
||||||
|
translations: translations,
|
||||||
|
redirectUrls: redirectUrls,
|
||||||
|
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
||||||
|
setSelectedRow: setSelectedRow,
|
||||||
|
}
|
||||||
|
const CreateFormProps = {
|
||||||
|
schemas: { create: getSchema.createSchema },
|
||||||
|
labels: getSchema.labels,
|
||||||
|
selectedRow: selectedRow,
|
||||||
|
}
|
||||||
|
const UpdateFormProps = {
|
||||||
|
rollbackTo: changeList,
|
||||||
|
schemas: { update: getSchema.updateSchema },
|
||||||
|
labels: getSchema.labels,
|
||||||
|
selectedRow: selectedRow,
|
||||||
|
}
|
||||||
|
const ViewFormProps = {
|
||||||
|
rollbackTo: changeList,
|
||||||
|
schemas: { view: getSchema.detailSchema },
|
||||||
|
selectedRow: selectedRow,
|
||||||
|
labels: getSchema.labels,
|
||||||
|
}
|
||||||
|
const shortAddProps = { ...listWithTableProps, schemas: { table: getSchema.shortSchema }, columns: { table: getSchema.shortColumns } }
|
||||||
|
const fullAddProps = { ...listWithTableProps, schemas: { table: getSchema.detailSchema }, columns: { table: getSchema.columns } }
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{!isList && RenderBackToList}
|
||||||
|
{isList && mode === 'shortList' && <TableComponent {...shortAddProps} />}
|
||||||
|
{isList && mode === 'fullList' && <TableComponent {...fullAddProps} />}
|
||||||
|
{mode === 'create' && <CreateForm {...CreateFormProps} />}
|
||||||
|
{mode === 'update' && <UpdateForm {...UpdateFormProps} />}
|
||||||
|
{mode === 'view' && <ViewForm {...ViewFormProps} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SuperUserServicePage
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { LanguageTypes } from "@/validations/mutual/language/validations";
|
import { LanguageTypes } from "@/validations/mutual/language/validations";
|
||||||
import { buildingPartsFieldsTr } from "@/languages/custom/building/turkish";
|
import { applicationFieldsTr } from "@/languages/custom/application/turkish";
|
||||||
import { buildingPartsFieldsEn } from "@/languages/custom/building/english";
|
import { applicationFieldsEn } from "@/languages/custom/application/english";
|
||||||
|
|
||||||
interface ApplicationData {
|
interface ApplicationData {
|
||||||
uu_id: string;
|
uu_id: string;
|
||||||
|
|
@ -18,8 +18,8 @@ interface ApplicationData {
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelTranslations = {
|
const labelTranslations = {
|
||||||
tr: buildingPartsFieldsTr,
|
tr: applicationFieldsTr,
|
||||||
en: buildingPartsFieldsEn,
|
en: applicationFieldsEn,
|
||||||
};
|
};
|
||||||
|
|
||||||
const errorMessages = {
|
const errorMessages = {
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@ interface UpdateFormProps {
|
||||||
schemas: Record<string, any>;
|
schemas: Record<string, any>;
|
||||||
selectedRow: Record<string, any>;
|
selectedRow: Record<string, any>;
|
||||||
rollbackTo: string;
|
rollbackTo: string;
|
||||||
labels: Record<string, string>;
|
labels: any;
|
||||||
}
|
}
|
||||||
interface CreateFormProps {
|
interface CreateFormProps {
|
||||||
schemas: Record<string, any>;
|
schemas: Record<string, any>;
|
||||||
selectedRow: Record<string, any>;
|
selectedRow: Record<string, any>;
|
||||||
labels: Record<string, string>;
|
labels: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ViewFormProps {
|
interface ViewFormProps {
|
||||||
schemas: Record<string, any>;
|
schemas: Record<string, any>;
|
||||||
selectedRow: Record<string, any>;
|
selectedRow: Record<string, any>;
|
||||||
rollbackTo: string;
|
rollbackTo: string;
|
||||||
labels: Record<string, string>;
|
labels: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { UpdateFormProps, CreateFormProps, ViewFormProps };
|
export type { UpdateFormProps, CreateFormProps, ViewFormProps };
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
export const WEB_BASE_URL = process.env.WEB_BASE_URL;
|
const BASE_URL = "http://localhost:3000";
|
||||||
export const API_BASE_URL = process.env.API_BASE_URL;
|
const API_URL = "http://localhost:3000/api";
|
||||||
|
export const WEB_BASE_URL = process.env.WEB_BASE_URL || BASE_URL;
|
||||||
|
export const API_BASE_URL = process.env.API_BASE_URL || API_URL;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
events_index: dict = {
|
|
||||||
"Slot1": "",
|
|
||||||
"Slot2": "",
|
|
||||||
"Slot3": "",
|
|
||||||
"Slot4": "",
|
|
||||||
"Slot5": "",
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue