mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 16:22:42 +00:00
Merge pull request #2737 from naturalcrit/dependabot/npm_and_yarn/mongoose-7.0.2
Bump mongoose from 6.9.2 to 7.0.2
This commit is contained in:
@@ -255,9 +255,10 @@ const MetadataEditor = createClass({
|
|||||||
default={this.props.metadata.lang || ''}
|
default={this.props.metadata.lang || ''}
|
||||||
placeholder='en'
|
placeholder='en'
|
||||||
onSelect={(value)=>this.handleLanguage(value)}
|
onSelect={(value)=>this.handleLanguage(value)}
|
||||||
onEntry={(e)=> { e.target.setCustomValidity(''); //Clear the validation popup while typing
|
onEntry={(e)=>{
|
||||||
debouncedHandleFieldChange('lang', e);
|
e.target.setCustomValidity(''); //Clear the validation popup while typing
|
||||||
}}
|
debouncedHandleFieldChange('lang', e);
|
||||||
|
}}
|
||||||
options={listLanguages()}
|
options={listLanguages()}
|
||||||
autoSuggest={{
|
autoSuggest={{
|
||||||
suggestMethod : 'startsWith',
|
suggestMethod : 'startsWith',
|
||||||
|
|||||||
45420
package-lock.json
generated
45420
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -94,7 +94,7 @@
|
|||||||
"marked-extended-tables": "^1.0.5",
|
"marked-extended-tables": "^1.0.5",
|
||||||
"markedLegacy": "npm:marked@^0.3.19",
|
"markedLegacy": "npm:marked@^0.3.19",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"mongoose": "^6.9.2",
|
"mongoose": "^7.0.2",
|
||||||
"nanoid": "3.3.4",
|
"nanoid": "3.3.4",
|
||||||
"nconf": "^0.12.0",
|
"nconf": "^0.12.0",
|
||||||
"npm": "^9.6.2",
|
"npm": "^9.6.2",
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ const disconnect = async ()=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const connect = async (config)=>{
|
const connect = async (config)=>{
|
||||||
return await Mongoose.connect(getMongoDBURL(config),
|
return await Mongoose.connect(getMongoDBURL(config), { retryWrites: false })
|
||||||
{ retryWrites: false }, handleConnectionError);
|
.catch((error)=>handleConnectionError(error));
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -40,30 +40,24 @@ HomebrewSchema.statics.increaseView = async function(query) {
|
|||||||
return brew;
|
return brew;
|
||||||
};
|
};
|
||||||
|
|
||||||
HomebrewSchema.statics.get = function(query, fields=null){
|
HomebrewSchema.statics.get = async function(query, fields=null){
|
||||||
return new Promise((resolve, reject)=>{
|
const brew = await Homebrew.findOne(query, fields).orFail()
|
||||||
Homebrew.find(query, fields, null, (err, brews)=>{
|
.catch((error)=>{throw 'Can not find brew';});
|
||||||
if(err || !brews.length) return reject('Can not find brew');
|
if(!_.isNil(brew.textBin)) { // Uncompress zipped text field
|
||||||
if(!_.isNil(brews[0].textBin)) { // Uncompress zipped text field
|
unzipped = zlib.inflateRawSync(brew.textBin);
|
||||||
unzipped = zlib.inflateRawSync(brews[0].textBin);
|
brew.text = unzipped.toString();
|
||||||
brews[0].text = unzipped.toString();
|
}
|
||||||
}
|
return brew;
|
||||||
return resolve(brews[0]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HomebrewSchema.statics.getByUser = function(username, allowAccess=false, fields=null){
|
HomebrewSchema.statics.getByUser = async function(username, allowAccess=false, fields=null){
|
||||||
return new Promise((resolve, reject)=>{
|
const query = { authors: username, published: true };
|
||||||
const query = { authors: username, published: true };
|
if(allowAccess){
|
||||||
if(allowAccess){
|
delete query.published;
|
||||||
delete query.published;
|
}
|
||||||
}
|
const brews = await Homebrew.find(query, fields).lean().exec() //lean() converts results to JSObjects
|
||||||
Homebrew.find(query, fields).lean().exec((err, brews)=>{ //lean() converts results to JSObjects
|
.catch((error)=>{throw 'Can not find brews';});
|
||||||
if(err) return reject('Can not find brew');
|
return brews;
|
||||||
return resolve(brews);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
|
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
|
||||||
|
|||||||
Reference in New Issue
Block a user