feat: deal attributes with select and options

This commit is contained in:
2025-10-29 19:37:27 +04:00
parent 0e8c9077c9
commit 82fcd6e8cb
14 changed files with 206 additions and 23 deletions

View File

@ -0,0 +1,30 @@
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)