diogogmt

schemas

Mar 20th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. /**
  2. * Model: Estimate Line Item
  3. */
  4.  
  5. var EstimateLineItemSchema = new Schema({
  6. 'name' : String,
  7. 'description' : String,
  8. 'quantity' : Number,
  9. 'cost' : Number
  10. });
  11.  
  12. console.log("EstimateLineItemSchema: ", EstimateLineItemSchema);
  13.  
  14. var EstimateLineItem = db.model('EstimateLineItem', EstimateLineItemSchema);
  15.  
  16.  
  17. /**
  18. * Model: Estimate
  19. */
  20.  
  21. var EstimateSchema = new Schema({
  22. 'name' : String,
  23. 'subTotal' : Number,
  24. 'finalTotal' : Number,
  25. 'creationDate' : { type: Date, default: Date.now },
  26. 'status' : { type: String, default: "Active" },
  27. 'lineItemSet' : [EstimateLineItem]
  28. });
  29.  
  30. console.log("EstimateSchema: ", EstimateSchema);
  31.  
  32. var Estimate = db.model('Estimate', EstimateSchema);
  33.  
  34. /**
  35. * Model: Job
  36. */
  37.  
  38. var JobSchema = new Schema({
  39. 'name' : String,
  40. 'description' : String,
  41. 'creationDate' : { type: Date, default: Date.now },
  42. 'status' : { type: String, default: "Active" },
  43. 'scheduleDates' : String,
  44. 'customerID' : schemaObjectId,
  45. 'estimateSet' : [Estimate]
  46. });
  47. console.log("JobSchema: ", JobSchema);
  48.  
  49. var Job = db.model('Job', JobSchema);
Advertisement
Add Comment
Please, Sign In to add comment