const mongoose = require('mongoose'); const { Schema } = mongoose; const meta_data = new Schema({ meta_group: { type: String }, meta_key: { type: String }, meta_value: { type: String }, }); const company_contacts = new Schema({ meta_key: { type: String }, meta_value: { type: String }, }); const address = new Schema({ street_address1: { type: String }, street_address2: { type: String }, city: { type: String }, state: { type: String }, country: { type: String }, zipcode: { type: String }, landmark: { type: String }, lat: { type: String }, lng: { type: String }, }); const schema = new Schema({ company_serial_number: { type: String }, company_code: { type: String }, is_company: { type: String }, //1000 company_name: { type: String, required: true }, company_legal_name: { type: String }, company_description: { type: String }, rfc: { type: String }, company_type: [{ type: String }], // SHIPPER , CARRIER is_broker: { type: Boolean, default: false }, membership: { type: String }, membership_start_at: { type: Date }, meta_data: [meta_data], categories: [{ type: Schema.Types.ObjectId, ref: 'productcategories' }], products: { type: Schema.Types.ObjectId, ref: 'products' }, users: [{ type: Schema.Types.ObjectId, ref: 'users' }], branches: [{ type: Schema.Types.ObjectId, ref: 'branches' }], company_city: [{ type: String }], company_state: [{ type: String }], truck_type: [{ type: String }], street_address1: { type: String }, street_address2: { type: String }, city: { type: String }, state: { type: String }, country: { type: String }, zipcode: { type: String }, landmark: { type: String }, lat: { type: String }, lng: { type: String }, is_hidden: { type: Boolean, default: false }, }); module.exports = mongoose.model( "branches", schema );