31 lines
742 B
Python
31 lines
742 B
Python
from fastapi import APIRouter, Path
|
|
|
|
from backend.dependecies import SessionDependency
|
|
from schemas.attr_select import *
|
|
from services import AttrSelectService
|
|
|
|
router = APIRouter(tags=["attr_select"])
|
|
|
|
|
|
@router.get(
|
|
"/",
|
|
response_model=GetAllAttrSelectsResponse,
|
|
operation_id="get_attr_selects",
|
|
)
|
|
async def get_attr_selects(
|
|
session: SessionDependency,
|
|
):
|
|
return await AttrSelectService(session).get_all()
|
|
|
|
|
|
@router.get(
|
|
"/{selectId}",
|
|
response_model=GetAllAttrSelectOptionsResponse,
|
|
operation_id="get_attr_select_options",
|
|
)
|
|
async def get_attr_select_options(
|
|
session: SessionDependency,
|
|
select_id: int = Path(alias="selectId"),
|
|
):
|
|
return await AttrSelectService(session).get_options(select_id)
|