mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-22 05:47:02 +00:00
Change model to use defaults rather than mergeWith
This commit is contained in:
1 parent
ccd5cacb0c
commit
24adbdc429
1 file changed
+1
-1
@@ -39,7 +39,7 @@ NotificationSchema.statics.addNotification = async function(data){
|
|||||||
startAt : new Date,
|
startAt : new Date,
|
||||||
stopAt : new Date
|
stopAt : new Date
|
||||||
};
|
};
|
||||||
_.mergeWith(data, defaults, (item)=>{ if(!item) return undefined; });
|
_.defaults(data, defaults);
|
||||||
const newNotification = new Notification(data);
|
const newNotification = new Notification(data);
|
||||||
const savedNotification = await newNotification.save()
|
const savedNotification = await newNotification.save()
|
||||||
.catch((err)=>{
|
.catch((err)=>{
|
||||||
|
|||||||
Reference in new issue
Block a user