
    2Id                         d dl Z d dlmZmZmZmZ d dlmZmZ d dl	m
Z
 d dlmZ d dlT d dlZ e            Ze                    d          defd	            ZdS )
    N)	APIRouterRequestBodystatus)DictList)jsonable_encoder)JSONResponse)*z/get_product_name/{filter}requestc                 >  K   | j         j                                        }|dk    r|                    d          }n(|                    d                    |                    }g }|j        dk    r+|D ]&}|                    |d         |d         d           '|S g S )N0aP  select Distinct top 20 PAT.Name,PT.ProductId from ProductTranslation PT inner join Vaaak.ProductAdditionalTranslation PAT on PT.ProductAdditionalTransId = PAT.ProductAdditionalTransId inner join dbo.Product P on PT.ProductId = P.ProductId inner dbo.Inventory INV on INV.ProductId = P.ProductId where PT.LocaleId=1 and PAT.Name like '%%'aW  select Distinct top 20 PAT.Name,PT.ProductId from ProductTranslation PT inner join Vaaak.ProductAdditionalTranslation PAT on PT.ProductAdditionalTransId = PAT.ProductAdditionalTransId inner join dbo.Product P on PT.ProductId = P.ProductId inner join dbo.Inventory INV on INV.ProductId = P.ProductId where PT.LocaleId=1 and PAT.Name like '%{}%'r      )product_name
product_id)appmssqlcursorexecuteformatrowcountappend)r   filterr   rowsproduct_datarows         "D:\Sites\api_v1\routes\products.pyget_product_namer      s       [%%''F}}~~ K L L ~~; <B6&>>K K L} 	 	C #A!!f! !     	    )arrowfastapir   r   r   r   typingr   r   fastapi.encodersr	   fastapi.responsesr
   
lib.commonjsonroutergetr    r   r   <module>r*      s     4 4 4 4 4 4 4 4 4 4 4 4         - - - - - - * * * * * *     	())G    *)  r   