mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-11 11:12:44 +00:00
Change model to use defaults rather than mergeWith
This commit is contained in:
@@ -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