
    =jm                     <    d dl mZ d dlmZ d dlmZ  G d d      Zy)    )ObjectId)
db_manager)OtpModelc                   <    e Zd Zd Zd ZdefdZdefdZdefdZ	y	)
OtpRepositoryc                     d| _         y )Notp)collection_nameselfs    9/var/www/html/photoedit/app/modules/otp/otp_repository.py__init__zOtpRepository.__init__   s
    $    c                 <    t         j                  | j                     S N)r   dbr
   r   s    r   get_collectionzOtpRepository.get_collection
   s    }}T1122r   r	   c                    K   | j                         }|j                         }|j                  |       d {   }t        |j                        S 7 wr   )r   
model_dump
insert_onestrinserted_id)r   r	   
collectionotp_dictresults        r   add_otpzOtpRepository.add_otp   sI     ((*
>>#!,,X666%%&& 7s   5AAAphonec                 j   K   | j                         }|j                  |dd       d {   }|S 7 w)NT)r   	is_active)r   find_one)r   r   r   r	   s       r   get_active_otp_by_phonez%OtpRepository.get_active_otp_by_phone   s@     ((*
'')
  
 
s   (313otp_idc                    K   | j                         }|j                  dt        |      idddii       d {   }|j                  dkD  S 7 w)N_idz$setr   Fr   )r   
update_oner   modified_count)r   r"   r   r   s       r   
expire_otpzOtpRepository.expire_otp    s`     ((*
!,,HV$%
 
 $$q((
s   5AAAN)
__name__
__module____qualname__r   r   r   r   r   r!   r'    r   r   r   r      s0    %3' '3 )s )r   r   N)bsonr   app.config.DBr   app.modules.otp.otp_modelr   r   r+   r   r   <module>r/      s     $ .') ')r   