from typing import _ProtocolMeta | |
from fastapi import APIRouter, Body | |
from fastapi.responses import JSONResponse | |
from restful.cachings import connector | |
from restful.schemas import ForecastingServiceSchema | |
from restful.controllers import ForecastingControllers | |
""" API Router """ | |
route = APIRouter() | |
""" Forecasting Controller """ | |
__CONTROLLER: ForecastingControllers = ForecastingControllers() | |
""" Caching Connector """ | |
__CONNECTOR: _ProtocolMeta = connector | |
""" Algorithms Route """ | |
async def algorithms_route() -> JSONResponse: | |
return await __CONTROLLER.algorithms_controller() | |
""" Currencies Route """ | |
async def currencies_route() -> JSONResponse: | |
return await __CONTROLLER.currencies_controller() | |
""" Forecasting Route """ | |
async def forecasting_route( | |
payload: ForecastingServiceSchema = Body(...) | |
) -> JSONResponse: | |
return await __CONTROLLER.forecasting_controller(payload = payload, caching = __CONNECTOR) | |