
     Jiq                     $    d dl mZ  G d d      Zy)    )TonyCallc                   R    e Zd ZdZed        Zed        Zed        Zedd       Zy)TonyCallRepositoryzT
    Encapsulate DB access for TonyCall to keep view/service thin and testable.
    c                  \    t         j                  j                  d      j                         S )Ncompany)r   objectsselect_relatedall     K/var/www/html/dp2/backend_v2.1/server/apps/calls/repositories/tony_calls.pybase_querysetz TonyCallRepository.base_queryset	   s"    ..y9==??r   c                  |    t         j                  j                  d      j                  d      j	                  d      S )Nr   call_id)r   r   r	   order_bydistinctr   r   r   distinct_by_call_id_querysetz/TonyCallRepository.distinct_by_call_id_queryset   s.      	*)$)$	&r   c                 |    t         j                  j                  d      j                  |       j	                         S )Nr   pk)r   r   r	   filterfirstr   s    r   	get_by_idzTonyCallRepository.get_by_id   s0    ..y9@@B@GMMOOr   Nc                 v    t         j                         }| |j                  |       }|r |j                  | }|S )N)r   r   r   r   )
filters_qsr   qss      r   filtered_querysetz$TonyCallRepository.filtered_queryset   s<    --/!:&Bh'B	r   )NN)	__name__
__module____qualname____doc__staticmethodr   r   r   r   r   r   r   r   r      s[     @ @ & & P P  r   r   N)apps.calls.modelsr   r   r   r   r   <module>r$      s    & r   