transfer from private server/git server
This commit is contained in:
17
web/models/audit_model.py
Normal file
17
web/models/audit_model.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""audit_model.py — Écriture dans la table de traçabilité audit_log (Bloc 1 - C10)."""
|
||||
|
||||
|
||||
def insert(db, action, statut, ressource=None, utilisateur_sub=None, ip_address=None):
|
||||
query = (
|
||||
"INSERT INTO audit_log (action, ressource, statut, utilisateur_sub, ip_address) "
|
||||
"VALUES (%s, %s, %s, %s, %s)"
|
||||
)
|
||||
return db.execute(query, (action, ressource, statut, utilisateur_sub, ip_address))
|
||||
|
||||
|
||||
def fetch_recent(db, limit=100):
|
||||
query = (
|
||||
"SELECT id, action, ressource, statut, utilisateur_sub, ip_address, created_at "
|
||||
"FROM audit_log ORDER BY created_at DESC LIMIT %s"
|
||||
)
|
||||
return db.fetch_all(query, (limit,))
|
||||
Reference in New Issue
Block a user