Users.js 719 Bytes
const mongoose = require('mongoose');
const userSchema = mongoose.Schema({
    name : {
        type : String,
        maxlength : 50
    },
    email :{
        type : String,
        trim : true, // trim은 이메일 주소 받을때 공백을 없애준다.
        unique : 1 // 중복 허용 안함
    },
    password :{
        type : String,
        minlength : 50
    },
    lastname:{
        type : String,
        maxlength : 50
    },
    role:{
        type : Number, // 1 : admin, 0 : common user
        default : 0
    },
    image: String,
    token: {
        type : String
    },
    tokenExp :{
        type: Number,
    }

})

const User = mongoose.model('User', userSchema)



model.exports = {}