File size: 1,072 Bytes
0f8617c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const mongoose = require('mongoose');

const bookingSchema = new mongoose.Schema({
    photographerId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
    customerId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
    date: { type: Date, required: true },
    startTime: String,
    duration: Number,
    status: { type: String, enum: ['pending', 'confirmed', 'in_progress', 'photos_ready', 'delivered', 'completed', 'cancelled'], default: 'pending' },
    totalPrice: Number,
    sessionNotes: String,
    packageId: { type: mongoose.Schema.Types.ObjectId, ref: 'Package', default: null },
    finalPhotos: [{ type: String }],
    isDelivered: { type: Boolean, default: false },
    timeline: [
        {
            step: { type: String, enum: ['booked', 'confirmed', 'in_progress', 'photos_ready', 'delivered'] },
            date: { type: Date, default: Date.now },
            note: String
        }
    ],
    createdAt: { type: Date, default: Date.now }
});

module.exports = mongoose.model('Booking', bookingSchema);