add log for sign in, sign out, change password, remove upload file
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user