23 lines
595 B
JavaScript
23 lines
595 B
JavaScript
const { Notifications } = require("../models/Notifications");
|
|
|
|
exports.createNotification = async function({data, userId, notificationCodeId}) {
|
|
if(userId !== data.user){
|
|
return await Notifications.create({
|
|
data: data,
|
|
userId: userId,
|
|
notificationCodeId: notificationCodeId
|
|
});
|
|
}
|
|
};
|
|
|
|
exports.readedNotification = async function({notificationId}){
|
|
return await Notifications.update(
|
|
{read: true},
|
|
{
|
|
where:{
|
|
id: notificationId,
|
|
read: false
|
|
}
|
|
}
|
|
);
|
|
}; |