AI and Food
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import mongoose from "mongoose";
|
||||
import Users from "./collections/users.js";
|
||||
import Recipes from "./collections/recipes.js";
|
||||
|
||||
export default class Mongo {
|
||||
constructor(uri) {
|
||||
this.connect(uri);
|
||||
this.users = new Users();
|
||||
this.recipes = new Recipes();
|
||||
}
|
||||
|
||||
async connect(uri) {
|
||||
|
||||
@@ -10,18 +10,16 @@ const reqString = {
|
||||
|
||||
const recipesSchema = new mongoose.Schema({
|
||||
id: reqString,
|
||||
description: String,
|
||||
userID: String,
|
||||
ingredients: Array,
|
||||
productName: String,
|
||||
instructions: Array,
|
||||
name: String,
|
||||
nutritionFacts: Object,
|
||||
rating: Number,
|
||||
cuisine: String,
|
||||
expense: Number,
|
||||
mealType: Object
|
||||
|
||||
|
||||
|
||||
|
||||
}, { timestamps: true });
|
||||
|
||||
export default class Recipes {
|
||||
@@ -39,18 +37,15 @@ export default class Recipes {
|
||||
id: Id,
|
||||
userID: recipe.userID,
|
||||
ingredients: recipe.ingredients,
|
||||
productName: recipe.productName,
|
||||
description: recipe.description,
|
||||
name: recipe.name,
|
||||
nutritionFacts: recipe.nutritionFacts,
|
||||
rating: recipe.rating,
|
||||
cuisine: recipe.cuisine,
|
||||
expense: recipe.expense,
|
||||
mealType: recipe.mealType
|
||||
|
||||
|
||||
|
||||
|
||||
mealType: recipe.mealType,
|
||||
instructions: recipe.instructions
|
||||
}, this.upsert);
|
||||
return await this.get(user.id);
|
||||
return await this.get(Id);
|
||||
}
|
||||
|
||||
async get(Id) {
|
||||
|
||||
Reference in New Issue
Block a user