add log for sign in, sign out, change password, remove upload file

This commit is contained in:
2026-01-09 19:38:54 +07:00
parent 427a1040cf
commit ae39cc111f
32 changed files with 1991 additions and 212 deletions

View File

@@ -3,7 +3,6 @@ import { Setting } from '@/generated/prisma/client';
import { authMiddleware } from '@/lib/middleware';
import { createServerFn } from '@tanstack/react-start';
import { settingSchema, userSettingSchema } from './setting.schema';
// import { settingSchema } from './setting.schema';
type AdminSettingReturn = {
[key: string]: Setting;
@@ -13,6 +12,7 @@ type AdminSettingReturn = {
export const getAdminSettings = createServerFn({ method: 'GET' })
.middleware([authMiddleware])
.handler(async () => {
console.log('first');
const settings = await prisma.setting.findMany({
where: {
relation: 'admin',
@@ -48,6 +48,17 @@ export const updateAdminSettings = createServerFn({ method: 'POST' })
await prisma.$transaction(updates);
// console.log(updates);
// await createAuditLog({
// action: 'update',
// tableName: 'setting',
// recordId: '',
// oldValue: '',
// newValue: JSON.stringify(data),
// userId: '',
// });
return { success: true };
});
@@ -93,6 +104,15 @@ export const updateUserSettings = createServerFn({ method: 'POST' })
},
});
// await createAuditLog({
// action: 'update',
// tableName: 'setting',
// recordId: '',
// oldValue: '',
// newValue: '',
// userId: '',
// });
return { success: true };
} catch (error) {
throw error;