bookingSchema.js 550 B

123456789101112131415161718192021
  1. import mongoose from "mongoose";
  2. const bookingInputSchema = new mongoose.Schema({
  3. name: { type: String, required: true },
  4. value: { type: mongoose.Schema.Types.Mixed, required: true }, // Can be string, number, etc.
  5. }, {_id: false});
  6. const bookingSchema = new mongoose.Schema({
  7. appointment: {
  8. type: String,
  9. required: true
  10. },
  11. time: {
  12. type: Date,
  13. required: true
  14. },
  15. inputs: [bookingInputSchema]
  16. });
  17. const Booking = mongoose.model('Booking', bookingSchema, 'booking');
  18. export default Booking;