
    s0i                     0    d dl mZ d dlmZ  G d d      Zy)    )Q)TonyCallc                   B    e Zd Z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                  |       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   order_by)
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      sG     @ @ P P  r   r   N)django.db.modelsr   apps.calls.modelsr   r   r   r   r   <module>r"      s     & r   