Add user model

This commit is contained in:
Francesco Esposito 2019-08-22 17:30:50 +02:00
parent 61467f2f8a
commit 06a9e3dec5
1 changed files with 29 additions and 0 deletions

29
src/db/user.model.js Normal file
View File

@ -0,0 +1,29 @@
import mongoose from 'mongoose';
const user = {
id: {
type: Number,
required: true,
trim: true,
},
city: {
id: {
type: Number,
required: false,
trim: true,
},
name: {
type: String,
required: false,
trim: true,
},
},
};
const userSchema = mongoose.Schema(user, {
collection: 'umbrello_users',
});
const User = mongoose.model('user', userSchema);
export default User;