vhp-mongo-models 1.6.3 → 1.7.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.
@@ -4,5 +4,6 @@ module.exports = {
4
4
  Client:new Schema(...require('./schemas/client.js')),
5
5
  Home:new Schema(...require('./schemas/home.js')),
6
6
  ServiceItem:new Schema(...require('./schemas/serviceitem.js')),
7
- SIupdate:new Schema(...require('./schemas/siupdate.js'))
7
+ SIupdate:new Schema(...require('./schemas/siupdate.js')),
8
+ Checklist:new Schema(...require('./schemas/checklist.js'))
8
9
  }
@@ -0,0 +1,13 @@
1
+ module.exports = [{
2
+ id:{type:String,default:''}, //unique for THIS checklist
3
+ hhid:{type:String,default:''},
4
+ work:{type:String,default:""}, //just an array of work.id
5
+ custcode:{type:String,default:''},
6
+ name:{type:String,default:''}, //what checklist was used
7
+ sitems:{type:Array,default:[]}, //of service item ["ids"]
8
+ scoring:{
9
+ list:{type:Object,default:{}},
10
+ score:{type:Object,default:{}},
11
+ },
12
+ fields:{type:Object,default:{}} //to hold all of the checklist values
13
+ },{minimize:false}]
@@ -7,8 +7,8 @@
7
7
  module.exports = [
8
8
  {
9
9
  coid:{type:String,default:''},
10
- custCode : {type:String,default:''}, //link in Jonas
11
- type:{type:String,default:'owner'}, // Owners | Occupants
10
+ custCode : {type:String,default:''},
11
+ type:{type:String,default:'Owner'}, // Owners | Occupants
12
12
  billTo:{type:String,default:''},
13
13
  custName:{type:String,default:''},
14
14
  clientfirst: { type: String, default: '' },
@@ -1,14 +1,5 @@
1
1
 
2
2
  /** 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
3
  *
13
4
  * index
14
5
  * - hhid - {unique:true,name:"hhid"}
@@ -79,5 +70,6 @@ module.exports = [
79
70
  },
80
71
  spaces:{type:Array,default:[]},
81
72
  froot:{type:String,default:''}
82
- }
73
+ },
74
+ {minimize:false}
83
75
  ]
@@ -1,9 +1,16 @@
1
-
1
+ /*
2
+ notes = [{
3
+ tech:{type:String,default:''},
4
+ date:{type:Date,default:null},
5
+ work:{type:String,default:''},
6
+ note:{type:String,default:''}
7
+ }]
8
+ */
2
9
  module.exports = [
3
10
  {
11
+ //VHP ADD fields
4
12
  hhid:{type:String,default:''}, //must have a hhid
5
- group:{type:String,default:''},//names the type of product it is. Would like to use this instead of type
6
- sysid:{type:String,default:''}, //way to link related service items
13
+ system:{type:String,default:''}, //way to link related service items
7
14
  space:{type:String,default:''},
8
15
  subspace:{type:String,default:''},
9
16
  quantity:{type:Number,default:1}, //optional qty
@@ -13,8 +20,8 @@ module.exports = [
13
20
  //JONAS props
14
21
  id:{type:String,default:''}, //must have an id, should match JONAS "lineNumber"
15
22
  custcode:{type:String,default:''}, //linked custcode in JONAS
23
+ type:{type:String,default:''},//FU CU C etc
16
24
  tagid:{type:String,default:''},
17
- type:{type:String,default:''},//understand what this is in jonas
18
25
  descr:{type:String,default:''},
19
26
  status:{type:String,default:''},//should be 'A' for active. Need to find other codes. Match JONAS
20
27
  insdate:{type:Date,default:''},
@@ -23,13 +30,12 @@ module.exports = [
23
30
  serial:{type:String,default:''},
24
31
  manf:{type:String,default:''},
25
32
 
26
- location:{type:String,default:''},
27
- area:{type:String,default:''},
33
+ location:{type:String,default:''},//remove, same as space / sub space
34
+ area:{type:String,default:''},//remove, same as space / sub space
28
35
 
29
36
  controls:{type:String,default:''},
30
37
  elec:{type:String,default:''},
31
38
 
32
-
33
39
  warr1:{type:Number,default:0},
34
40
  warr2:{type:Number,default:0},
35
41
  warr3:{type:Number,default:0},
@@ -45,5 +51,6 @@ module.exports = [
45
51
  filt2q:{type:String,default:'0'},
46
52
  filt3:{type:String,default:''},
47
53
  filt3q:{type:String,default:''}
48
- }
54
+ },
55
+ {minimize:false}
49
56
  ]
@@ -5,6 +5,5 @@ module.exports={
5
5
  PricingBEE:new Schema(...require('./schemas/pricingbee.js')),
6
6
  Pricing300:new Schema(...require('./schemas/pricing300.js')),
7
7
  Addition:new Schema(...require('./schemas/additions.js')),
8
- Finance:new Schema(...require('./schemas/financing.js')),
9
- Discount:new Schema(...require('./schemas/discounts.js'))
8
+ Finance:new Schema(...require('./schemas/financing.js'))
10
9
  }
@@ -2,24 +2,15 @@ module.exports=[
2
2
  {
3
3
  name:{type:String,default:''}, // pricebook / collection name
4
4
  notes:{type:String,default:''}, // versioned | table
5
- type:{type:String,default:''}, // the quote type ex. hvac | envelope | window
6
- cat:{type:String,default:''}, // department provided groupings
5
+ cat:{type:String,default:''}, // pkid | update date?
6
+ type:{type:String,default:''},
7
7
  mfg:{type:String,default:''},
8
8
  model:{type:String,default:''},
9
+ settings:{type:String,default:''},
10
+ location:{type:Array,default:[]},
9
11
  labor:{type:Number,default:0},
10
12
  laborpart:{type:Number,default:0},
11
- settings:{type:Object,default:{}},
12
- pricededuct:{type:Number,default:0}, //price to take off
13
- pricesale:{type:Number,default:0},
14
- userCreated:{type:Boolean,default:false}, //may not need, is really for gui
15
- tiers:{type:Array,default:[]} //may not need, is really for gui
13
+ price:{type:Number,default:0},
14
+ pricededuct:{type:Number,default:0}
16
15
  }
17
16
  ]
18
-
19
- /*
20
- settings = {
21
-
22
- location:{type:Array,default:[]},
23
- swap:{type:Array,default:[]}
24
- }
25
- */
@@ -1,18 +1,8 @@
1
-
2
- /*
3
- manf:[{
4
- manufacturer:{type:String,default:''},
5
- promoRate:{type:Number,default:''},
6
- credit:{type:Number,default:''}
7
- }]
8
- */
9
1
  module.exports=[
10
2
  {
11
- code:{type:String,default:''}, //the financing code
3
+ code:{type:String,default:''}, // pricebook / collection name
12
4
  stdRate:{type:String,default:''}, // versioned | table
13
5
  pymntFactor:{type:String,default:''}, // pkid | update date?
14
- dept:{type:Array,default:''},
15
- term:{type:String,default:''},
16
6
  desc:{type:String,default:''},
17
7
  min:{type:Number,default:0},
18
8
  max:{type:Number,default:0},
@@ -10,11 +10,7 @@ const { aaddress, acontact } = require('../../core-models.js');
10
10
  * photos:{type:Boolean},
11
11
  * scheduled:{type:Boolean}
12
12
  * }]
13
- */
14
-
15
- /**
16
- *
17
- */
13
+ */
18
14
  let pvmaint = new Schema({
19
15
  contractNum:{type:String,default:''},
20
16
  rewardNum:{type:String,default:''},
@@ -43,6 +39,7 @@ let lead = new Schema({
43
39
  })
44
40
  let info = new Schema({
45
41
  pkids:{type:Array,default:[]},
42
+ siteinfo:{type:Object,default:{}},
46
43
  spaces:{type:Object,default:[]},
47
44
  summary:{type:Object,default:{}},
48
45
  quotes:{type:Object,default:{}},
@@ -83,76 +80,7 @@ module.exports=[
83
80
  },
84
81
  {
85
82
  toJSON: { virtuals: true },
86
- toObject: { virtuals: true }
83
+ toObject: { virtuals: true },
84
+ minimize:false
87
85
  }
88
86
  ]
89
-
90
- /*
91
- constracts = [{
92
- contractid: contractid,
93
- jobnum: project.jobnum || '',
94
- jobname: project.name || '',
95
- solname: solution.name || '',
96
- name: solution.name || '',
97
- version: false,
98
- strtdate: null,
99
- solddate: null,
100
- sold: sold,
101
- estimator: project.estimator || '',
102
- dept: project.dept,
103
- type: solution.type || '', // not editable; helps determine which templates to use [string]
104
- path: path,
105
- hhid: project.hhid || '', // not editable; not shown anywhere
106
- custcode: project.custid || '', // not editable
107
- projectid: project.id || '',
108
- customer: { // all editable (besides longCity and fullName) [strings]
109
- clientFirst: project.clientfirst,
110
- clientLast: project.clientlast,
111
- name: `${project.clientfirst} ${project.clientlast}` || project.clientfirst || project.clientlast,
112
- street: project.street,
113
- unit: project.unit,
114
- city: project.city,
115
- state: project.state,
116
- zip: project.zip,
117
- longCity: project.city + ', ' + project.state + ' ' + project.zip,
118
- phone: project.phone,
119
- email: project.email
120
- },
121
- general:{
122
- net:0,
123
- projid:'',
124
- contractid:'',
125
- dept:''
126
- },
127
- subs:[], //list
128
- finance: {
129
- billto: '', // editable (searchable?) [string]
130
-
131
- net: 0, // editable [price]
132
-
133
- downAmount: 0, // editable [price]
134
- downDate: '', // editable [date]
135
- downVia: '', // editable ( check number | card last 4 | cash ) [string]
136
-
137
- financed: financed,
138
- fincode: '', // editable [string]
139
- finAmount: 0, // editable [price]
140
- finTerm: 0, // referenced from fintable via finCode string [number]
141
- finAPR: '', // referenced from fintable via finCode string [string]
142
-
143
- dueComplete: 0 // calculation (net - downAmount- dueComplete) [price]
144
- },
145
- discounts: [],
146
- additions: [],
147
- notes: '',
148
- terms: { // not editable; not shown on editor or preview, shown on print; gathered from table in settings [string]
149
- financing: '',
150
- collections: ''
151
- },
152
- solution: { // editablilty will depend on solution. will be blank if STANDARD contract
153
- //windows:[]
154
- //envelope:[]
155
- //vhc:[]
156
- }
157
- }]
158
- */
@@ -1,12 +1,32 @@
1
1
 
2
- const aticket = require('./subs/ticket.js')
2
+ const {aaddress}=require('../../core-models.js');
3
+ const wo = require('./subs/jonaswo.js')
4
+ const ticketFinal = require('./subs/final.js')
3
5
 
4
6
  module.exports = [
5
7
  {
6
- ...aticket,
8
+ id: { type: String, default: '' },
9
+ ref: { type: Object, default: {} },
7
10
  status: { type: String, default: 'active' },
11
+ techs: { type: Array, default: [] },
12
+ custid: {type:String, default:''},
13
+ cat:{type:String,default:''},
14
+ dept:{type:String,default:''},
15
+ hhid:{type:String,default:''},
16
+
17
+ ...aaddress,
8
18
  documents: { type: Array, default: [] },
9
- approval:{type:String,default:'WORKING'}, // WORKING | SENT | APPROVED
10
- approvalCode:{type:String,default:''}
11
- },{minimize:false}
19
+
20
+ checks: { type: Array, default: [] },
21
+ conform: { type: Object, default: {} },
22
+ contract: { type: Object, default: {} },
23
+ final: ticketFinal,
24
+ repairs: { type: Array, default: [] },
25
+ salesrep:{type:String,default:''},
26
+ sitems: { type: Array, default: [] },
27
+ wo: wo,
28
+ todo:{type:Object, default: {}},
29
+ office: { type: Object, default: {} },
30
+ logs:{type:Array,default:[]}
31
+ }
12
32
  ]
@@ -0,0 +1,40 @@
1
+
2
+ /*
3
+ input = { /GOOD
4
+ inputType:{type:String,default:''},
5
+ type:{type:String,default:''},
6
+ options:{type:Object,default:{}}
7
+ }
8
+
9
+ scoring = { /Good
10
+ cat:{type:Object,default:{}},
11
+ total:{type:Number,default:0},
12
+ type:{type:String,default:''},
13
+ points:{type:Array,default:[]}
14
+ }
15
+
16
+ calc = { /Good
17
+ id:{type:Array,default:[]},
18
+ depends:{type:Array,default:[]}
19
+ }
20
+
21
+
22
+ */
23
+ module.export=[{
24
+ id:{type:String,default:''},
25
+ title:{type:String,default:''},
26
+ desc:{type:String,default:''},
27
+ building:{type:String,default:''}, // COM | RES
28
+ input:{type:Object,default:{}},
29
+ //class:{type:String,default:''}, //remove is now id
30
+ group:{type:String,default:''},
31
+ subgroup:{type:String,default:''},
32
+ category:{type:String,default:''},
33
+ scoring:{type:Object,default:{}},
34
+ type:{type:Object,default:{}},
35
+ notes:{type:Object,default:{}},
36
+ required:{type:Boolean,default:true},
37
+ rewards:{type:Boolean,default:false},
38
+ present:{type:Boolean,default:true},
39
+ calc:{type:Object,default:{}}
40
+ },{minimize:false}]
@@ -0,0 +1,14 @@
1
+ module.exports = [{
2
+ name:{type:String,default:''},
3
+ title:{type:String,default:''},
4
+ desc:{type:String,default:''},
5
+ sitemTags:{type:Array,default:[]},
6
+ included:{type:Array,default:[]},
7
+ categories:{type:Array,default:[]},
8
+ grades:{type:Array,default:[]},
9
+ scored:{type:Boolean,default:false},
10
+ color:{type:String,default:''},
11
+ rewards:{type:Boolean,default:false},
12
+ enabled:{type:Boolean,default:true},
13
+ present:{type:Boolean,default:true}
14
+ }]
@@ -1,10 +1,32 @@
1
- const aticket = require('./subs/ticket.js')
2
1
 
2
+ const {aaddress}=require('../../core-models.js');
3
+ const wo = require('./subs/jonaswo.js')
4
+ const ticketFinal = require('./subs/final.js')
3
5
 
4
6
  module.exports = [
5
7
  {
6
- ...aticket,
8
+ id: { type: String, default: '' },
9
+ ref: { type: Object, default: {} },
7
10
  status: { type: String, default: 'complete' }, // active, complete, archived
8
- documents: { type: Array, default: [] } //could get rid of
11
+ techs: { type: Array, default: [] },
12
+ custid: {type:String, default:''},
13
+ cat:{type:String,default:''},
14
+ dept:{type:String,default:''},
15
+ hhid:{type:String,default:''},
16
+ documents: { type: Array, default: [] },
17
+
18
+ ...aaddress,
19
+
20
+ checks: { type: Array, default: [] },
21
+ conform: { type: Object, default: {} },
22
+ contract: { type: Object, default: {} },
23
+ final: ticketFinal,
24
+ repairs: { type: Array, default: [] },
25
+ salesrep:{type:String,default:''},
26
+ sitems: { type: Array, default: [] },
27
+ wo: wo,
28
+ todo:{type:Object, default: {}}, //remove
29
+ office: { type: Array, default: [] },
30
+ logs:{type:Array,default:[]}
9
31
  }
10
32
  ]
@@ -1,59 +1,35 @@
1
1
  const { Schema } = require('mongoose')
2
2
 
3
- let ticketInvoice = {
3
+ let ticketInvoice = new Schema({
4
4
  total:{type:Number,default:0},
5
5
  pricelevel:{type:String,default:''}
6
- }
7
-
8
- let repairEstimate = {
9
- time:{type:Number,default:0}, //time to complete all repairs
6
+ })
7
+ let ticketTime = new Schema({
8
+ driveTime:{type:Date,default:''},
9
+ startTime:{type:Date,default:''},
10
+ endTime:{type:Date,default:''},
11
+ adjustTime:{type:Number,default:0},
12
+ totalTime:{type:Number,default:0},
13
+ repairEstimate:{type:Number,default:0},
10
14
  revenuePerEstimate:{type:Number,default:0},
11
15
  revenuePer:{type:Number,default:0}
12
- }
16
+ })
13
17
 
14
- let ticketFinal = {
18
+ let ticketFinal = new Schema({
15
19
  showReplacement:{type:Boolean,default:false},
16
- summary:{type:Object,default:{}}, //a static version of the presentation
17
20
  conform:{type:Object,default:{}},
18
21
  invoice:ticketInvoice,
19
22
  signature:{type:String,default:''},
20
23
  emailed:{type:Boolean,default:false},
24
+ officeSubmit:{type:String,default:''},
21
25
  paymentMethod:{type:String,default:''},
22
- returnVisit:{type:String,default:''}, //change to String, and attach return ticket id
26
+ returnVisit:{type:Boolean,default:false},
23
27
  returnNotes:{type:String,default:''},
24
28
  addlDetails:{type:String,default:''},
25
29
  serviceReferral:{type:Boolean,default:false},
26
- repairEstimate:repairEstimate, //was ticketTime
30
+ ticketTime:ticketTime,
27
31
  timelog:{type:Object,default:{}},
28
- officeSubmit:{type:String,default:''},
29
- completedBy:{type:Array,default:[]} //change to string, lcoaland tag with the lead who completed
30
- }
31
-
32
- module.exports = ticketFinal
32
+ completedBy:{type:Array,default:[]}
33
+ })
33
34
 
34
- /*
35
- summary = {
36
- approved:{
37
- name:{type:String,default:''},
38
- signature:{type:String,default:''}
39
- }
40
- total:{
41
- mprice:{type:Number,default:0},
42
- rprice:{type:Number,default:0},
43
- msavings:{type:Number,default:0},
44
- rsavings:{type:Number,default:0}
45
- }
46
- repairs:{
47
- <sitem.id>:[{
48
- repair:{
49
- task:{type:String,default:''}
50
- appr:{type:String,default:''} // YES | NO | RETURNFOR
51
- }
52
- pricing:{
53
- <pl1>:{type:Number,default:0},
54
- <pl2>:{type:Number,default:0}
55
- }
56
- }]
57
- }
58
- }
59
- */
35
+ module.exports = ticketFinal
@@ -4,5 +4,7 @@ module.exports = {
4
4
  ActiveTicket:new Schema(...require('./schemas/activeticket.js')),
5
5
  CompleteTicket:new Schema(...require('./schemas/completeticket.js')),
6
6
  Spiff:new Schema(...require('./schemas/spiff.js')),
7
- SpiffReport:new Schema(...require('./schemas/spiffreport.js'))
7
+ SpiffReport:new Schema(...require('./schemas/spiffreport.js')),
8
+ ChecklistForm:new Schema(...require('./schemas/checklistform.js')),
9
+ ChecklistField:new Schema(...require('./schemas/checklistfield.js'))
8
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vhp-mongo-models",
3
- "version": "1.6.3",
3
+ "version": "1.7.1",
4
4
  "productName": "VHP Mongo Models",
5
5
  "description": "Mongo Models library to setup Mongoose Schemas",
6
6
  "author": "VHPim",
@@ -1,14 +0,0 @@
1
-
2
- module.exports=[
3
- {
4
- name:{type:String,default:''}, //unique
5
- type:{type:String,default:'instant'}, // instant | postpurchase | credit
6
- unit:{type:String,default:'dollar'}, // dollar | percent
7
- level:{type:String,default:'tier'}, // tier | solution | project
8
- amount:{type:Number,default:0},
9
- source:{type:String,default:''}, //needs further explaining to id the purpose
10
- notes:{type:String,default:''},
11
- userCreated:{type:Boolean,default:false}, //may not need, is really for gui
12
- tiers:{type:Array,default:[]} //may not need, is really for gui
13
- }
14
- ]
@@ -1,62 +0,0 @@
1
- const {aaddress}=require('../../../core-models.js');
2
- const wo = require('./jonaswo.js')
3
- const ticketFinal = require('./final.js')
4
-
5
- /* TECHINFO *
6
- [
7
- <user>:{
8
- name:{type:String,default:''},
9
- assigned:{type:Array,default:[{
10
- id:{type:String,default:''}, //the service item id
11
- name:{type:String,default:''},
12
- type:{type:String,default:''}, //describes the
13
- done:{type:String,default:false} //WORKING | READY | COMPLETE
14
- }]},
15
- driveTime:{type:Date,default:''},
16
- startTime:{type:Date,default:''},
17
- endTime:{type:Date,default:''},
18
- adjustTime:{type:Number,default:0},
19
- totalTime:{type:Number,default:0}
20
- }
21
- ]
22
- */
23
-
24
- /*
25
- sitems = [{
26
- id:{type:String,default:''}
27
- descr:{type:String,default:''}
28
- needReplace:{type:Boolean:default:false}
29
- }]
30
- */
31
-
32
- module.exports = {
33
- id: { type: String, default: '' },
34
- ref: { type: Object, default: {} },
35
- custid: {type:String, default:''},
36
- cat:{type:String,default:''}, //converted cat from jonas. Orginal cat can be found in wo.cat
37
- dept:{type:String,default:''},
38
-
39
- techs: { type: Array, default: [] },
40
- techinfo: {type:Object, default:{}}, //hold all info on techs involved
41
- salesrep:{type:String,default:''},
42
-
43
-
44
- hhid:{type:String,default:''},
45
- ...aaddress, //do not need?
46
-
47
-
48
- checks: { type: Object, default: {} },
49
- repairs: { type: Object, default: {} },
50
- sitems: { type: Array, default: [] },
51
-
52
- todo: {type:Object,default:{}},//used for all todos in workflow.
53
- //remove the following and merge into 'todo' with a type
54
- office: { type: Object, default: {} },//any todo items for the office
55
- field: {type:Object,default:{}},//any todo items for the field
56
-
57
- final: ticketFinal,
58
- contract: { type: Object, default: {} }, // the contract attached to the client. Should move off of WO into separate query
59
-
60
- wo: wo,
61
- logs:{type:Array,default:[]} //match with project datelog. Would like it to stay as "logs" though
62
- }