upd: log user

Deskripsi:
- membuat fungsi create log uer

No Issues
This commit is contained in:
amel
2024-07-29 15:11:45 +08:00
parent 820124f1c5
commit bc3f356e81
2 changed files with 27 additions and 0 deletions

View File

@@ -1,7 +1,9 @@
import { apiUser } from "./api/api_user";
import createLogUser from "./log/fun/createLogUser";
import ViewEditProfile from "./profile/view/view_edit_profile";
import ViewProfile from "./profile/view/view_profile";
export { ViewProfile };
export { ViewEditProfile };
export { apiUser };
export { createLogUser };

View File

@@ -0,0 +1,25 @@
import { prisma } from "@/module/_global";
export default async function createLogUser({ act, desc, table, data }: { act: string, desc: string, table: string, data: string }) {
try {
// diambil dari cookies
const user = 'devAmalia'
await prisma.userLog.create({
data: {
idUser: user,
action: act,
desc: desc,
idContent: data,
tbContent: table
}
})
return { success: true, message: "Success" }
} catch (error) {
console.log(error)
return { success: false, message: "Internal Server Error" }
}
}