SHARE
TWEET

Untitled

a guest Aug 14th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import mongoose from "mongoose";
  2. import { ObjectID } from "mongodb";
  3.  
  4. const Schema = mongoose.Schema;
  5.  
  6. ObjectID.prototype.valueOf = function() {
  7.   return this.toString();
  8. };
  9.  
  10. const FreightSchema = new Schema(
  11.   {
  12.     origin: {
  13.       type: Schema.Types.ObjectId,
  14.       ref: "Location"
  15.     },
  16.     destination: {
  17.       type: Schema.Types.ObjectId,
  18.       ref: "Location"
  19.     },
  20.     status: {
  21.       type: Boolean,
  22.       default: true
  23.     },
  24.     km: String,
  25.     weight: String,
  26.     price: String,
  27.     cargo: String,
  28.     km: String,
  29.     especie: String,
  30.     complement: String,
  31.     tracking: String,
  32.     note: String,
  33.     vehicles: [{ type: String }],
  34.     bodies: [{ type: String }],
  35.     nextel: [{ type: String }],
  36.     cellphone: [{ type: String }],
  37.     telephone: [{ type: String }],
  38.     whatsapp: [{ type: String }],
  39.     sac: [{ type: String }],
  40.  
  41.     company: {
  42.       type: Schema.Types.ObjectId,
  43.       ref: "Company"
  44.     },
  45.     url: {
  46.       type: String,
  47.       unique: true
  48.     },
  49.     site: String
  50.   },
  51.   { timestamps: { updatedAt: "updated_at", createdAt: "created_at" } }
  52. );
  53.  
  54. export default mongoose.model("Freight", FreightSchema);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top