-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatalog-item-schema.js
62 lines (51 loc) · 1.14 KB
/
catalog-item-schema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Schema for the catalog items */
/* Mongoose is used for database functions */
const mongoose = require('mongoose');
const catalogItemSchema = new mongoose.Schema({
/* Item name */
name: {
type: String,
required: true
},
/* Item quantity */
quantity: {
type: Number,
required: true
},
/* Item description (optional) */
description: {
type: String,
required: false
},
/* Item price */
price: {
type: Number,
required: true
},
/* ObjectIDs of customer comments regarding the item */
commentIds: {
type: [String],
required: false
},
/* Images of the item (optional) */
pictures: {
type: [String],
required: false
},
/* Customer ratings of the item */
ratings: {
type: [Number],
required: false
},
/* Number of units sold of the item */
numberSold: {
type: Number,
required: true
},
/* Visibility of the item */
visible: {
type: String,
required: true
}
});
module.exports = mongoose.model('CatalogItem', catalogItemSchema);