feat: attr options and selects editing
This commit is contained in:
21
repositories/attr_option.py
Normal file
21
repositories/attr_option.py
Normal file
@ -0,0 +1,21 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user