From 2c4037c1b5ed42c5839e74e1c02cb41461f25186 Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Sun, 19 Jan 2025 19:44:25 +0400 Subject: [PATCH] feat: factory article for product --- models/product.py | 1 + schemas/product.py | 1 + services/product.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/models/product.py b/models/product.py index b908e96..27395a7 100644 --- a/models/product.py +++ b/models/product.py @@ -15,6 +15,7 @@ class Product(BaseModel): id = Column(Integer, autoincrement=True, primary_key=True, index=True) name = Column(String, nullable=False, index=True) article = Column(String, nullable=False, default='', server_default='', index=True) + factory_article = Column(String, nullable=False, default='', server_default='', index=True) client_id = Column(Integer, ForeignKey('clients.id'), nullable=False, comment='ID сделки') client = relationship('Client', back_populates='products') diff --git a/schemas/product.py b/schemas/product.py index 1320294..15dbd1a 100644 --- a/schemas/product.py +++ b/schemas/product.py @@ -15,6 +15,7 @@ class ProductImageSchema(BaseSchema): class BaseProductSchema(BaseSchema): name: str article: str | None = '' + factory_article: str | None = '' client_id: int barcodes: list[str] barcode_template: BarcodeTemplateSchema | None = None diff --git a/services/product.py b/services/product.py index 05d17df..7ea1a37 100644 --- a/services/product.py +++ b/services/product.py @@ -127,7 +127,8 @@ class ProductService(BaseService): or_( Product.name.ilike(f'%{search_input}%'), Product.barcodes.any(ProductBarcode.barcode.ilike(f'%{search_input}%')), - Product.article.ilike(f'%{search_input}%') + Product.article.ilike(f'%{search_input}%'), + Product.factory_article.ilike(f'%{search_input}%'), ) ) )