Compare commits

..

16 Commits

Author SHA1 Message Date
de1d668ff2 Merge pull request 'staging' (#34) from staging into main
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/34
2025-12-17 15:30:56 +08:00
f1c8432fdc Merge pull request 'Fix DB table donasi' (#33) from login-api/17-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/33
2025-12-17 14:44:53 +08:00
602d759919 Merge pull request 'Update Versi 1.5.27' (#32) from staging into main
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/32
2025-12-17 12:22:27 +08:00
1cd4c3713e Merge pull request 'login-api/17-dec-25' (#31) from login-api/17-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/31
2025-12-17 11:43:32 +08:00
4307b383e3 Merge pull request 'Penerapan notifikasi mobil ke database' (#30) from mobile-notification/16-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/30
2025-12-16 17:57:21 +08:00
0786d23336 Merge pull request 'API notif dan penambahan package firebase-admin' (#29) from mobile-notification/15-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/29
2025-12-15 17:52:03 +08:00
cb3511f973 Merge pull request 'Fix QC ( Ayu )' (#28) from qc-mobile/10-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/28
2025-12-10 17:38:42 +08:00
b4921c4e82 Merge pull request 'Fix API untuk QC: Ayu' (#27) from qc-mobile/9-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/27
2025-12-09 17:40:20 +08:00
a9325054eb Merge pull request 'Fix Apple Reject' (#26) from qc-mobile/8-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/26
2025-12-08 15:33:58 +08:00
819812149f Merge pull request 'Fix QC Admin ( Inno )' (#25) from qc-mobile/5-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/25
2025-12-05 17:15:53 +08:00
75ba2b29ae Merge pull request 'Fix QC Inno:' (#24) from mobile-reject/4-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/24
2025-12-04 17:45:04 +08:00
54a4d15bdd Merge pull request 'Fix WA Server' (#23) from mobile-reject/3-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/23
2025-12-03 16:28:09 +08:00
1321f33da9 Merge pull request 'Fix Apple Rejected' (#22) from mobile-reject/3-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/22
2025-12-03 15:02:40 +08:00
fad0c33b9a Merge pull request 'Alur autentikasi dirubah' (#21) from mobile-reject/2-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/21
2025-12-02 14:41:44 +08:00
565bab4998 Merge pull request 'QC Mobile: Pak jun dan Inno' (#20) from qc/1-dec-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/20
2025-12-01 17:44:48 +08:00
7530a38c4d Merge pull request 'Fix version' (#19) from apple-reject/28-nov-25 into staging
Reviewed-on: http://wibugit.wibudev.com/wibu/hipmi/pulls/19
2025-11-28 11:47:44 +08:00
5 changed files with 19 additions and 98 deletions

View File

@@ -2,8 +2,6 @@
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
## [1.5.29](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.28...v1.5.29) (2025-12-17)
## [1.5.28](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.27...v1.5.28) (2025-12-17) ## [1.5.28](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.27...v1.5.28) (2025-12-17)
## [1.5.27](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.26...v1.5.27) (2025-12-17) ## [1.5.27](https://wibugit.wibudev.com/wibu/hipmi/compare/v1.5.26...v1.5.27) (2025-12-17)

View File

@@ -1,6 +1,6 @@
{ {
"name": "hipmi", "name": "hipmi",
"version": "1.5.29", "version": "1.5.28",
"private": true, "private": true,
"prisma": { "prisma": {
"seed": "bun prisma/seed.ts" "seed": "bun prisma/seed.ts"

View File

@@ -1,44 +0,0 @@
import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib";
export { DELETE };
async function DELETE(
request: NextRequest,
{ params }: { params: { id: string } }
) {
const { id } = params;
try {
const findFirst = await prisma.tokenUserDevice.findFirst({
where: {
userId: id,
},
});
if (!findFirst) {
return NextResponse.json({
success: false,
message: "User tidak ditemukan !",
});
}
const deleted = await prisma.tokenUserDevice.delete({
where: {
id: findFirst.id,
},
});
console.log("DEL", deleted);
return NextResponse.json({
success: true,
message: "Berhasil menghapus device token user",
});
} catch (error) {
console.log("ERROR", error);
return NextResponse.json(
{ error: (error as Error).message, message: "Terjadi error pada API" },
{ status: 500 }
);
}
}

View File

@@ -1,14 +1,13 @@
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib"; import { prisma } from "@/lib";
export { POST, GET }; export async function POST(request: NextRequest) {
async function POST(request: NextRequest) {
const { data } = await request.json(); const { data } = await request.json();
try { try {
console.log("Data >>", JSON.stringify(data, null, 2)); console.log("Data >>", JSON.stringify(data, null, 2));
const { userId, platform, deviceId, model, appVersion, fcmToken } = data; const { userId, platform, deviceId, model, appVersion, fcmToken } =
data;
if (!fcmToken) { if (!fcmToken) {
return NextResponse.json({ error: "Missing Token" }, { status: 400 }); return NextResponse.json({ error: "Missing Token" }, { status: 400 });
@@ -63,22 +62,3 @@ async function POST(request: NextRequest) {
); );
} }
} }
async function GET(request: NextRequest) {
try {
const data = await prisma.tokenUserDevice.findMany({
where: {
isActive: true,
},
});
return NextResponse.json({ success: true, data });
} catch (error) {
return NextResponse.json(
{ error: (error as Error).message },
{ status: 500 }
);
}
}

View File

@@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) { export async function POST(request: NextRequest) {
try { try {
const { data } = await request.json(); const { data } = await request.json();
const { fcmToken, title, body: notificationBody, userLoginId } = data; const { fcmToken, title, body: notificationBody } = data;
console.log("Data Notifikasi >>", data); console.log("Data Notifikasi >>", data);
@@ -16,37 +16,24 @@ export async function POST(request: NextRequest) {
); );
} }
const deviceToken = await prisma.tokenUserDevice.findMany({ const message = {
where: { token: fcmToken,
isActive: true, notification: {
NOT: { title,
userId: userLoginId, body: notificationBody || "",
},
}, },
}); data: {
sentAt: new Date().toISOString(), // ✅ Simpan metadata di data
// contoh: senderId, type, etc.
},
};
for (let i of deviceToken) { console.log("[MSG]", message);
const message = {
token: i.token,
notification: {
title,
body: notificationBody || "",
},
data: {
sentAt: new Date().toISOString(), // ✅ Simpan metadata di data
// contoh: senderId, type, etc.
},
};
console.log("[MSG]", message);
const response = await adminMessaging.send(message); const response = await adminMessaging.send(message);
console.log("✅ FCM sent:", response); console.log("✅ FCM sent:", response);
}
return NextResponse.json({ return NextResponse.json({ success: true, messageId: response });
success: true,
message: "Notification sent successfully",
});
} catch (error: any) { } catch (error: any) {
console.error("❌ FCM error:", error); console.error("❌ FCM error:", error);
return NextResponse.json( return NextResponse.json(