Initial commit
This commit is contained in:
@@ -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: "کامنت با موفقیت ثبت شد",
|
||||
|
||||
Reference in New Issue
Block a user