secure-mern
Version:
A lightweight yet powerful npm package to enhance security in MERN stack applications. Built with enterprise-grade architecture in mind, secure-mern helps you integrate essential security features with minimal configuration.
17 lines (14 loc) • 668 B
JavaScript
const mongoose = require("mongoose");
const userSchema = new mongoose.Schema({
fullName: { type: String, trim: true },
username: { type: String, required: true, unique: true, lowercase: true },
email: { type: String, required: true, unique: true, lowercase: true },
password: { type: String, required: true },
phone: String,
avatar: String,
role: { type: mongoose.Schema.Types.ObjectId, ref: "Role", required: true },
isActive: { type: Boolean, default: true },
isEmailVerified: { type: Boolean, default: false },
lastLogin: Date,
}, { timestamps: true });
module.exports = mongoose.model("User", userSchema);