0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00
This commit is contained in:
Trevor Buckner
2023-03-21 16:10:48 -04:00
parent 1ec08bb1fa
commit eaad46b6bc
3 changed files with 7 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ const disconnect = async ()=>{
const connect = async (config)=>{
return await Mongoose.connect(getMongoDBURL(config), { retryWrites: false })
.catch(error=>handleConnectionError(error));
.catch((error)=>handleConnectionError(error));
};
module.exports = {

View File

@@ -42,7 +42,7 @@ HomebrewSchema.statics.increaseView = async function(query) {
HomebrewSchema.statics.get = async function(query, fields=null){
const brew = await Homebrew.findOne(query, fields).orFail()
.catch(error=>{throw 'Can not find brew'});
.catch((error)=>{throw 'Can not find brew';});
if(!_.isNil(brew.textBin)) { // Uncompress zipped text field
unzipped = zlib.inflateRawSync(brew.textBin);
brew.text = unzipped.toString();
@@ -56,7 +56,7 @@ HomebrewSchema.statics.getByUser = async function(username, allowAccess=false, f
delete query.published;
}
const brews = await Homebrew.find(query, fields).lean().exec() //lean() converts results to JSObjects
.catch(error=>{throw 'Can not find brews'});
.catch((error)=>{throw 'Can not find brews';});
return brews;
};