const mongoose = require('mongoose') const BankSchema = mongoose.Schema({ holderName:String, cardNumber:{ type:Number, }, shabaNumber:{ type:Number, } }) const UserSchema = mongoose.Schema({ // for admins _creator: { type: mongoose.ObjectId, ref: 'User' }, private: { type: Boolean, default: false }, username: String, permissions: Array, personalCode:String, // for user national_code: String, province_id: String, city_id: String, province_name: String, city_name: String, address: String, postal_code: String, tel_number: String, mobile_number: String, email: String, store_name: String, // verity info verity_businessID: String, verity_businessCode: String, old_verity_businessID: String, old_verity_businessCode: String, // panatech info panatech_businessID: String, panatech_businessCode: String, old_panatech_businessID: String, old_panatech_businessCode: String, isAgent: { type: Boolean, default: false }, representation_id: { type: mongoose.ObjectId, ref: 'Representation' }, representation_code: String, askedForRepresentation: { type: Boolean, default: false }, // for both first_name: String, last_name: String, password: String, // for GPS profilePic:{ type:String, default:"noPic" }, shopName:String, shopNumber:String, shopAddress:String, birthDate:String, walletBalance:{ type:Number, min:0, default:0 }, cardBank:[BankSchema], /// //////////////////////////////// user confirmations confirmed: { type: Boolean, default: false }, email_confirmed: { type: Boolean, default: false }, mobile_confirmed: { type: Boolean, default: false }, emailConfirmationKey: String, mobileConfirmationKey: String, seenByAdmin: { type: Boolean, default: false }, /// ///////////// scope: { type: Array, default: ['user'] }, token: String, appToken: String, resetPassToken: String }) module.exports = mongoose.model('User', UserSchema)