web_react/admin_dashboard/server/models/User.js
2024-04-02 20:30:24 -05:00

38 lines
No EOL
828 B
JavaScript

import mongoose from "mongoose"
const UserSchema = new mongoose.Schema(
{
name: {
type: String,
required: true,
min: 2,
max: 100,
},
email: {
type: String,
required: true,
max: 50,
unique: true,
},
password: {
type: String,
required: true,
min: 5,
},
city: String,
state: String,
country: String,
occupation: String,
phoneNumber: String,
transactions: Array,
role: {
type: String,
enum: ["user", "admin", "superadmin"],
default: "admin"
},
},
{timestamps: true}
);
const User = mongoose.model("User", UserSchema);
export default User;