const mongoose = require('mongoose') const mongoosePaginate = require('mongoose-paginate-v2') const timestamp = require('mongoose-timestamp') const adminSchema = new mongoose.Schema({ mobile: { type: String, required: false, trim: true, unique: true }, otp: { type: String, required: false, trim: true, minLength: 6, maxLength: 6 }, user_name: { type: String, required: false, trim: true, minLength: 1, maxLength: 255, default: null }, password: { type: String, required: false, trim: true, minLength: 1, maxLength: 255, default: null }, first_name: { type: String, required: false, trim: true, minLength: 1, maxLength: 255, default: null }, last_name: { type: String, required: false, trim: true, minLength: 1, maxLength: 255, default: null }, user_type: { type: String, required: false, trim: true, minLength: 1, maxLength: 255, default: null }, profile_image: { type: String, required: false, trim: true }, gender: { type: String, required: false, trim: true, minLength: 1, maxLength: 255, default: null }, last_online: { type: Date, // ذخیره تاریخ و زمان آخرین بازدید default: Date.now // تنظیم تاریخ به تاریخ فعلی } }) adminSchema.plugin(timestamp) adminSchema.plugin(mongoosePaginate) const AdminModel = mongoose.model('Admin', adminSchema) module.exports = AdminModel