19 lines
383 B
Python
Raw Normal View History

2025-11-09 23:29:07 +01:00
from typing import Optional
from .models import Activity, User
2025-11-13 23:22:05 +01:00
2025-11-09 23:29:07 +01:00
async def log_activity(
user: Optional[User],
action: str,
target_type: str,
target_id: int,
2025-11-13 23:22:05 +01:00
ip_address: Optional[str] = None,
2025-11-09 23:29:07 +01:00
):
await Activity.create(
user=user,
action=action,
target_type=target_type,
target_id=target_id,
2025-11-13 23:22:05 +01:00
ip_address=ip_address,
2025-11-09 23:29:07 +01:00
)