Initial commit

This commit is contained in:
payacom
2026-07-07 17:50:26 +03:30
parent 525565d685
commit 64eb8c288f
25 changed files with 801 additions and 231 deletions

View File

@@ -15,6 +15,13 @@ const CourseComment = require("../../../models/CourseComentModel");
const IsPaymentCourse = require("../../../models/IsPaymentCourseModel");
const Tax = require("../../../models/TaxModel");
const AcademyCategoryModel = require('../../../models/AcademyCategoryModel');
const {
createLikeNotification,
resolveCourseOwnerId
} = require('../../../utils/likeNotification');
const {
createCommentNotification
} = require('../../../utils/commentNotification');
const onServerRestart = async () => {
const CoursePayment = await CoursePaymentModel.findOne({
@@ -1178,6 +1185,14 @@ const likeCourseContent = async (req, res, next) => {
createdAt: new Date(),
});
const courseOwnerId = await resolveCourseOwnerId(course);
await createLikeNotification({
ownerId: courseOwnerId,
likerId: userId,
entityId: course._id,
type: 'academy_like'
});
res.status(200).json({
success: true,
message: "دوره با موفقیت لایک شد",
@@ -1394,6 +1409,14 @@ const createComment = async (req, res) => {
newComment._id
).populate("user_id", "name username");
const courseOwnerId = await resolveCourseOwnerId(course);
await createCommentNotification({
ownerId: courseOwnerId,
commenterId: userId,
entityId: course._id,
type: 'academy_comment'
});
res.status(201).json({
success: true,
message: "کامنت با موفقیت ثبت شد",