upd: api mobile
Deskripsi: - update api mobile jam komentar pada diskusi umum dan diskusi divisi No Issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { countTime, prisma } from "@/module/_global";
|
||||
import { funGetUserById } from "@/module/auth";
|
||||
import { createLogUserMobile } from "@/module/user";
|
||||
import _ from "lodash";
|
||||
@@ -80,7 +80,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
|
||||
dataFix = data.map((v: any) => ({
|
||||
..._.omit(v, ["createdAt", "User",]),
|
||||
createdAt: moment(v.createdAt).format("lll").replace('pukul', ''),
|
||||
createdAt: countTime(v.createdAt),
|
||||
username: v.User.name,
|
||||
img: v.User.img
|
||||
}))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { countTime, prisma } from "@/module/_global";
|
||||
import { funGetUserById } from "@/module/auth";
|
||||
import { createLogUserMobile } from "@/module/user";
|
||||
import _ from "lodash";
|
||||
@@ -8,13 +8,13 @@ import { NextResponse } from "next/server";
|
||||
|
||||
// GET ONE DISCUSSION BY ID
|
||||
export async function GET(request: Request, context: { params: { id: string } }) {
|
||||
try {
|
||||
const { id } = context.params
|
||||
const { searchParams } = new URL(request.url);
|
||||
const user = searchParams.get("user");
|
||||
const cat = searchParams.get("cat");
|
||||
const userMobile = await funGetUserById({ id: String(user) })
|
||||
const { id } = context.params
|
||||
const { searchParams } = new URL(request.url);
|
||||
const user = searchParams.get("user");
|
||||
const cat = searchParams.get("cat");
|
||||
const userMobile = await funGetUserById({ id: String(user) })
|
||||
|
||||
try {
|
||||
if (userMobile.id == "null" || userMobile.id == undefined || userMobile.id == "") {
|
||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 200 });
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
..._.omit(v, ["User", "createdAt"]),
|
||||
username: v.User.name,
|
||||
img: v.User.img,
|
||||
createdAt: moment(v.createdAt).format("ll")
|
||||
createdAt: countTime(v.createdAt),
|
||||
}))
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan komentar", data: omitMember }, { status: 200 });
|
||||
|
||||
Reference in New Issue
Block a user