
    7Kh                     2    d dl mZ d dlmZ  G d de      Zy)    )BaseRepo)GlobalStorec                   4     e Zd Z fdZdedefdZd Z xZS )GlobalStoreRepoc                 $    t         |   |       y )N)super__init__)selfdb	__class__s     D/var/www/html/DP/alpha_backend/app/repositories/global_store_repo.pyr	   zGlobalStoreRepo.__init__   s        key_namevaluec                     | j                  t        d|      }|s| j                  t        ||d      S ||_        | j                  j                          | j                  j                  |       |S )z8
        Create or update a global store record
        r   )r   r   )data)get_by_fieldr   creater   r   commitrefresh)r
   r   r   global_stores       r   create_or_updatez GlobalStoreRepo.create_or_update	   s`     ((j(K;;{hQV1W;XX!&LGGNNGGOOL)r   c                     | j                  t        dd      }| j                  d|r%t        t	        |j
                        dz               S d      S )Nr   transfer_failure_count   1)r   r   r   strintr   )r
   r   s     r   update_transfer_failurez'GlobalStoreRepo.update_transfer_failure   sM    ((jBZ[$$%=cos3|GYGYCZ]^C^?_yyuxyyr   )__name__
__module____qualname__r	   r   r   r   __classcell__)r   s   @r   r   r      s!       S  zr   r   N)app.repositories.base_repor   app.common.modelsr   r    r   r   <module>r'      s    / )zh zr   