mirror of
https://github.com/Alvin-Zilverstand/Challenge_15_Magazijn_App_Maken.git
synced 2026-03-06 11:06:34 +01:00
45 lines
880 B
JavaScript
45 lines
880 B
JavaScript
const mongoose = require('mongoose');
|
|
|
|
const itemSchema = new mongoose.Schema({
|
|
name: {
|
|
en: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
nl: {
|
|
type: String,
|
|
required: true
|
|
}
|
|
},
|
|
description: {
|
|
en: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
nl: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
location: {
|
|
type: String,
|
|
enum: ['Heerlen', 'Maastricht', 'Sittard'],
|
|
required: true
|
|
},
|
|
quantity: {
|
|
type: Number,
|
|
required: true,
|
|
min: 0
|
|
},
|
|
imageUrl: {
|
|
type: String,
|
|
default: '/images/default-item.png'
|
|
},
|
|
reserved: {
|
|
type: Number,
|
|
default: 0,
|
|
min: 0
|
|
}
|
|
}, { timestamps: true });
|
|
|
|
module.exports = mongoose.model('Item', itemSchema); |