Sindbad~EG File Manager
a
�d� � @ sr d dl mZmZmZmZmZmZmZmZ d dl m
Z
mZ d dlm
Z
d dlZee
jd ddd�ZG d d
� d
�ZdS )� )�
create_engine�MetaData�Table�insert�select�update�delete�text)�and_�or_)�appN�DATABASE_URITi )�
pool_pre_ping�pool_recyclec @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�NotificationModelc
C sR z t � | _td| jdtd�| _W n, tyL } zt|� W Y d }~n
d }~0 0 d S )N�app_notificationT)�autoload�
autoload_with)r �metar �enginer � Exception�print)�self�e� r �]/home/numerote/conference.numerotech.com/food_kit_scan_badges/core/model/NotificationModel.py�__init__
s
zNotificationModel.__init__c C sH t d�}t�� }|�|�}|r,dd� |D �nd }|�� |r@|S d S d S )NzOselect * from app_notification where is_visible > 0 order by created_at desc ;c S s g | ]}t |��qS r )�dict)�.0�rr r r �
<listcomp> � z;NotificationModel.get_notification_data.<locals>.<listcomp>)r r �connect�execute�close)r �stmt�conn�result�resultsr r r �get_notification_data s
z'NotificationModel.get_notification_datac C s( t �� }|�| j�� |�}|�� |jS )N)r r"