o
    2Id                     @   sz   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	d
ZdS )    N)	APIRouterRequestBodystatus)DictList)jsonable_encoder)JSONResponse)*z/get_product_name/{filter}requestc                    sj   | j j }|dkr|d}n|d|}g }|jdkr3|D ]}||d |d d q"|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   rowsZproduct_datarow r   7D:\Vignesh\Freelance\Astroved\api_v1\routes\products.pyget_product_name   s"   	

r   )arrowfastapir   r   r   r   typingr   r   fastapi.encodersr   fastapi.responsesr	   
lib.commonjsonroutergetr   r   r   r   r   <module>   s    