Notification investasi mobile done

### No Issue
This commit is contained in:
2026-01-22 17:53:35 +08:00
parent 20d05c1cc7
commit fc23e01275
7 changed files with 120 additions and 35 deletions

View File

@@ -5,6 +5,7 @@ import {
NotificationMobileBodyType,
NotificationMobileTitleType,
} from "../../../../../../../types/type-mobile-notification";
import { routeAdminMobile, routeUserMobile } from "@/lib/mobile/route-page-mobile";
export { POST, GET, DELETE };
@@ -33,11 +34,14 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
investasi: {
select: {
title: true,
authorId: true,
},
},
},
});
console.log("[CREATED DOCS]", createdDocs);
const findInvestor = await prisma.investasi_Invoice.findMany({
where: {
investasiId: id,
@@ -45,23 +49,27 @@ async function POST(request: Request, { params }: { params: { id: string } }) {
name: "Berhasil",
},
},
select: {
authorId: true,
},
});
console.log("[FIND INVESTOR]", findInvestor);
// SEND NOTIFICATION
// await sendNotificationMobileToManyUser({
// recipientIds: findInvestor.map((user) => user.id),
// senderId: data.authorId,
// payload: {
// title: "Cek Dokumen" as NotificationMobileTitleType,
// body: `Ada informasi dokumen yang di\\\ ${createdDocs.investasi?.title}` as NotificationMobileBodyType,
// type: "announcement",
// kategoriApp: "INVESTASI",
// deepLink: routeAdminMobile.investmentDetailPublish({
// id: update.investasiId as string,
// status: "publish",
// }),
// },
// });
await sendNotificationMobileToManyUser({
recipientIds: findInvestor.map((e) => e.authorId!),
senderId: createdDocs.investasi?.authorId as string,
payload: {
title: "Cek Dokumen" as NotificationMobileTitleType,
body: `Ada dokumen terupdate pada ${createdDocs.investasi?.title}` as NotificationMobileBodyType,
type: "announcement",
kategoriApp: "INVESTASI",
deepLink: routeUserMobile.investmentDetailPublish({
id: createdDocs.investasiId as string,
}),
},
});
if (!createdDocs)
return NextResponse.json({