mirror of
https://github.com/Alvin-Zilverstand/Challenge_15_Magazijn_App_Maken.git
synced 2026-03-06 02:56:41 +01:00
31 lines
723 B
JavaScript
31 lines
723 B
JavaScript
const mongoose = require('mongoose');
|
|
|
|
const reservationSchema = new mongoose.Schema({
|
|
itemId: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'Item',
|
|
required: true
|
|
},
|
|
quantity: {
|
|
type: Number,
|
|
required: true,
|
|
min: 1,
|
|
default: 1
|
|
},
|
|
userId: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
required: true
|
|
},
|
|
status: {
|
|
type: String,
|
|
enum: ['PENDING', 'APPROVED', 'REJECTED', 'RETURNED', 'ARCHIVED'],
|
|
default: 'PENDING'
|
|
},
|
|
reservedDate: {
|
|
type: Date,
|
|
default: Date.now
|
|
}
|
|
}, { timestamps: true });
|
|
|
|
module.exports = mongoose.model('Reservation', reservationSchema); |