Changes to endpoints so they allow to only get context and then the exercises as well as tidying up a bit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from dependency_injector.wiring import Provide, inject
|
||||
from fastapi import APIRouter, Depends, UploadFile, Request
|
||||
|
||||
from app.dtos.level import LevelExercisesDTO
|
||||
from app.middlewares import Authorized, IsAuthenticatedViaBearerToken
|
||||
from app.controllers.abc import ILevelController
|
||||
|
||||
@@ -8,6 +9,17 @@ controller = "level_controller"
|
||||
level_router = APIRouter()
|
||||
|
||||
|
||||
@level_router.post(
|
||||
'/',
|
||||
dependencies=[Depends(Authorized([IsAuthenticatedViaBearerToken]))]
|
||||
)
|
||||
@inject
|
||||
async def generate_exercises(
|
||||
dto: LevelExercisesDTO,
|
||||
level_controller: ILevelController = Depends(Provide[controller])
|
||||
):
|
||||
return await level_controller.generate_exercises(dto)
|
||||
|
||||
@level_router.get(
|
||||
'/',
|
||||
dependencies=[Depends(Authorized([IsAuthenticatedViaBearerToken]))]
|
||||
@@ -31,7 +43,7 @@ async def get_level_utas(
|
||||
|
||||
|
||||
@level_router.post(
|
||||
'/upload',
|
||||
'/import/',
|
||||
dependencies=[Depends(Authorized([IsAuthenticatedViaBearerToken]))]
|
||||
)
|
||||
@inject
|
||||
@@ -43,7 +55,7 @@ async def upload(
|
||||
|
||||
|
||||
@level_router.post(
|
||||
'/custom',
|
||||
'/custom/',
|
||||
dependencies=[Depends(Authorized([IsAuthenticatedViaBearerToken]))]
|
||||
)
|
||||
@inject
|
||||
|
||||
Reference in New Issue
Block a user