Advertisement
Guest User

Untitled

a guest
Aug 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement