22 lines
748 B
JavaScript
22 lines
748 B
JavaScript
const mongoose = require('mongoose');
|
|
const { Schema } = mongoose;
|
|
|
|
const schema = new Schema({
|
|
load: { type: Schema.Types.ObjectId, ref: 'loads' },
|
|
shipper: { type: Schema.Types.ObjectId, ref: 'companies' }, // how offers load
|
|
carrier: { type: Schema.Types.ObjectId, ref: 'companies' }, // how transport the load
|
|
vehicle: { type: Schema.Types.ObjectId, ref: 'vehicles' },
|
|
|
|
bidder: { type: Schema.Types.ObjectId, ref: 'users' },
|
|
|
|
comment: { type: String },
|
|
|
|
is_withdrawn: { type: Boolean, default: false },
|
|
|
|
accepted_by: { type: Schema.Types.ObjectId, ref: 'users' },
|
|
accepted_date: { type: Date },
|
|
is_accepted: { type: Boolean, default: false },
|
|
});
|
|
|
|
module.exports = mongoose.model( "proposals", schema );
|