File size: 1,042 Bytes
89eb9ba 0a7b47e 89eb9ba d7df8d0 89eb9ba 0a7b47e d7df8d0 0a7b47e 89eb9ba d7df8d0 89eb9ba 0a7b47e d7df8d0 0a7b47e 89eb9ba 0a7b47e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
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 """
@route.get(path = '/algorithms')
async def algorithms_route() -> JSONResponse:
return await __CONTROLLER.algorithms_controller()
""" Currencies Route """
@route.get(path = '/currencies')
async def currencies_route() -> JSONResponse:
return await __CONTROLLER.currencies_controller()
""" Forecasting Route """
@route.post(path = '/forecasting')
async def forecasting_route(
payload: ForecastingServiceSchema = Body(...)
) -> JSONResponse:
return await __CONTROLLER.forecasting_controller(payload = payload, caching = __CONNECTOR)
|