feat: Adding loads and load-attachments endpoints
This commit is contained in:
19
lib/Models/load-attachments.model.js
Normal file
19
lib/Models/load-attachments.model.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const mongoose = require('mongoose');
|
||||
const { Schema } = mongoose;
|
||||
|
||||
const schema = new Schema({
|
||||
status: { type: String, default: 'Draft', enum: ['Draft', 'Done'] },/*Once in Done state, no changes are allowed.*/
|
||||
updatedAt: {
|
||||
type: Date,
|
||||
default : () => Date.now()
|
||||
},
|
||||
type: { type: String, enum: ['Loading', 'Downloading'], required : true },
|
||||
company: { type: Schema.Types.ObjectId, ref: 'companies' }, //shipper
|
||||
carrier: { type: Schema.Types.ObjectId, ref: 'companies', required: true }, // carrier
|
||||
load: { type: Schema.Types.ObjectId, ref: 'loads', required: true },
|
||||
author: { type: Schema.Types.ObjectId, ref: 'users', required: true },
|
||||
doneAt: { type: Date }
|
||||
});
|
||||
|
||||
module.exports = mongoose.model( "loadattachments", schema );
|
||||
|
||||
Reference in New Issue
Block a user