Authentication and authorization
This commit is contained in:
committed by
Andrew Trieu
parent
8dd54efa6d
commit
ab526cca2a
45
server/models/User.js
Normal file
45
server/models/User.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const userSchema = mongoose.Schema(
|
||||
{
|
||||
firstName: {
|
||||
type: String,
|
||||
required: [true, "First name is required"],
|
||||
min: 3,
|
||||
max: 20,
|
||||
},
|
||||
lastName: {
|
||||
type: String,
|
||||
required: [true, "Last name is required"],
|
||||
min: 3,
|
||||
max: 20,
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
required: [true, "Email is required"],
|
||||
max: 50,
|
||||
unique: true,
|
||||
},
|
||||
password: {
|
||||
type: String,
|
||||
required: [true, "Password is required"],
|
||||
min: 6,
|
||||
},
|
||||
profilePicturePath: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
friends: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
location: String,
|
||||
description: String,
|
||||
admin: Boolean,
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const User = mongoose.model("User", userSchema);
|
||||
|
||||
export default User;
|
||||
Reference in New Issue
Block a user