Sign In Prompt

This commit is contained in:
2024-09-15 04:43:05 -04:00
parent 2164f330ac
commit 062a9adf04
16 changed files with 149 additions and 145 deletions

View File

@@ -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;