Fix Apple Reject

Add:
- prisma/migrations/20251208042529_add_accepted_terms_at/
- prisma/schema.prisma.backup
- src/app/api/mobile/user/[id]/terms-of-app/

Fix:

prisma/schema.prisma
src/app/api/auth/mobile-register/route.ts
src/app/api/mobile/forum/[id]/report-commentar/route.ts
src/app/api/mobile/forum/[id]/report-posting/route.ts

### No Issue
This commit is contained in:
2025-12-08 15:29:12 +08:00
parent cc78d82ca4
commit 6ee0b98f07
7 changed files with 1175 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "acceptedForumTermsAt" TIMESTAMP(3),
ADD COLUMN "acceptedTermsAt" TIMESTAMP(3);

View File

@@ -55,6 +55,9 @@ model User {
blockedUsers BlockedUser[] @relation("Blocking")
blockedBy BlockedUser[] @relation("BlockedBy")
acceptedTermsAt DateTime?
acceptedForumTermsAt DateTime?
}
model MasterUserRole {

1098
prisma/schema.prisma.backup Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,7 @@ export async function POST(req: Request) {
nomor: data.nomor,
active: false,
termsOfServiceAccepted: data.termsOfServiceAccepted,
acceptedTermsAt: new Date(),
},
});

View File

@@ -25,7 +25,7 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
const msg = `Report Komentar: "${content?.komentar}" dengan kategori \n\n\n${reportList?.title} : \n\n${reportList?.deskripsi}`;
const res = await fetch(
`https://wa.wibudev.com/code?nom=6282340374412&text=${msg}`,
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=6282340374412&text=${msg}`,
{ cache: "no-cache" }
);

View File

@@ -19,7 +19,7 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
const msg = `Report Postingan: "${content?.diskusi}"`;
const res = await fetch(
`https://wa.wibudev.com/code?nom=6282340374412&text=${msg}`,
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=6282340374412&text=${msg}`,
{ cache: "no-cache" }
);

View File

@@ -0,0 +1,68 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib";
export { POST };
async function POST(request: Request, { params }: { params: { id: string } }) {
const { id } = params;
const { searchParams } = new URL(request.url);
const category = searchParams.get("category");
console.log("[ID USER", id);
console.log("[SEARCH PARAMS", category);
try {
const user = await prisma.user.findUnique({
where: {
id: id,
},
});
if (!user) {
return NextResponse.json(
{
success: false,
message: "User not found",
},
{ status: 404 }
);
}
const updateUser = await prisma.user.update({
where: {
id: id,
},
data: {
acceptedForumTermsAt: new Date(),
},
});
if (!updateUser) {
return NextResponse.json(
{
success: false,
message: "Gagal mengupdate data",
},
{ status: 400 }
);
}
return NextResponse.json(
{
success: true,
message: "Syarat dan Ketentuan berhasil diterima",
},
{ status: 200 }
);
} catch (error) {
return NextResponse.json(
{
success: false,
message: "Error update data from API ",
reason: (error as Error).message,
},
{ status: 500 }
);
}
}