Spaces:
Runtime error
Runtime error
| const { mongoose, baseSchemaOptions } = require('./base'); | |
| const VendorSchema = new mongoose.Schema({ | |
| name: { type: String, required: true, trim: true }, | |
| pan: { type: String, trim: true, default: null }, | |
| gstin: { type: String, trim: true, default: null }, | |
| vendor_code: { type: String, required: true, trim: true }, | |
| epf_code: { type: String, trim: true, default: null }, | |
| esi_code: { type: String, trim: true, default: null }, | |
| work_order_no: { type: String, trim: true, default: null }, | |
| contract_start: { type: Date, default: null }, | |
| contract_end: { type: Date, default: null }, | |
| max_workers: { type: Number, default: null }, | |
| form1_path: { type: String, default: null }, | |
| form2_path: { type: String, default: null }, | |
| is_active: { type: Boolean, default: true } | |
| }, baseSchemaOptions()); | |
| VendorSchema.index({ vendor_code: 1 }, { unique: true }); | |
| VendorSchema.index({ pan: 1 }, { unique: true, sparse: true }); | |
| VendorSchema.index({ gstin: 1 }, { unique: true, sparse: true }); | |
| module.exports = mongoose.model('Vendor', VendorSchema); | |