Advertisement
Guest User

restaurant_model

a guest
Feb 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const mongoose = require('mongoose');
  2. const Schema = mongoose.Schema;
  3.  
  4. const restaurantSchema = new Schema({
  5.     name: {
  6.         type: String,
  7.         required: true
  8.     },
  9.     type: {
  10.         type: [String],
  11.         required: true
  12.     },
  13.     hour: {
  14.         type: {
  15.             start: {
  16.                 type: String,
  17.                 required: true
  18.             },
  19.             end: {
  20.                 type: String,
  21.                 required: true
  22.             }
  23.         },
  24.         required: true
  25.     },
  26.     menu: {
  27.         type: [
  28.             {
  29.                 name: {
  30.                     type: String,
  31.                     required: true
  32.                 },
  33.                 unit_price: {
  34.                     type: Number,
  35.                     required: true
  36.                 }
  37.             }
  38.         ],
  39.         required: true
  40.     },
  41.     images: [String],
  42.     features: {
  43.         wifi: Boolean,
  44.         delivery: Boolean,
  45.         ac: Boolean,
  46.         smoking_zone: Boolean,
  47.         reservation: Boolean,
  48.         parking: Boolean
  49.     },
  50.     social: {
  51.         facebook: String,
  52.         instagram: String,
  53.         twitter: String,
  54.         contact: String
  55.     },
  56.     offers: {
  57.         type: [
  58.             {
  59.                 title: {
  60.                     type: String,
  61.                     required: true
  62.                 },
  63.                 image: String,
  64.             }
  65.         ]
  66.     },
  67.     location: {
  68.         road_no: Number,
  69.         house_no: Number,
  70.         area: {
  71.             type: String,
  72.             required: true
  73.         },
  74.         district: {
  75.             type: String,
  76.             required: true
  77.         }
  78.     }
  79. });
  80.  
  81. module.exports = mongoose.Model('Restaurant', restaurantSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement