Spaces:
Sleeping
Sleeping
| const mongoose = require('mongoose'); | |
| const photoDeliverySchema = new mongoose.Schema( | |
| { | |
| bookingId: { | |
| type: mongoose.Schema.Types.ObjectId, | |
| ref: 'Booking', | |
| required: true, | |
| unique: true, | |
| }, | |
| photographerId: { | |
| type: mongoose.Schema.Types.ObjectId, | |
| ref: 'Photographer', | |
| required: true, | |
| }, | |
| customerId: { | |
| type: mongoose.Schema.Types.ObjectId, | |
| ref: 'User', | |
| required: true, | |
| }, | |
| photos: [ | |
| { | |
| url: String, | |
| uploadedAt: { | |
| type: Date, | |
| default: Date.now, | |
| }, | |
| watermarked: { | |
| type: Boolean, | |
| default: true, | |
| }, | |
| }, | |
| ], | |
| status: { | |
| type: String, | |
| enum: ['pending', 'partially_delivered', 'delivered', 'revision_requested'], | |
| default: 'pending', | |
| }, | |
| deliveredAt: { | |
| type: Date, | |
| default: null, | |
| }, | |
| downloadLink: { | |
| type: String, | |
| default: null, | |
| }, | |
| linkExpiresAt: { | |
| type: Date, | |
| default: null, | |
| }, | |
| revisionNotes: { | |
| type: String, | |
| default: '', | |
| }, | |
| revisionsRequested: { | |
| type: Number, | |
| default: 0, | |
| }, | |
| }, | |
| { timestamps: true } | |
| ); | |
| module.exports = mongoose.model('PhotoDelivery', photoDeliverySchema); | |