--
This commit is contained in:
@@ -5,7 +5,7 @@ from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.audit.service import AuditService
|
||||
from app.common.enums import AuditAction, EntityType, Role
|
||||
from app.common.enums import AuditAction, EntityType, Role, FIELD_ROLES
|
||||
from app.common.exceptions import ConflictError, NotFoundError
|
||||
from app.common.utils import snapshot
|
||||
from app.products.models import Product
|
||||
@@ -27,7 +27,7 @@ class ProductService:
|
||||
|
||||
async def list_for(self, actor: User) -> list[Product]:
|
||||
stmt = select(Product).where(Product.company_id == actor.company_id).order_by(Product.name)
|
||||
if actor.role == Role.MR:
|
||||
if actor.role in FIELD_ROLES:
|
||||
stmt = stmt.where(Product.is_active.is_(True))
|
||||
return list((await self.db.execute(stmt)).scalars().all())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user