22 lines
751 B
Python
22 lines
751 B
Python
from sqlalchemy import Select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from models import AttributeOption
|
|
from repositories.mixins import RepCrudMixin
|
|
from schemas.attr_option import CreateAttrOptionSchema, UpdateAttrOptionSchema
|
|
|
|
|
|
class AttrOptionRepository(
|
|
RepCrudMixin[AttributeOption, CreateAttrOptionSchema, UpdateAttrOptionSchema],
|
|
):
|
|
session: AsyncSession
|
|
entity_class = AttributeOption
|
|
entity_not_found_msg = "Опция не найдена"
|
|
|
|
def _process_get_all_stmt_with_args(self, stmt: Select, *args) -> Select:
|
|
select_id = args[0]
|
|
return stmt.where(
|
|
AttributeOption.select_id == select_id,
|
|
AttributeOption.is_deleted.is_(False),
|
|
).order_by(AttributeOption.id)
|