
    oe                         d dl Z d dlZd dlmZ d dlmZmZ d dlmZ d dlm	Z
 d dlmZ d dlmZ d dlmZ  ed	d
g          Ze                    dddde
j        ej                   ej         ee                    fde
j        dede
j        fd            Ze                    ddddee
j                 ej                  ddd ej         ee                    fdededz  dedz  dedz  dedee
j                 fd            Ze                    ddd d!ee
j                 ej                   ej         ee                    fdededee
j                 fd"            Ze                    d#d$d%d&ee
j                  ej                   ej         ee                    fdededee
j                  fd'            Z!e                    d(d)d*d+ej        ,           ej         ee                    fdefd-            Z"dS ).    N)FileResponse)	APIRouterstatus)StreamingResponse)article)ArticleRepository)get_repository)
parse_shopz	/articlesarticles)prefixtagszget-article-color-sizesz!articles::get-article-color-sizesgetArticleColorSizesz)Get article with colors, sizes and prices)pathnameoperation_idsummaryresponse_modelstatus_codequery
repositoryreturnc                 <   K   |                     |            d {V S N)get_article_color_size)r   r   s     L/Users/daniilossinkin/PycharmProjects/ShopsBackend/src/api/routes/article.pyget_article_color_sizesr      s.       225999999999    z/get-articles/{shop}zarticles::get-articlesgetArticlesz0The list of available articles for selected shopshopcolorsizethemec                 ~   K   |                     t          |           |||rt          |          nd            d {V S r   )get_articlesr
   int)r   r    r!   r"   r   s        r   r$   r$      sa       ((4%E


	        r   z/colors/{shop}zarticles::get-colors	getColorszVThe list of colors of available articles for selected shop. Primarily used for filter.c                 V   K   |                     t          |                      d {V S r   )
get_colorsr
   r   r   s     r   r(   r(   6   s6       &&z$'7'7888888888r   z/sizes/{shop}zarticles::get-sizesgetSizeszTThe list of sizes of available articles for selected shop. Primarily used for filterc                 V   K   |                     t          |                      d {V S r   )	get_sizesr
   r)   s     r   r,   r,   E   s6       %%j&6&6777777777r   z/b2b/articles/csvzarticles:get-articles-csvgetArticlesInCsvz$The list of b2b shop articles as csv)r   r   r   r   r   c                 b   K   |                                   d {V }t          |ddid          S )NzContent-Dispositionz%attachment; filename=articles_b2b.csvztext/csv)headers
media_type)get_articles_csv_exportr   )r   buffers     r   get_articles_csvr3   T   sU       5577777777F!#K
    r   )#iofastapidjango.httpr   r   r   starlette.responsesr   src.data.model.schemasr   schemasrc.data.repositories.articler   
Repositorysrc.api.dependenciesr	   src.api.utilsr
   routergetArticleColorSizeHTTP_200_OKDependsGetArticleColorSizer   listArticlestrr%   r$   Colorr(   Sizer,   r3    r   r   <module>rJ      s   				  $ $ $ $ $ $ % % % % % % % % 1 1 1 1 1 1 4 4 4 4 4 4 I I I I I I / / / / / / $ $ $ $ $ $	+ZL	9	9	9 	"	,'7*"    "1
1K1K!L!L: :):: : : : : 		!>'"    ! !0
1K1K!L!L Tz Dj Tz	
  
&.    		d%"    "1
1K1K!L!L9 999 
&,9 9 9 9 		b$"    "1
1K1K!L!L8 888 
&+8 8 8 8 		$#2"    5DGONNS]D^D^4_4_  z      r   