feat(Countries): Adding countries endpoint
This commit is contained in:
55
lib/Models/vehicles.model.js
Normal file
55
lib/Models/vehicles.model.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const mongoose = require('mongoose');
|
||||
const { Schema } = mongoose;
|
||||
|
||||
const pointSchema = new Schema({
|
||||
type: {
|
||||
type: String,
|
||||
enum: ['Point'],
|
||||
required: true
|
||||
},
|
||||
coordinates: {
|
||||
type: [Number],
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
const schema = new Schema({
|
||||
company: { type: Schema.Types.ObjectId, ref: 'companies' }, // carrier
|
||||
|
||||
vehicle_code: { type: String },
|
||||
vehicle_name: { type: String },
|
||||
vehicle_number: { type: String }, //camion001 002 etc
|
||||
circulation_serial_number: { type: String },
|
||||
trailer_plate_1: { type: String },
|
||||
trailer_plate_2: { type: String },
|
||||
truck_type: { type: String },
|
||||
tyre_type: { type: String },
|
||||
city: { type: String },
|
||||
state: { type: String },
|
||||
|
||||
background_tracking: { type: Boolean, default: false },
|
||||
|
||||
status: { type: String, enum: ['Free', 'Loading', 'Transit', 'Downloading'] },
|
||||
|
||||
categories: [{ type: Schema.Types.ObjectId, ref: 'product-categories' }],
|
||||
|
||||
published_date: { type: Date },
|
||||
available_date: { type: String },
|
||||
is_available: { type: Boolean, default: false },
|
||||
|
||||
active_load: { type: Schema.Types.ObjectId, ref: 'loads' },
|
||||
load_shipper: { type: Schema.Types.ObjectId, ref: 'companies' },
|
||||
|
||||
available_in: [{ type: String }],
|
||||
|
||||
destino: { type: String },
|
||||
driver: { type: Schema.Types.ObjectId, ref: 'users' },
|
||||
notes: { type: String },
|
||||
|
||||
last_location_lat: { type: String },
|
||||
last_location_lng: { type: String },
|
||||
last_location_geo: { type: pointSchema },
|
||||
last_location_time: { type: Date },
|
||||
});
|
||||
|
||||
module.exports = mongoose.model( "vehicles", schema );
|
||||
Reference in New Issue
Block a user