Product.js 896 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
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
import mongoose from 'mongoose'

const { String, Number, Array } = mongoose.Schema.Types

const ProductSchema = new mongoose.Schema({
    pro_name: {
        type: String,
        required: true,
    },
    price: {
        type: String,
        required: true,
    },
    stock: {
        type: String,
        required: true
    },
    purchase: {
        type: String,
        required: true,
        default: 0
    },
    main_category: {
        type: String,
        required: true,
    },
    sub_category: {
        type: String,
        required: true,
    },
    description: {
        type: String,
        required: true,
    },
    main_image: {
        type: String,
        required: true,
    },
    detail_image: {
        type: String,
        required: true,
    }
}, {
    timestamps: true
})

export default mongoose.models.Product || mongoose.model('Product', ProductSchema)