
    f6i                     0    d dl mZ d dlmZ  G d d      Zy)    )Session)Notificationc            
       8    e Zd ZdZedededededz  fd       Z	y)IdempotencyServicez'Handle idempotent notification requestsdb	tenant_ididempotency_keyreturnNc                     |sy| j                  t              j                  t        j                  |k(  t        j                  |k(        j                         }|S )aE  
        Check if notification with this idempotency key already exists
        
        Args:
            db: database session
            tenant_id: tenant ID for isolation
            idempotency_key: unique key for this request
        
        Returns:
            Existing Notification if found, None otherwise
        N)queryr   filterr   r	   first)r   r   r	   existings       2/var/www/notifications/app/services/idempotency.pycheck_idempotencyz$IdempotencyService.check_idempotency   sS      HH\"V&&)3,,? UW 	     )
__name__
__module____qualname____doc__staticmethodr   intstrr   r    r   r   r   r      s:    1g #  P\_cPc  r   r   N)sqlalchemy.ormr   app.db.modelsr   r   r   r   r   <module>r      s    " & r   