Untitled

mail@pastecode.io avatar
unknown
plain_text
12 days ago
1.0 kB
2
Indexable
Never
const mongoose = require('mongoose');
const validator = require('validator');

const retailerRequestSchema = new mongoose.Schema(
  {
    name: {
      type: String,
      required: [true, 'Please, tell us your name!']
    },
    company_name: {
        type: String,
        required: [true, 'Please, tell us your company name!']
      },
    email: {
      type: String,
      required: [true, 'Please provide your email!'],
      unique: true,
      lowercase: true,
      validate: [validator.default.isEmail, 'Please provide a valid email address!']
    },
    phone: {
      type: String,
      required: [true, 'Please, type your phone !']
    },
    province: {
      type: String,
      required: [true, 'Please, type your phone !']  
    },
     
  },
  { timestamps: true },
  {
    toJSON: { virtuals: true },
    toObject: { virtuals: true }
  }
);



const RetailerRequest = mongoose.model('RetailerRequest', retailerRequestSchema);

module.exports = RetailerRequest;
Leave a Comment