
    h                         d dl mZ ddlmZmZ ddlmZ  G d dej                        Z G d dej                        Z G d	 d
ej                        Z	y)    )serializers   )ProductScrapeTaskProductImage)Userc                        e Zd Z G d d      Zy)ProductImageSerializerc                       e Zd ZeZg dZy)ProductImageSerializer.Meta)id	image_urltaskN)__name__
__module____qualname__r   modelfields     */var/www/Befach/backend/bot/serializers.pyMetar      s    
r   r   Nr   r   r   r   r   r   r   r	   r	      s    
 
r   r	   c                   p    e Zd Z ej                  dd      Z ej                         Z G d d      Zd Z	y)ProductScrapeTaskSerializerz
user.emailT)source	read_onlyc                        e Zd ZeZg dZg dZy) ProductScrapeTaskSerializer.Meta)	r   
user_emailsearch_paramsresult_file_urlstatusimages_statusmessage
started_atcompleted_at)r   r   r"   r%   r&   N)r   r   r   r   r   r   read_only_fieldsr   r   r   r   r      s    !

 Xr   r   c                     | j                   j                  d      }|j                  rSt        |j                  d      r=|r%|j	                  |j                  j
                        S |j                  j
                  S y )Nrequesturl)contextgetresult_filehasattrbuild_absolute_urir*   )selfobjr)   s      r   get_result_file_urlz/ProductScrapeTaskSerializer.get_result_file_url"   s\    ,,""9-??ws>FM7--coo.A.ABfSVSbSbSfSffr   N)
r   r   r   r   
EmailFieldr   SerializerMethodFieldr!   r   r2   r   r   r   r   r      s7    '''|tLJ7k779OX Xr   r   c                        e Zd Z G d d      Zy)UserSerializerc                       e Zd ZeZdZy)UserSerializer.Meta__all__N)r   r   r   r   r   r   r   r   r   r   r8   )   s    r   r   Nr   r   r   r   r6   r6   (   s     r   r6   N)
rest_frameworkr   modelsr   r   r   ModelSerializerr	   r   r6   r   r   r   <module>r=      sD    & 3 
[88 
+"="= 2[00 r   