const NotificationModel = require('../models/NotificationModel') const { resolveCourseOwnerId } = require('./likeNotification') const COMMENT_TITLE = 'یک کامنت برای شما ثبت شد' const COMMENT_DESCRIPTION = 'یک کامنت برای شما ثبت شد' const RATING_TITLE = 'یک امتیاز برای شما ثبت شد' const RATING_DESCRIPTION = 'یک امتیاز برای شما ثبت شد' const createCommentNotification = async ({ ownerId, commenterId, entityId, type = 'post_comment' }) => { try { if (!ownerId || !commenterId || !entityId) return if (String(ownerId) === String(commenterId)) return await NotificationModel.create({ user_id: ownerId, project_post_id: entityId, type, title: COMMENT_TITLE, description: COMMENT_DESCRIPTION }) } catch (error) { console.error('Error creating comment notification:', error) } } const createRatingNotification = async ({ ownerId, raterId, entityId, type = 'billboard_rating' }) => { try { if (!ownerId || !raterId || !entityId) return if (String(ownerId) === String(raterId)) return await NotificationModel.create({ user_id: ownerId, project_post_id: entityId, type, title: RATING_TITLE, description: RATING_DESCRIPTION }) } catch (error) { console.error('Error creating rating notification:', error) } } module.exports = { createCommentNotification, createRatingNotification, resolveCourseOwnerId }