125 lines
2.0 KiB
JavaScript
125 lines
2.0 KiB
JavaScript
import mongoose from "mongoose";
|
|
|
|
const UserSchema = new mongoose.Schema(
|
|
{
|
|
fName: {
|
|
type: String,
|
|
// required: true,
|
|
min: 2,
|
|
max: 50,
|
|
},
|
|
lName: {
|
|
type: String,
|
|
// required: true,
|
|
min: 2,
|
|
max: 50,
|
|
},
|
|
email: {
|
|
type: String,
|
|
required: true,
|
|
max: 50,
|
|
unique: true,
|
|
},
|
|
username: {
|
|
type: String,
|
|
// required: true,
|
|
max: 30,
|
|
unique: true,
|
|
},
|
|
password: {
|
|
type: String,
|
|
required: true,
|
|
min: 5,
|
|
},
|
|
phone: {
|
|
type: String,
|
|
// required: true,
|
|
default: "",
|
|
},
|
|
photo: {
|
|
type: String,
|
|
},
|
|
address1: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
address2: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
city: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
province: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
country: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
zip: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
type: {
|
|
type: String,
|
|
default: "client",
|
|
},
|
|
status: {
|
|
type: String,
|
|
default: "new",
|
|
required: true,
|
|
},
|
|
phoneStatus: {
|
|
type: String,
|
|
default: "new",
|
|
// required: true,
|
|
},
|
|
kycStatus: {
|
|
type: String,
|
|
default: "new",
|
|
// required: true,
|
|
},
|
|
kycRef: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: "Kyc",
|
|
},
|
|
friends: [
|
|
{
|
|
number: {
|
|
type: String,
|
|
required: false,
|
|
},
|
|
favorite: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
},
|
|
nickname: {
|
|
type: String,
|
|
required: false,
|
|
},
|
|
},
|
|
],
|
|
otp: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
otpExpiration: {
|
|
type: Date,
|
|
default: null,
|
|
},
|
|
|
|
// transactions: {
|
|
// type: Array,
|
|
// default: [],
|
|
// },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
const User = mongoose.model("User", UserSchema);
|
|
export default User;
|