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

@ -1,19 +1,12 @@
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from models import AttributeSelect, AttributeOption
from repositories.base import BaseRepository
from repositories.mixins import RepGetAllMixin
from models import AttributeSelect
from repositories.mixins import RepCrudMixin
from schemas.attr_select import UpdateAttrSelectSchema, CreateAttrSelectSchema
class AttrSelectRepository(BaseRepository, RepGetAllMixin[AttributeSelect]):
class AttrSelectRepository(
RepCrudMixin[AttributeSelect, CreateAttrSelectSchema, UpdateAttrSelectSchema],
):
session: AsyncSession
entity_class = AttributeSelect
async def get_options(self, select_id: int) -> list[AttributeOption]:
stmt = select(AttributeOption).where(
AttributeOption.select_id == select_id,
AttributeOption.is_deleted.is_(False),
)
result = await self.session.execute(stmt)
return list(result.scalars().all())