changes in data models

This commit is contained in:
2022-07-21 18:16:33 +02:00
parent b58acdc0c9
commit 0db1d5117e
3 changed files with 23 additions and 74 deletions

View File

@@ -22,8 +22,8 @@ const dishSchema = mongoose.Schema({
price: { price: {
type: String, type: String,
maxlength: 20, maxlength: 20,
required: true required: true,
} },
}, },
price2: { price2: {
priceName: { priceName: {
@@ -33,7 +33,7 @@ const dishSchema = mongoose.Schema({
price: { price: {
type: String, type: String,
maxlength: 20, maxlength: 20,
} },
}, },
price3: { price3: {
priceName: { priceName: {
@@ -43,8 +43,8 @@ const dishSchema = mongoose.Schema({
price: { price: {
type: String, type: String,
maxlength: 20, maxlength: 20,
} },
} },
}, },
notes: { notes: {
type: String, type: String,
@@ -70,14 +70,6 @@ const dishSchema = mongoose.Schema({
kCal: String, kCal: String,
vegan: Boolean, vegan: Boolean,
vegetarian: Boolean, vegetarian: Boolean,
photos: [mongoose.Types.ObjectId],
ratings: [
{
id: mongoose.Types.ObjectId,
rate: Number,
owner: mongoose.Types.ObjectId
}
]
}); });
module.exports = mongoose.model("Dish", dishSchema); module.exports = mongoose.model("Dish", dishSchema);

View File

@@ -31,50 +31,50 @@ const restaurantSchema = mongoose.Schema({
type: { type: {
type: String, type: String,
maxlength: 64, maxlength: 64,
required: true required: true,
}, },
placesId: { placesId: {
type: String, type: String,
maxlength: 128 maxlength: 128,
}, },
imgUrl: { imgUrl: {
type: String, type: String,
maxlength: 128, maxlength: 128,
required: true required: true,
}, },
workingHours: { workingHours: {
pn: { pn: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
wt: { wt: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
sr: { sr: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
cz: { cz: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
pt: { pt: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
sb: { sb: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
nd: { nd: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
}, },
description: { description: {
type: String, type: String,
maxlength: 400 maxlength: 400,
}, },
tags: { tags: {
cardPayments: Boolean, cardPayments: Boolean,
@@ -88,49 +88,25 @@ const restaurantSchema = mongoose.Schema({
links: { links: {
facebook: { facebook: {
type: String, type: String,
maxlength: 128 maxlength: 128,
}, },
instagram: { instagram: {
type: String, type: String,
maxlength: 128 maxlength: 128,
}, },
www: { www: {
type: String, type: String,
maxlength: 128 maxlength: 128,
}, },
}, },
phone: { phone: {
type: String, type: String,
maxlength: 24 maxlength: 24,
}, },
hidden: Boolean, hidden: Boolean,
indexed: Date, indexed: Date,
categories: [String], categories: [String],
lunchHours: {
type: String,
maxlength: 24
},
lunchMenu: [
{
lunchSetName: {
type: String,
maxlength: 30
},
lunchSetPrice: Number,
lunchSetDishes: [{
dishId: mongoose.Types.ObjectId,
quantity: Number
}],
},
],
dishes: [mongoose.Types.ObjectId], dishes: [mongoose.Types.ObjectId],
ratings: [
{
rate: Number,
owner: mongoose.Types.ObjectId,
id: mongoose.Types.ObjectId
}
]
}); });
module.exports = mongoose.model("Restaurant", restaurantSchema); module.exports = mongoose.model("Restaurant", restaurantSchema);

View File

@@ -6,21 +6,9 @@ const userSchema = mongoose.Schema({
type: String, type: String,
required: true, required: true,
}, },
password: { username: {
type: String, type: String,
required: true, maxlength: 64,
},
firstname: {
type: String,
maxlength: 24,
},
lastname: {
type: String,
maxlength: 24,
},
login: {
type: String,
maxlength: 64
}, },
billing: { billing: {
NIP: { NIP: {
@@ -38,17 +26,10 @@ const userSchema = mongoose.Schema({
}, },
isRestaurant: { isRestaurant: {
type: Boolean, type: Boolean,
required: true required: true,
}, },
restaurants: [mongoose.Types.ObjectId], restaurants: [mongoose.Types.ObjectId],
trialUsed: Boolean, trialUsed: Boolean,
preferences: {
excludeAllergens: [String],
vegetarian: Boolean,
vegan: Boolean,
},
favoriteRestaurants: [mongoose.Types.ObjectId],
photos: [mongoose.Types.ObjectId]
}); });
module.exports = mongoose.model("User", userSchema); module.exports = mongoose.model("User", userSchema);