new fitur: baca semua notifikasi

Deskripsi:
- drawer bottom menu notifikasi
- api update semua notifikasi
- update api version app

No Issues
This commit is contained in:
amel
2025-04-16 11:40:04 +08:00
parent dfb3070f1f
commit 342a335878
8 changed files with 115 additions and 7 deletions

View File

@@ -92,4 +92,34 @@ export async function PUT(request: Request, context: { params: { id: string } })
console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan notifikasi, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
}
}
// UPDATE READ ALL NOTIFICATION
export async function POST(request: Request) {
try {
const user = await funGetUserByCookies()
if (user.id == undefined) {
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
}
const upd = await prisma.notifications.updateMany({
where: {
idUserTo: user.id,
isRead: false
},
data: {
isRead: true
}
})
// create log user
const log = await createLogUser({ act: 'UPDATE', desc: 'User menandai semua notifikasi', table: 'notifications', data: '' })
return NextResponse.json({ success: true, message: "Berhasil mengupdate notifikasi", }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengupdate notifikasi, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
}
}

View File

@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
export async function GET(request: Request) {
try {
return NextResponse.json({ success: true, version: "1.3.2", tahap: "beta", update: "- update baru : menampilkan notifikasi pengumuman setelah login (fixed tampilan); - fix random nomer kode otp 4 digit" }, { status: 200 });
return NextResponse.json({ success: true, version: "1.3.3", tahap: "beta", update: "- update baru : menampilkan notifikasi pengumuman setelah login (fixed tampilan); - rich text di pengumuman (tambah dan edit); - fitur tandai dibaca semua notifikasi" }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });