rohanshaw's picture
Upload 20 files
efb87a5 verified
raw
history blame contribute delete
584 Bytes
// src/models/User.js
const mongoose = require('mongoose');
const userSchema = new mongoose.Schema({
name: { type: String, required: true },
phone: { type: String, required: true, unique: true },
password: { type: String, required: true }, // Will be hashed
address: { type: String, default: 'Nalhati' }, // Default to local
role: {
type: String,
enum: ['customer', 'admin'],
default: 'customer'
},
isVerified: { type: Boolean, default: false }, // True after first OTP
}, {
timestamps: true
});
module.exports = mongoose.model('User', userSchema);