vhp-mongo-models 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ let attachment = {
2
+ type: { type: String, default: '' }, // 'contract' || ?
3
+ ref: { type: String, default: '' }
4
+ }
5
+
6
+ module.exports = [{
7
+ dates: { type: Array, default: [] }, // array of date objects
8
+ type: { type: String, default: '' }, // 'consult' || 'install' || 'service'
9
+ ref: { type: String, default: '' },
10
+ status: { type: String, default: '' },
11
+ attendees: { type: Array, default: [] }, // array of ids
12
+ attachments: { type: Array, default: [] }, // array of 'attachment's
13
+ notes: { type: String, default: '' },
14
+ title: { type: String, default: '' },
15
+ wonum: { type: String, default: '' },
16
+ }]
@@ -1,84 +1,75 @@
1
-
2
1
  /** Home Schema
3
- *
4
- * spaces = [{
5
- * id:{type:String,default:''},
6
- * title:{type:String,default:''}
7
- * subspaces:{type:String,default:[{
8
- * id:{type:String,default:''},
9
- * title:{type:String,default:''}
10
- * }]}
11
- * }]
12
- *
13
2
  * index
14
3
  * - hhid - {unique:true,name:"hhid"}
15
4
  */
16
- module.exports = [
17
- {
18
- hhid:{type:String,default:''},
5
+ module.exports = [{
6
+ hhid: { type: String, default: '' },
19
7
 
20
- street:{type:String,default:''},
21
- unit:{type:String,default:''},
22
- city:{type:String,default:''},
23
- state:{type:String,default:''},
24
- zip:{type:String,default:''},
8
+ street: { type: String, default: '' },
9
+ unit: { type: String, default: '' },
10
+ city: { type: String, default: '' },
11
+ state: { type: String, default: '' },
12
+ zip: { type: String, default: '' },
25
13
 
26
- custid:{type:String,default:''},
27
- occupant:{type:String,default:''},
28
- billTo:{type:Boolean,default:false},
14
+ custid: { type: String, default: '' },
15
+ occupant: { type: String, default: '' },
16
+ billTo: { type: Boolean, default: false },
29
17
 
30
- location:{type:Object,default:{
31
- building_id:'',
32
- gers:null,
33
- upi:null,
34
- geoid:null,
35
- geocode:{
36
- lat:null,
37
- lng:null
18
+ location: {
19
+ type: Object, default: {
20
+ building_id: '',
21
+ gers: null,
22
+ upi: null,
23
+ geoid: null,
24
+ geocode: {
25
+ lat: null,
26
+ lng: null
27
+ }
28
+ }
29
+ },
30
+ utilities: {
31
+ type: Object, default: {
32
+ eleccomp: '',
33
+ gascomp: ''
34
+ }
35
+ },
36
+ measurements: { type: Object, default: {} },
37
+ features: {
38
+ elecService: {
39
+ panel: { type: String, default: '' },
40
+ serviceSize: { type: String, default: '' },
41
+ wireType: { type: String, default: '' },
42
+ provider: { type: String, default: '' }
43
+ },
44
+ gasService: {
45
+ provider: { type: String, default: '' },
46
+ type: { type: String, default: '' }
47
+ },
48
+ roof: {
49
+ roofTint: { type: String, default: '' },
50
+ roofMake: { type: String, default: '' },
51
+ pitch: { type: String, default: '' },
52
+ gutters: {
53
+ material: { type: String, default: '' },
54
+ feet: { type: Number, default: 0 }
38
55
  }
39
- }
40
56
  },
41
- utilities:{type:Object,default:{
42
- eleccomp:'',
43
- gascomp:''
44
- }},
45
- measurements:{type:Object,default:{}},
46
- features:{
47
- elecService:{
48
- panel:{type:String,default:''},
49
- serviceSize:{type:String,default:''},
50
- wireType:{type:String,default:''},
51
- provider:{type:String,default:''}
52
- },
53
- gasService:{
54
- provider:{type:String,default:''},
55
- type:{type:String,default:''}
56
- },
57
- roof:{
58
- roofTint:{type:String,default:''},
59
- roofMake:{type:String,default:''},
60
- pitch:{type:String,default:''},
61
- gutters:{
62
- material:{type:String,default:''},
63
- feet:{type:Number,default:0}
64
- }
65
- },
66
- waterheater:{
67
- capacity:{type:Number,default:0},
68
- btus:{type:Number,default:0},
69
- type:{type:String,default:''},
70
- condition:{type:Number,default:''}
71
- },
72
- foundation:{type:String,default:''},
73
- frontFace:{type:String,default:''},
74
- buildYear:{type:Number,default:0},
75
- sqft:{type:Number,default:0},
76
- floors:{type:Number,default:0},
77
- baths:{type:Number,default:0},
78
- rooms:{type:Number,default:0}
57
+ waterheater: {
58
+ capacity: { type: Number, default: 0 },
59
+ btus: { type: Number, default: 0 },
60
+ type: { type: String, default: '' },
61
+ condition: { type: Number, default: '' }
79
62
  },
80
- spaces:{type:Array,default:[]},
81
- froot:{type:String,default:''}
63
+ foundation: { type: String, default: '' },
64
+ frontFace: { type: String, default: '' },
65
+ buildYear: { type: Number, default: 0 },
66
+ sqft: { type: Number, default: 0 },
67
+ floors: { type: Number, default: 0 },
68
+ baths: { type: Number, default: 0 },
69
+ rooms: { type: Number, default: 0 }
82
70
  },
83
- {minimize:false}
84
- ]
71
+ spaces: { type: Array, default: [] },
72
+ froot: { type: String, default: '' }
73
+ },
74
+ { minimize: false }
75
+ ]
@@ -0,0 +1,10 @@
1
+ let subspace = {
2
+ id: { type: String, default: '' },
3
+ title: { type: String, default: '' }
4
+ }
5
+
6
+ module.exports = [{
7
+ id: { type: String, default: '' },
8
+ title: { type: String, default: '' },
9
+ subspaces: { type: Array, default: [] }
10
+ }]
@@ -0,0 +1,6 @@
1
+ module.exports = [{
2
+ date: { type: Date, default: Date.now() },
3
+ type: { type: String, default: '' },
4
+ user: { type: String, default: '' },
5
+ msg: { type: String, default: '' }
6
+ }]
@@ -0,0 +1,59 @@
1
+ module.exports = [{
2
+ contractid: { type: String, default: '' },
3
+ name: { type: String, default: '' },
4
+ jobnum: { type: String, default: '' },
5
+ jobname: { type: String, default: '' },
6
+ solname: { type: String, default: '' },
7
+ version: { type: String, default: '' },
8
+ type: { type: String, default: '' },
9
+ dept: { type: String, default: '' },
10
+ strtdate: { type: Date, default: '' },
11
+ solddate: { type: Date, default: '' },
12
+ sold: { type: Boolean, default: false },
13
+ estimator: { type: String, default: '' },
14
+ hhid: { type: String, default: '' },
15
+ custcode: { type: String, default: '' },
16
+ projectid: { type: String, default: '' },
17
+ path: { type: Array, default: [] },
18
+ customer: {
19
+ clientFirst: project.clientfirst,
20
+ clientLast: project.clientlast,
21
+ //name: `${project.clientfirst} ${project.clientlast}` || project.clientfirst || project.clientlast, << still want to have this, need to remember how to do virtuals
22
+ street: project.street,
23
+ unit: project.unit,
24
+ city: project.city,
25
+ state: project.state,
26
+ zip: project.zip,
27
+ //longCity: project.city + ', ' + project.state + ' ' + project.zip,
28
+ phone: project.phone,
29
+ email: project.email
30
+ },
31
+ general: {
32
+ net: { type: Number, default: 0 },
33
+ projid: { type: String, default: '' },
34
+ contractid: { type: String, default: '' },
35
+ dept: { type: String, default: '' },
36
+ },
37
+ subs: [],
38
+ finance: {
39
+ billto: { type: String, default: '' },
40
+ net: { type: Number, default: 0 },
41
+ downAmount: { type: Number, default: 0 },
42
+ downDate: { type: Date, default: '' },
43
+ downVia: { type: String, default: '' },
44
+ financed: { type: Boolean, default: false },
45
+ fincode: { type: String, default: '' },
46
+ finAmount: { type: Number, default: 0 },
47
+ finTerm: { type: Number, default: 0 },
48
+ finAPR: { type: String, default: '' },
49
+ dueComplete: { type: Number, default: 0 },
50
+ },
51
+ discounts: { type: Array, default: [] },
52
+ additions: { type: Array, default: [] },
53
+ notes: { type: String, default: '' },
54
+ terms: {
55
+ financing: { type: String, default: '' },
56
+ collections: { type: String, default: '' },
57
+ },
58
+ solution: { type: Object, default: {} }
59
+ }]
@@ -1,65 +1,48 @@
1
1
  const { Schema } = require('mongoose')
2
2
  const { aaddress, acontact } = require('../../core-models.js');
3
3
 
4
- /**
5
- * pvmaint.visit = [{
6
- * type:{type:String}, //Cooling | Heating
7
- * date:{type:Date},
8
- * check:{type:Boolean},
9
- * notes:{type:String},
10
- * photos:{type:Boolean},
11
- * scheduled:{type:Boolean}
12
- * }]
13
- */
14
-
15
- /**
16
- *
17
- */
18
4
  let pvmaint = {
19
- contractNum:{type:String,default:''},
20
- rewardNum:{type:String,default:''},
21
- jobref:{type:String,default:''},
22
- custCode:{type:String,default:''},
23
- custName:{type:String,default:''},
24
- street:{type:String,default:''},
25
- city:{type:String,default:''},
26
- state:{type:String,default:''},
27
- zip:{type:String,default:''},
28
- visits:{type:Array,default:[]}
5
+ contractNum: { type: String, default: '' },
6
+ rewardNum: { type: String, default: '' },
7
+ jobref: { type: String, default: '' },
8
+ custCode: { type: String, default: '' },
9
+ custName: { type: String, default: '' },
10
+ street: { type: String, default: '' },
11
+ city: { type: String, default: '' },
12
+ state: { type: String, default: '' },
13
+ zip: { type: String, default: '' },
14
+ visits: { type: Array, default: [] }
15
+ }
16
+ let pvvisit = {
17
+ type: { type: String }, //Cooling | Heating
18
+ date: { type: Date },
19
+ check: { type: Boolean },
20
+ notes: { type: String },
21
+ photos: { type: Boolean },
22
+ scheduled: { type: Boolean }
29
23
  }
30
24
  let lead = {
31
- apptdate:{type:Date,default:''},
32
- type:{type:String,default:''},
33
- prstdate:{type:Date,default:''},
34
- time:{type:String,default:''},
35
- carryover:{type:Date,default:''},
36
- prstvia:{type:String,default:''},
37
- rewards:{type:Boolean,default:false},
38
- source:{type:String,default:''},
39
- generator:{type:String,default:''},
40
- soldAmount:{type:Number,default:0},
41
- paid:{type:Date,default:''}
25
+ apptdate: { type: Date, default: '' },
26
+ type: { type: String, default: '' },
27
+ prstdate: { type: Date, default: '' },
28
+ time: { type: String, default: '' },
29
+ carryover: { type: Date, default: '' },
30
+ prstvia: { type: String, default: '' },
31
+ rewards: { type: Boolean, default: false },
32
+ source: { type: String, default: '' },
33
+ generator: { type: String, default: '' },
34
+ soldAmount: { type: Number, default: 0 },
35
+ paid: { type: Date, default: '' }
42
36
  }
43
37
  let info = {
44
- pkids:{type:Array,default:[]},
45
- spaces:{type:Array,default:[]},
46
- summary:{type:Object,default:{}},
47
- quotes:{type:Object,default:{}},
48
- joblog:{type:Object,default:{}},
49
- pvmaint:pvmaint,
38
+ pkids: { type: Array, default: [] },
39
+ spaces: { type: Array, default: [] },
40
+ summary: { type: Object, default: {} },
41
+ quotes: { type: Object, default: {} },
42
+ joblog: { type: Object, default: {} },
43
+ pvmaint: pvmaint,
50
44
  }
51
45
 
52
- /*
53
- info.spaces = [{
54
- * id:{type:String,default:''},
55
- * title:{type:String,default:''}
56
- * subspaces:{type:String,default:[{
57
- * id:{type:String,default:''},
58
- * title:{type:String,default:''}
59
- * }]}
60
- * }]]
61
- */
62
-
63
46
  /** Projects Schema
64
47
  *{
65
48
  "dept": 1,
@@ -69,6 +52,7 @@ info.spaces = [{
69
52
  * index
70
53
  * - id - {unique:true,name:"id"}
71
54
  */
55
+ <<<<<<< HEAD
72
56
 
73
57
  /**
74
58
  * refs:[{work,id,type}]
@@ -76,20 +60,27 @@ info.spaces = [{
76
60
  * types - sub | general | referral | install(s)
77
61
  */
78
62
  module.exports=[
63
+ =======
64
+ module.exports = [
65
+ >>>>>>> c26384180c1421d68d8b7cc3b132dfe037e29b8a
79
66
  {
80
67
  id: { type: String, default: '' },
81
68
  name: { type: String, default: '' },
82
- coid: { type:String,default:''},
69
+ coid: { type: String, default: '' },
83
70
  jobnum: { type: String, default: '' },
71
+ <<<<<<< HEAD
84
72
  ref:{type:String,default:''},//could be wo#
85
73
  //woref:{type:String,default:''},
74
+ =======
75
+ ref: { type: String, default: '' },
76
+ >>>>>>> c26384180c1421d68d8b7cc3b132dfe037e29b8a
86
77
  hhid: { type: String, default: '' },
87
78
  clientfirst: { type: String, default: '' },
88
79
  clientlast: { type: String, default: '' },
89
80
  ...aaddress,
90
81
  ...acontact,
91
82
  estimator: { type: String, default: 'unassigned' },
92
- schedule:{type:Array, default:[]},
83
+ schedule: { type: Array, default: [] },
93
84
  dept: { type: String, default: '' },
94
85
  stage: { type: String, default: 'quote' },
95
86
  status: { type: String, default: 'active' },
@@ -97,15 +88,15 @@ module.exports=[
97
88
  lastdate: { type: Date, default: Date.now() },
98
89
  closedate: { type: Date, default: '' },
99
90
  datelog: { type: Array, default: [] },
100
- info:info,
101
- contracts:{type:Array, default:[]},
102
- lead:lead,
103
- refs:{type:Array, default:[]},
91
+ info: info,
92
+ contracts: { type: Array, default: [] },
93
+ lead: lead,
94
+ refs: { type: Array, default: [] },
104
95
  froot: { type: String, default: '' }
105
96
  },
106
97
  {
107
98
  toJSON: { virtuals: true },
108
99
  toObject: { virtuals: true },
109
- minimize:false
100
+ minimize: false
110
101
  }
111
102
  ]
@@ -1,38 +1,26 @@
1
- /*
2
- Quotes are currently held in project.info.quotes={
3
- <quoteType>:{
4
- coid:string
5
- type:string
6
- solutions:array
7
- }
1
+ const quote = {
2
+ coid: { type: String, default: '' },
3
+ type: { type: String, default: '' }, // 'hvac' || 'envelope' || 'windows'
4
+ solutions: { type: Array, default: [] } // array of 'solution's
8
5
  }
9
6
 
10
- const aquote = {
11
- coid: 'string',
12
- type: 'string',
13
- solutions: []
14
- }
15
-
16
- const asolution = {
17
- name: 'string',
18
- tiers: [],
19
- space: 'string',
20
- subspace: 'string',
21
- details: 'object', // ie 'access point', 'heat load'
22
- strategy: 'string',
23
- additions: [],
24
- discounts: [],
25
- summary: { // main access point to 'get' information on the quote
26
- tiers: [], // calculated totals for each option (base + additions + discounts + etc)
27
- path: [], // 'path' to the selected option
28
- contractid: 'string',
29
- finance: {}
7
+ const solution = {
8
+ name: { type: String, default: '' },
9
+ tiers: { type: Array, default: [] }, // array of 'tier's
10
+ space: { type: String, default: '' }, // id of the space (not the name)
11
+ subspace: { type: String, default: '' }, // id of the subspace (not the name)
12
+ details: { type: Object, default: {} },
13
+ strategy: { type: String, default: '' },
14
+ additions: { type: Array, default: [] },
15
+ discounts: { type: Array, default: [] },
16
+ summary: {
17
+ tiers: { type: Array, default: [] }, // calculated totals for each option (base + additions + discounts + etc)
18
+ path: { type: Array, default: [] }, // 'path' to the selected option
19
+ contractid: { type: String, default: '' },
20
+ finance: { type: Object, default: {} }
30
21
  }
31
22
  }
32
23
 
33
- const atier= {
34
- name: '',
35
- {productInfo}
36
- }
37
-
38
- */
24
+ const tier = {
25
+ name: { type: String, default: '' }
26
+ }
@@ -0,0 +1,11 @@
1
+ const project = require('./projects.js');
2
+ const bid = require('./bid.js');
3
+
4
+ /**
5
+ * This is essentially a 'bid' with the lead information from the associated project.
6
+ * These are assembled during sales analytics calculations.
7
+ */
8
+ module.exports = [{
9
+ ...project.lead,
10
+ ...bid
11
+ }]
@@ -1,5 +1,6 @@
1
1
  module.exports = [{
2
2
  id:{type:String,default:''},
3
3
  fields:{type:Object,default:{}},
4
- result:{type:String,default:''}
4
+ result:{type:String,default:''},
5
+ building:{type:String,default:''} //RES | COM
5
6
  },{minimize:false}]
@@ -13,6 +13,7 @@ module.exports = [{
13
13
  tags:{type:Array,default:[]},
14
14
  grades:{type:Array,default:[]},
15
15
  present:{type:Boolean,default:true},
16
+ building:{type:String,default:''}, //RES | COM
16
17
 
17
18
  //sitemTags:{type:Array,default:[]},
18
19
  rewards:{type:Boolean,default:false},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vhp-mongo-models",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "productName": "VHP Mongo Models",
5
5
  "description": "Mongo Models library to setup Mongoose Schemas",
6
6
  "author": "VHPim",
@@ -1,71 +0,0 @@
1
-
2
-
3
- /*
4
- constracts = [{
5
- contractid: contractid,
6
- jobnum: project.jobnum || '',
7
- jobname: project.name || '',
8
- solname: solution.name || '',
9
- name: solution.name || '',
10
- version: false,
11
- strtdate: null,
12
- solddate: null,
13
- sold: sold,
14
- estimator: project.estimator || '',
15
- dept: project.dept,
16
- type: solution.type || '', // not editable; helps determine which templates to use [string]
17
- path: path,
18
- hhid: project.hhid || '', // not editable; not shown anywhere
19
- custcode: project.custid || '', // not editable
20
- projectid: project.id || '',
21
- customer: { // all editable (besides longCity and fullName) [strings]
22
- clientFirst: project.clientfirst,
23
- clientLast: project.clientlast,
24
- name: `${project.clientfirst} ${project.clientlast}` || project.clientfirst || project.clientlast,
25
- street: project.street,
26
- unit: project.unit,
27
- city: project.city,
28
- state: project.state,
29
- zip: project.zip,
30
- longCity: project.city + ', ' + project.state + ' ' + project.zip,
31
- phone: project.phone,
32
- email: project.email
33
- },
34
- general:{
35
- net:0,
36
- projid:'',
37
- contractid:'',
38
- dept:''
39
- },
40
- subs:[], //list
41
- finance: {
42
- billto: '', // editable (searchable?) [string]
43
-
44
- net: 0, // editable [price]
45
-
46
- downAmount: 0, // editable [price]
47
- downDate: '', // editable [date]
48
- downVia: '', // editable ( check number | card last 4 | cash ) [string]
49
-
50
- financed: financed,
51
- fincode: '', // editable [string]
52
- finAmount: 0, // editable [price]
53
- finTerm: 0, // referenced from fintable via finCode string [number]
54
- finAPR: '', // referenced from fintable via finCode string [string]
55
-
56
- dueComplete: 0 // calculation (net - downAmount- dueComplete) [price]
57
- },
58
- discounts: [],
59
- additions: [],
60
- notes: '',
61
- terms: { // not editable; not shown on editor or preview, shown on print; gathered from table in settings [string]
62
- financing: '',
63
- collections: ''
64
- },
65
- solution: { // editablilty will depend on solution. will be blank if STANDARD contract
66
- //windows:[]
67
- //envelope:[]
68
- //vhc:[]
69
- }
70
- }]
71
- */
@@ -1,4 +0,0 @@
1
- module.exports = [
2
- {},
3
- {strict:false}
4
- ]