This commit is contained in:
payacom
2026-08-31 20:45:41 +03:30
parent fa9f23c61d
commit 3f416a7a60
367 changed files with 621895 additions and 6443 deletions

View File

@@ -0,0 +1,29 @@
const NotificationModel = require("../models/NotificationModel");
const PURCHASE_TITLE = "پکیج شما خریداری شد";
const PURCHASE_DESCRIPTION = "یک کاربر پکیج آموزشی شما را خریداری کرد";
const createCoursePurchaseNotification = async ({
ownerId,
buyerId,
courseId,
}) => {
try {
if (!ownerId || !buyerId || !courseId) return;
if (String(ownerId) === String(buyerId)) return;
await NotificationModel.create({
user_id: ownerId,
project_post_id: courseId,
type: "academy_purchase",
title: PURCHASE_TITLE,
description: PURCHASE_DESCRIPTION,
});
} catch (error) {
console.error("Error creating course purchase notification:", error);
}
};
module.exports = {
createCoursePurchaseNotification,
};