You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
620 B
JavaScript
32 lines
620 B
JavaScript
2 months ago
|
const mongoose = require('mongoose')
|
||
|
const Schema = mongoose.Schema
|
||
|
|
||
|
const ItemSchema = new Schema({
|
||
|
name: {
|
||
|
type: String,
|
||
|
required: [true, 'Item name is required.']
|
||
|
},
|
||
|
description: {
|
||
|
type: String,
|
||
|
required: [true, 'Description is required.']
|
||
|
},
|
||
|
unitPrice: {
|
||
|
type: Number,
|
||
|
required: [true, 'Unit price is required.']
|
||
|
},
|
||
|
imageLocation: {
|
||
|
type: String
|
||
|
},
|
||
|
categoryName: {
|
||
|
type: String,
|
||
|
required: [true, 'Category name is required.']
|
||
|
},
|
||
|
isArchived: {
|
||
|
type: Boolean,
|
||
|
required: [true, 'Archive status is required.']
|
||
|
}
|
||
|
})
|
||
|
|
||
|
const Item = mongoose.model('item', ItemSchema)
|
||
|
|
||
|
module.exports = Item
|