upd: log user
Deskripsi: - membuat fungsi create log uer No Issues
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
import { apiUser } from "./api/api_user";
|
import { apiUser } from "./api/api_user";
|
||||||
|
import createLogUser from "./log/fun/createLogUser";
|
||||||
import ViewEditProfile from "./profile/view/view_edit_profile";
|
import ViewEditProfile from "./profile/view/view_edit_profile";
|
||||||
import ViewProfile from "./profile/view/view_profile";
|
import ViewProfile from "./profile/view/view_profile";
|
||||||
|
|
||||||
export { ViewProfile };
|
export { ViewProfile };
|
||||||
export { ViewEditProfile };
|
export { ViewEditProfile };
|
||||||
export { apiUser };
|
export { apiUser };
|
||||||
|
export { createLogUser };
|
||||||
|
|||||||
25
src/module/user/log/fun/createLogUser.tsx
Normal file
25
src/module/user/log/fun/createLogUser.tsx
Normal 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" }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user