import mongoose from "mongoose"; /** * Define a schema for an appointment using mongoose. * * @description This schema represents an appointment between a user and a service provider. * @typedef {Object} AppointmentSchema * @property {String} user - The ID of the user making the appointment (e.g. "user123"). * @property {String} title - A brief title for the appointment (e.g. " haircut"). * @property {String} description - A longer description of the appointment. * @property {Date} dueDate - The date and time when the appointment is scheduled. * @property {String} place - The location where the appointment will take place. * @property {Date} startDate - The start date and time of the appointment. * @property {Date} endDate - The end date and time of the appointment. */ /** * Create a mongoose model for appointments using the defined schema. * * @description This model allows you to interact with the appointments collection in your MongoDB database. * @typedef {Object} Appointment * @static */ const appointmentSchema = new mongoose.Schema({ user: { type: String, required: true }, title: { type: String, required: true }, description: { type: String, required: true }, dueDate: { type: Date, required: true }, place: { type: String, required: true }, startDate: { type: Date, required: true }, endDate: { type: Date, required: true } }); /** * Create a mongoose model for appointments and name it "Appointment". * * @description This model allows you to interact with the appointments collection in your MongoDB database. */ const Appointment = mongoose.model('Appointment', appointmentSchema, 'appointment'); export default Appointment;