Untitled

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

const retailerSchema = new mongoose.Schema({
  company_name: {
    type: String,
    required: [true, 'Company name is required']
  },
  province: {
    type: String,
    required: [true, 'Province is required']
  },
  payment_method: {
    type: String,
    enum: ["cmi" ,"cash", "both"],
    required: [true, 'payment methode is required']
  },
  ice: {
    type: String,
    required: [true, 'ICE is required'],
    unique: true
  },
  id_fiscal: {
    type: String,
    unique: true
  },
  register_commerce: {
    type: String,
    unique: true
  },
  taxe: {
    type: String,
    unique: true
  },
  cnss: {
    type: String,
    unique: true
  },
  rib: {
    type: String,
    unique: true
  },
  address: {
    type: String
  },
  pricingType: {
    type: Number
  },
  orders: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Order'
    }
  ],
  wishlist: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Product'
    }
  ]
});

const Retailer = mongoose.model('Retailer', retailerSchema);

module.exports = Retailer;
Leave a Comment