app/api/routers/accounts.py:11:from app.core.security import log_audit app/api/routers/accounts.py:92: await log_audit(db, user.id, "gmail.test", "gmail_account", account.id, app/api/routers/accounts.py:139: await log_audit(db, user.id, "gmail.disconnect", "gmail_account", account.id, app/api/routers/accounts.py:170: await log_audit(db, user.id, "gmail.clear_all", "gmail_account", None, app/api/routers/accounts.py:201: await log_audit(db, user.id, "oauth_config.imported", "oauth_client_config", row.id, app/api/routers/attachments.py:16:from app.core.security import log_audit, sanitize_log_payload app/api/routers/attachments.py:145: await log_audit(db, user, "attachment.upload", resource="attachment", app/api/routers/attachments.py:194: await log_audit(db, user, "attachment.convert_pdf", resource="template", app/api/routers/attachments.py:260: await log_audit(db, user, "attachment.delete", resource="attachment", resource_id=att_id_val, app/api/routers/attachments.py:277: await log_audit(db, user, "attachment.clear_all", resource="attachment", details={"deleted": count}) ===HTML ATTACH in send_tasks=== 22:from app.models import (Attachment, Campaign, CampaignRecipient, EmailEvent, 173: att = db.get(Attachment, campaign.attachment_id) 175: att_html = engine.substitute(att.html_attachment_body or "", rec, g, 186: att = db.get(Attachment, campaign.attachment_id) 127- 128- 129:def generate_attachment_filename(kind: str, invoice_number: str) -> str: 130- """Unique, deterministic filenames like Invoice_INV-XXXX.pdf per campaign rules.""" 131- inv = re.sub(r"[^A-Za-z0-9-]", "", invoice_number or "") 132- if kind == "invoice": 133- return f"Invoice_{inv or 'INV' + secrets.token_hex(3)}.pdf" 134- if kind == "order": 135- return f"Order_{inv or 'ORD' + secrets.token_hex(3)}.pdf" 136- if kind == "receipt": 137- return f"Receipt_{inv or 'RF' + secrets.token_hex(3)}.pdf" 138- return f"Document_{inv or secrets.token_hex(4)}.pdf"