| import { db } from '@/lib/db'; | |
| export async function logActivity(userId: string, type: string, title: string, description: string, metadata?: Record<string, unknown>) { | |
| try { | |
| await db.activityLog.create({ | |
| data: { | |
| userId, | |
| type, | |
| title, | |
| description, | |
| metadata: metadata ? JSON.stringify(metadata) : null, | |
| }, | |
| }); | |
| } catch (error) { | |
| console.error('Failed to log activity:', error); | |
| } | |
| } |