Something went wrong. Try again.
A comprehensive digital solution dedicated to bridging the gap between those offering services and those seeking them, providing a centrali… gigwork.co.in
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031
import { count, eq, sql } from "drizzle-orm";import { db } from '../config/database/turso';import { activityLog } from '../config/database/schema';
// Log activityexport const logActivity = async (req, res, next) => { return new Promise(async (resolve, reject) => { try {
// SQL Query : INSERT INTO activity_log (user_id, activity) VALUES (user_id, activity) RETURNING *
let result = await db .insert(activityLog) .values({ user_id: req.user.id, activity: req.method + " " + req.originalUrl }) .returning();
result = result[0];
resolve(result);
} catch (error) { reject(error); } });}