Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. const mongoose = require("mongoose");
  2. const Schema = mongoose.Schema;
  3.  
  4. const InstallationSchema = new Schema({
  5. installrefno: { type: String },
  6. installdate: { type: Date },
  7. serialno: {
  8. type: mongoose.Schema.Types.ObjectId,
  9. ref: "proreg"
  10. },
  11. installedby: {
  12. type: mongoose.Schema.Types.ObjectId,
  13. ref: "employees"
  14. },
  15.  
  16. customer: {
  17. type: mongoose.Schema.Types.ObjectId,
  18. ref: "customer"
  19. },
  20. customertype: {
  21. type: mongoose.Schema.Types.ObjectId,
  22. ref: "customertype"
  23. },
  24. department: {
  25. type: mongoose.Schema.Types.ObjectId,
  26. ref: "customersubdepartment"
  27. },
  28. contactperson: { type: String },
  29. contactno: { type: Number },
  30. address: { type: String },
  31. remarks: { type: String },
  32. filename: { type: String },
  33. installdoc: { type: String }
  34. });
  35.  
  36. module.exports = InstallationDetails = mongoose.model(
  37. "installation",
  38. InstallationSchema
  39. );
  40.  
  41. const mongoose = require("mongoose");
  42. const Schema = mongoose.Schema;
  43.  
  44. // Create Schema
  45. const ProRegSchema = new Schema({
  46. refno1: {
  47. type: String
  48. },
  49. refno2: {
  50. type: String
  51. },
  52. date: {
  53. type: Date
  54. },
  55. customer: {
  56. type: mongoose.Schema.Types.ObjectId,
  57. ref: "customer"
  58. },
  59. customertype: {
  60. type: mongoose.Schema.Types.ObjectId,
  61. ref: "customertype"
  62. },
  63. department: {
  64. type: mongoose.Schema.Types.ObjectId,
  65. ref: "customersubdepartment"
  66. },
  67.  
  68. products: [
  69. {
  70. oem: {
  71. type: Schema.Types.ObjectId,
  72. ref: "company"
  73. },
  74. category: {
  75. type: mongoose.Schema.Types.ObjectId,
  76. ref: "productcategory"
  77. },
  78. subcategory: {
  79. type: mongoose.Schema.Types.ObjectId,
  80. ref: "productsubcategory"
  81. },
  82. modelno: {
  83. type: String
  84. },
  85. serialno: {
  86. type: String,
  87. required: true
  88. },
  89. warrantyfrom: {
  90. type: Date,
  91. default: "01-01-2019"
  92. },
  93. warrantyto: {
  94. type: Date,
  95. default: "01-01-2019"
  96. },
  97. oemwarrantyfrom: {
  98. type: Date,
  99. default: "01-01-2019"
  100. },
  101. oemwarrantyto: {
  102. type: Date,
  103. default: "01-01-2019"
  104. }
  105. }
  106. ],
  107. date: {
  108. type: Date,
  109. default: Date.now
  110. }
  111. });
  112.  
  113. module.exports = ProReg = mongoose.model("proreg", ProRegSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement