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

View File

@@ -31,50 +31,50 @@ const restaurantSchema = mongoose.Schema({
type: {
type: String,
maxlength: 64,
required: true
required: true,
},
placesId: {
type: String,
maxlength: 128
maxlength: 128,
},
imgUrl: {
type: String,
maxlength: 128,
required: true
required: true,
},
workingHours: {
pn: {
type: String,
maxlength: 24
maxlength: 24,
},
wt: {
type: String,
maxlength: 24
maxlength: 24,
},
sr: {
type: String,
maxlength: 24
maxlength: 24,
},
cz: {
type: String,
maxlength: 24
maxlength: 24,
},
pt: {
type: String,
maxlength: 24
maxlength: 24,
},
sb: {
type: String,
maxlength: 24
maxlength: 24,
},
nd: {
type: String,
maxlength: 24
maxlength: 24,
},
},
description: {
type: String,
maxlength: 400
maxlength: 400,
},
tags: {
cardPayments: Boolean,
@@ -88,49 +88,25 @@ const restaurantSchema = mongoose.Schema({
links: {
facebook: {
type: String,
maxlength: 128
maxlength: 128,
},
instagram: {
type: String,
maxlength: 128
maxlength: 128,
},
www: {
type: String,
maxlength: 128
maxlength: 128,
},
},
phone: {
type: String,
maxlength: 24
maxlength: 24,
},
hidden: Boolean,
indexed: Date,
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],
ratings: [
{
rate: Number,
owner: mongoose.Types.ObjectId,
id: mongoose.Types.ObjectId
}
]
});
module.exports = mongoose.model("Restaurant", restaurantSchema);

View File

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