From 5f5247c88ce597c3fede5ecaed0fef22773fb6d2 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Sun, 26 Jun 2022 17:03:55 +0200 Subject: [PATCH] Created the user model / schema --- models/User.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 models/User.js diff --git a/models/User.js b/models/User.js new file mode 100644 index 0000000..4bee366 --- /dev/null +++ b/models/User.js @@ -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); \ No newline at end of file