feat: attr options and selects editing
This commit is contained in:
@ -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())
|
||||
|
||||
Reference in New Issue
Block a user