File size: 449 Bytes
eaab0a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
  }
}