Created the user model / schema

This commit is contained in:
Mathias Wagner 2022-06-26 17:03:55 +02:00
parent 76a5944bac
commit 5f5247c88c
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

34
models/User.js Normal file
View 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);