feat: modules, products, services, services kits
This commit is contained in:
27
modules/fulfillment_base/services/product.py
Normal file
27
modules/fulfillment_base/services/product.py
Normal file
@ -0,0 +1,27 @@
|
||||
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_not_found_msg = "Товар не найден"
|
||||
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
|
||||
Reference in New Issue
Block a user