import mongoose, { Schema } from 'mongoose';

const userSchema = new Schema({
    first_name: { type: String, required: true },
    last_name: { type: String, required: true },
    email: { type: String, unique: true, required: true },
    username: { type: String, unique: true, required: true },
    password: { type: String, required: true },
    created_at: { type: Number, default: Date.now, required: true }
});

export default mongoose.model('User', userSchema);

import mongoose, { Schema } from 'mongoose';

const userSchema = new Schema({
    first_name: { type: String, required: true },
    last_name: { type: String, required: true },
    email: { type: String, unique: true, required: true },
    username: { type: String, unique: true, required: true },
    password: { type: String, required: true },
    status: { type: String, enum: ['user', 'admin'], required: true },
    created_at: { type: Number, default: Date.now, required: true }
});

export default mongoose.model('User', userSchema);

Add status field to the users model
Add status field to the users model
