Merge pull request #170 from bipproduction/amalia/30-agustus-24
Amalia/30 agustus 24
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { createLogUser } from "@/module/user";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function DELETE() {
|
||||
const log = await createLogUser({ act: 'LOGOUT', desc: 'User keluar dari program', table: 'user', data: '' })
|
||||
|
||||
cookies().delete('sessionCookieSDM')
|
||||
|
||||
return Response.json({ success: true })
|
||||
|
||||
@@ -36,7 +36,8 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
idUser: true,
|
||||
User: {
|
||||
select: {
|
||||
name: true
|
||||
name: true,
|
||||
img: true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -47,7 +48,8 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
|
||||
const fixMember = member.map((v: any) => ({
|
||||
..._.omit(v, ["User"]),
|
||||
name: v.User.name
|
||||
name: v.User.name,
|
||||
img: v.User.img
|
||||
}))
|
||||
|
||||
const dataFix = {
|
||||
|
||||
@@ -150,7 +150,7 @@ export async function GET(request: Request) {
|
||||
for (let index = 0; index < dataStatus.length; index++) {
|
||||
const cek = data.some((i: any) => i.status == dataStatus[index].status)
|
||||
if (cek) {
|
||||
const find = (Number(data.find((i: any) => i.status == dataStatus[index].status)?._count) * 100)/ data.reduce((n, {_count}) => n + _count, 0)
|
||||
const find = ((Number(data.find((i: any) => i.status == dataStatus[index].status)?._count) * 100)/ data.reduce((n, {_count}) => n + _count, 0)).toFixed(2)
|
||||
input = {
|
||||
name: dataStatus[index].name,
|
||||
value: find
|
||||
|
||||
@@ -4,6 +4,7 @@ import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import { createLogUser } from "@/module/user";
|
||||
|
||||
|
||||
// GET PROFILE BY COOKIES
|
||||
@@ -139,6 +140,8 @@ export async function PUT(request: Request) {
|
||||
})
|
||||
}
|
||||
|
||||
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate data profile', table: 'user', data: user.id })
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil ubah profile" });
|
||||
} catch (error) {
|
||||
return NextResponse.json({ success: false, message: "Gagal ubah profile" }, { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user