
    Aj@              
           d dl Z d dlmZmZ d dlmZmZmZ d dlm	Z	 d dl
mZ d dlmZ  e       ZdZej!                  d      dd	ed
ededefd       Zy)    N)	APIRouterRequest)selectfuncdesc)render)AsyncSessionFactory)AdminAction    requestpageactionadmin_idc                   K   |dz
  t         z  }t               4 d {   }t        t              }|r"|j	                  t        j
                  |k(        }|r,	 |j	                  t        j                  t        |      k(        }|j                  t        t        j                               j                  |j                                      d {   }|j                         }|j                  |j                  t!        t        j"                              j%                  t               j'                  |             d {   }	t)        |	j+                         j-                               }
|j                  t        t        j
                        j/                         j                  t        j
                               d {   }|j-                         D cg c]  }|d   	 }}d d d       d {    t1        | d
||rt3        j4                  |t         z        nd||	      S 7 # t        $ r Y w xY w7 m7 7 ~c c}w 7 U# 1 d {  7  sw Y   exY ww)N   r   zaudit/index.html)actionstotalr   total_pagesaction_typescurrent_actioncurrent_admin)PER_PAGEr	   r   r
   whereaction_typeadmin_telegram_idint
ValueErrorexecuter   countselect_fromsubquery
scalar_oneorder_byr   
created_atlimitoffsetlistscalarsalldistinctr   mathceil)r   r   r   r   r'   sessionbasetotal_rr   	actions_rr   types_rrowr   s                 DC:\Users\koklo\Documents\pet_projects\kinoBot\admin\routers\audit.py	audit_logr5      s    Qh("F"$$k"::k55?@Dzz+"?"?3x="PQ  tzz|(<(H(H(YZZ""$!//MM${5567==hGNNvV
 
	 y((*..01  ;**+446??@W@WX
 
 +2++-8-3A-8- %$0 #u438DIIeh./a! 1 %   [

 9- %$$$s   IH)I6I
+H,AI
H<A0I
 H?BI
II
I%I
'I2I37I,	H95I
8H99I
?I
I
I
I
IIII)r   r   r   )r,   fastapir   r   
sqlalchemyr   r   r   admin.responsesr   bot.database.connectionr	   bot.database.modelsr
   routerr   getr   strr5        r4   <module>r@      s_     & ) ) " 7 +	 B!W !C !S !QT ! !r?   