feat: attr options and selects editing

This commit is contained in:
2025-11-04 12:18:53 +04:00
parent a7bda3d9f6
commit c266814c96
11 changed files with 239 additions and 40 deletions

View File

@ -4,21 +4,21 @@ from models import AttributeSelect
from repositories import AttrSelectRepository
from schemas.attr_select import (
AttrSelectSchema,
GetAllAttrSelectOptionsResponse,
AttrOptionSchema,
CreateAttrSelectRequest,
UpdateAttrSelectRequest,
)
from services.mixins import ServiceGetAllMixin
from services.mixins import ServiceCrudMixin
class AttrSelectService(ServiceGetAllMixin[AttributeSelect, AttrSelectSchema]):
class AttrSelectService(
ServiceCrudMixin[
AttributeSelect,
AttrSelectSchema,
CreateAttrSelectRequest,
UpdateAttrSelectRequest,
]
):
schema_class = AttrSelectSchema
def __init__(self, session: AsyncSession):
self.repository = AttrSelectRepository(session)
async def get_options(self, select_id: int) -> GetAllAttrSelectOptionsResponse:
options = await self.repository.get_options(select_id)
return GetAllAttrSelectOptionsResponse(
items=[AttrOptionSchema.model_validate(option) for option in options]
)