Created the user model / schema
This commit is contained in:
parent
76a5944bac
commit
5f5247c88c
34
models/User.js
Normal file
34
models/User.js
Normal file
@ -0,0 +1,34 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const UserSchema = new mongoose.Schema({
|
||||
username: { // The name of the user
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
minLength: 5,
|
||||
maxLength: 15
|
||||
},
|
||||
email: { // The email of the user
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
password: { // The password of the user
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
rank: { // The rank of the user
|
||||
type: String,
|
||||
default: "user"
|
||||
},
|
||||
info: { // Some information about the user
|
||||
type: String,
|
||||
default: "No information provided"
|
||||
},
|
||||
socials: Object, // The socials of the user (ex. twitter, github, ..)
|
||||
joined: { // The date when the user has joined the platform
|
||||
type: Date,
|
||||
default: Date.now
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('users', UserSchema);
|
Loading…
x
Reference in New Issue
Block a user