feat: deal attributes with select and options
This commit is contained in:
30
routers/crm/v1/attr_select.py
Normal file
30
routers/crm/v1/attr_select.py
Normal 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)
|
||||
Reference in New Issue
Block a user