mirror of
https://github.com/Alvin-Zilverstand/Challenge_15_Magazijn_App_Maken.git
synced 2026-03-06 13:22:35 +01:00
init
This commit is contained in:
31
models/Reservation.js
Normal file
31
models/Reservation.js
Normal file
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user