27 lines
936 B
Python
27 lines
936 B
Python
from modules.fulfillment_base.models import Product
|
|
from modules.fulfillment_base.repositories import ProductRepository
|
|
from modules.fulfillment_base.schemas.product import (
|
|
CreateProductRequest,
|
|
ProductSchema,
|
|
UpdateProductRequest,
|
|
)
|
|
from services.mixins import *
|
|
|
|
|
|
class ProductService(
|
|
ServiceGetAllMixin[Product, ProductSchema],
|
|
ServiceCreateMixin[Product, CreateProductRequest, ProductSchema],
|
|
ServiceUpdateMixin[Product, UpdateProductRequest],
|
|
ServiceDeleteMixin[Product],
|
|
):
|
|
schema_class = ProductSchema
|
|
entity_deleted_msg = "Товар успешно удален"
|
|
entity_updated_msg = "Товар успешно обновлен"
|
|
entity_created_msg = "Товар успешно создан"
|
|
|
|
def __init__(self, session: AsyncSession):
|
|
self.repository = ProductRepository(session)
|
|
|
|
async def is_soft_delete(self, product: ProductSchema) -> bool:
|
|
return True
|