mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-04 22:38:43 +00:00
Small logic fix to brew.save pre
This commit is contained in:
@@ -32,8 +32,8 @@ const HomebrewSchema = mongoose.Schema({
|
||||
lock : { type: Object, index: true }
|
||||
}, { versionKey: false });
|
||||
|
||||
HomebrewSchema.pre('save', ()=>{
|
||||
if(!this.googleId) {
|
||||
HomebrewSchema.pre('save', function() {
|
||||
if(this.text !== undefined) {
|
||||
this.textBin = zlib.deflateRawSync(this.text);
|
||||
this.text = undefined;
|
||||
}
|
||||
@@ -44,9 +44,9 @@ HomebrewSchema.statics.increaseView = async function(query) {
|
||||
brew.lastViewed = new Date();
|
||||
brew.views = brew.views + 1;
|
||||
await brew.save()
|
||||
.catch((err)=>{
|
||||
return err;
|
||||
});
|
||||
.catch((err)=>{
|
||||
return err;
|
||||
});
|
||||
return brew;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user