Mongoose Validation
This commit is contained in:
@@ -2,10 +2,22 @@ const mongoose = require("mongoose");
|
||||
|
||||
const restaurantSchema = mongoose.Schema({
|
||||
_id: mongoose.Types.ObjectId,
|
||||
name: String,
|
||||
city: String,
|
||||
imgUrl: String,
|
||||
workingHours: String,
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
city: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
imgUrl: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
workingHours: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
hidden: Boolean,
|
||||
dishes: [mongoose.Types.ObjectId],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user