Sign In Prompt
This commit is contained in:
@@ -19,7 +19,8 @@ const recipesSchema = new mongoose.Schema({
|
||||
rating: Number,
|
||||
cuisine: String,
|
||||
expense: Number,
|
||||
mealType: Object
|
||||
mealType: Object,
|
||||
ratingCount: Number
|
||||
}, { timestamps: true });
|
||||
|
||||
export default class Recipes {
|
||||
@@ -43,7 +44,9 @@ export default class Recipes {
|
||||
cuisine: recipe.cuisine,
|
||||
expense: recipe.expense,
|
||||
mealType: recipe.mealType,
|
||||
instructions: recipe.instructions
|
||||
instructions: recipe.instructions,
|
||||
ratingCount: 0,
|
||||
rating: 0
|
||||
}, this.upsert);
|
||||
return await this.get(Id);
|
||||
}
|
||||
@@ -63,6 +66,13 @@ export default class Recipes {
|
||||
return await this.get(Id);
|
||||
}
|
||||
|
||||
async increment(Id, field, amount) {
|
||||
let result = await this.get(Id);
|
||||
if(!result) return null;
|
||||
|
||||
return await this.get(Id);
|
||||
}
|
||||
|
||||
async delete(Id) {
|
||||
let result = await this.get(Id);
|
||||
if(!result) return false;
|
||||
|
||||
Reference in New Issue
Block a user