Merge branch 'master' of https://codefirst.iut.uca.fr/git/noan.randon/Favor
continuous-integration/drone/push Build encountered an error
Details
continuous-integration/drone/push Build encountered an error
Details
commit
b6d8bf1b2c
@ -1,12 +1,10 @@
|
|||||||
const UserModel = require("../models/user.model");
|
const UserModel = require("../models/user.model");
|
||||||
|
const PostModel = require("../models/post.model");
|
||||||
|
|
||||||
module.exports.addNotification = (userId, notification) => {
|
module.exports.addNotification = async (userId, notification) => {
|
||||||
UserModel.findById(userId, (err, user) => {
|
await UserModel.findByIdAndUpdate(
|
||||||
if (err) {
|
userId,
|
||||||
console.log(err);
|
{ $addToSet: { notif: notification } },
|
||||||
} else {
|
{ new: true, upsert: true }
|
||||||
user.notif.push(notification);
|
);
|
||||||
user.save();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
Loading…
Reference in new issue