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

@@ -0,0 +1,46 @@
import {
NotificationMobileBodyType,
NotificationMobileTitleType,
} from "../../../../types/type-mobile-notification";
import { sendNotificationMobileToManyUser } from "./send-notification";
import { routeUserMobile } from "../route-page-mobile";
import prisma from "@/lib/prisma";
export const sendNotificationInvestmentAddNews = async ({
invesmentId,
senderId,
title,
}: {
invesmentId: string;
senderId: string;
title: string;
}) => {
const findInvestor = await prisma.investasi_Invoice.findMany({
where: {
investasiId: invesmentId,
StatusInvoice: {
name: "Berhasil",
},
},
select: {
authorId: true,
},
});
console.log("[FIND INVESTOR]", findInvestor);
// SEND NOTIFICATION
await sendNotificationMobileToManyUser({
recipientIds: findInvestor.map((e) => e.authorId!),
senderId: senderId,
payload: {
title: "Berita terbaru" as NotificationMobileTitleType,
body: `Ada berita yang terupdate pada ${title}` as NotificationMobileBodyType,
type: "announcement",
kategoriApp: "INVESTASI",
deepLink: routeUserMobile.investmentDetailPublish({
id: invesmentId,
}),
},
});
};

View File

@@ -59,6 +59,6 @@ const routeUserMobile = {
// INVESTMENT
investmentPortofolioByStatus: ({ status }: { status?: StatusApp }) =>
`/investment/(tabs)/portofolio?status=${status}`,
investasiDetailPublish: ({ id }: { id: string }) => `/investment/${id}`,
investasiTransaction: `/investment/(tabs)/transaction`
investmentDetailPublish: ({ id }: { id: string }) => `/investment/${id}`,
investmentTransaction: `/investment/(tabs)/transaction`
};