vhp-mongo-models 1.0.0 → 1.0.2

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.
@@ -8,6 +8,7 @@ module.exports=[
8
8
  devices: { type: Array, default: [] },
9
9
  active: { type: Boolean, default: true },
10
10
  admin: { type: Boolean, default: false },
11
- resetPswrd: { type: Date, default: '' }
11
+ resetPswrd: { type: Date, default: '' },
12
+ tier:{type:String,default:''}
12
13
  }
13
14
  ]
@@ -11,7 +11,6 @@ module.exports=[
11
11
  name: {type: String, default:''},
12
12
  number: {type:String,default:undefined},//is undefined to keep unique even if it is not filled in yet
13
13
  group: {type:String,default:''},
14
- active: {type:Boolean,default:true},
15
- type: {type:String,default:''}
14
+ active: {type:Boolean,default:true}
16
15
  }
17
16
  ]
@@ -3,6 +3,5 @@ const {Schema} = require('mongoose');
3
3
  module.exports = {
4
4
  Project:new Schema(...require('./schemas/projects.js')),
5
5
  Bid:new Schema(...require('./schemas/bid.js')),
6
- Tracking:new Schema(...require('./schemas/tracking.js')),
7
6
  Setting:new Schema(...require('./schemas/setting.js'))
8
7
  }
@@ -20,8 +20,9 @@ module.exports=[
20
20
  ...aaddress,
21
21
  ...acontact,
22
22
 
23
- estimator: { type: String, default: '' },
23
+ estimator: { type: String, default: 'unassigned' },
24
24
  techs: { type: Array, default: [] },
25
+ schedule:{type:Array, default:[]},
25
26
 
26
27
  dept: { type: String, default: '' },
27
28
  cat: { type: String, default: '' },
@@ -44,21 +45,18 @@ module.exports=[
44
45
  lead:{
45
46
  type:Object,
46
47
  default:{
47
- apptdate:{type:Date,default:''},
48
- prstdate:{type:Date,default:''},
49
- time:{type:String,default:''},
50
- carryover:{type:Date,default:''},
51
- prstvia:{type:String,default:''},
52
- time:{type:String,default:''},
53
- rewards:{type:Boolean,default:false},
54
- source:{type:String,default:''},
55
- generator:{type:String,default:''},
56
- paid:{type:Date,default:''}
48
+ apptdate:'',
49
+ prstdate:'',
50
+ time:'',
51
+ carryover:'',
52
+ prstvia:'',
53
+ rewards:false,
54
+ source:'',
55
+ generator:'',
56
+ paid:''
57
57
  }
58
58
  },
59
- trackid: { type: String, default: null },//holds doc id for tracking
60
- refs:{type:Array, default:[]}, //remove?
61
- wos:{type:Array, default:[]},
59
+ refs:{type:Array, default:[]},
62
60
 
63
61
  froot: { type: String, default: '' }
64
62
  },
@@ -0,0 +1,7 @@
1
+ const { Schema } = require('mongoose');
2
+
3
+
4
+ module.exports = {
5
+ Eomreport:new Schema(...require('./schemas/eomreports.js')),
6
+ Profile:new Schema(...require('./schemas/profiles.js'))
7
+ }
@@ -0,0 +1,10 @@
1
+ module.exports = [
2
+ {
3
+ report:{type: String, default:''},
4
+ type:{type: String, default:''},
5
+ month:{type:Number, default:''},
6
+ runDate:{type:Date, default:''},
7
+ dept:{type: String, default:''},
8
+ data:{type:Object, default:{}}
9
+ }
10
+ ]
@@ -0,0 +1,16 @@
1
+ module.exports = [
2
+ {
3
+ title:{type:String,default:''},//name
4
+ desc:{type:String,default:''},
5
+ report:{type: String, default:''},
6
+ coid:{type:String, default:''},
7
+ dept:{type: String, default:''},
8
+ type:{type: String, default:''},
9
+ access:{type:Array, default:''},
10
+ runDate:{type:Date},
11
+ runDay:{type:Number},
12
+ runLast:{type:Number},
13
+ pull:{type:Array, default:[]},
14
+ statics:{type:Object, default:{}}
15
+ }
16
+ ]
@@ -0,0 +1,91 @@
1
+
2
+ # Table of Contents
3
+ - [Employee](#employee)
4
+ - [Device](#device)
5
+ - [Account](#account)
6
+ - [SIM](#sim)
7
+
8
+
9
+ # Employee
10
+
11
+ ```javascript
12
+ {
13
+ empID: { type: String, default: '' },
14
+ coid: { type: String, default: '' },
15
+
16
+ fName: { type: String, default: '' },
17
+ lName: { type: String, default: '' },
18
+
19
+ dept: {type:String,default:''},
20
+ title: { type: String, default: '' },
21
+ type: { type: String, default: '' },
22
+ repTo: { type: String, default: '' }, // empID
23
+ jobDesc: { type: String, default: '' },
24
+ joined: { type: Date, default: '' },
25
+ bday: { type: Date, default: '' },
26
+ skills: { type: String, default: '' },
27
+ interest: { type: String, default: '' },
28
+ tasks: { type: Array,default:[] },
29
+ active:{ type: Boolean,default:true},
30
+ goals: { type: Array,default:[] },
31
+ picture: { type: String, default: '' },
32
+ }, {
33
+ toJSON: { virtuals: true },
34
+ toObject: { virtuals: true },
35
+ strictQuery: false,
36
+ timestamps: true
37
+ }
38
+ ```
39
+
40
+ # Device
41
+ ```javascript
42
+ {
43
+ devID: { type: String, default: '' },
44
+ empID: { type: String, default: '' },
45
+ name: { type: String, default: '' },
46
+ type: { type: String, default: '' },
47
+ manf: { type: String, default: '' },
48
+ model: { type: String, default: '' },
49
+ serial: { type: String, default: '' },
50
+ simRef: { type: String, default: '' },
51
+ imei:{type:String,default:''},
52
+ userName: { type: String, default: '' },
53
+ userLock: { type: String, default: '' },
54
+ lock: { type: String, default: '' },
55
+ purchasePrice: { type: Number, default: 0 },
56
+ purchaseDate: { type: Date, default: '' },
57
+ upgradeDate: { type: Date, default: '' },
58
+ notes:{type:String,default:''}
59
+ },{
60
+ toJSON: { virtuals: true },
61
+ toObject: { virtuals: true },
62
+ strictQuery: false
63
+ }
64
+ ```
65
+
66
+ # Account
67
+ ```javascript
68
+ {
69
+ empID: { type: String, default: '' },
70
+ type: { type: String, default: '' },
71
+ user: { type: String, default: '' }, // email || username
72
+ pswrd: { type: String, default: '' },
73
+ twoFactors: [{ type: String, contact: String }],
74
+ devices: { type: Array, default: [] },
75
+ active: { type: Boolean, default: true },
76
+ admin: { type: Boolean, default: false },
77
+ resetPswrd: { type: Date, default: '' }
78
+ }
79
+ ```
80
+
81
+ # SIM
82
+ ```javascript
83
+ {
84
+ iccid: { type: String, default: '' },
85
+ name: {type: String, default:''},
86
+ number: {type:String,default:undefined},//is undefined to keep unique even if it is not filled in yet
87
+ group: {type:String,default:''},
88
+ active: {type:Boolean,default:true},
89
+ type: {type:String,default:''}
90
+ }
91
+ ```
@@ -0,0 +1,19 @@
1
+ ## Address
2
+ ```javascript
3
+ {
4
+ street: { type: String, default: '' },
5
+ unit: { type: String, default: '' },
6
+ city: { type: String, default: '' },
7
+ state: { type: String, default: '' },
8
+ zip: { type: String, default: '' }
9
+ }
10
+ ```
11
+
12
+ ## Contact
13
+ ```javascript
14
+ {
15
+ contact:{type:String,default:''},
16
+ phone:{type:String,default:''},
17
+ email:{type:String,default:''}
18
+ }
19
+ ```
@@ -0,0 +1,89 @@
1
+ ## Table of Contents
2
+ - [Client](#client)
3
+ - [Home](#home)
4
+
5
+
6
+ # Client
7
+
8
+ ```javascript
9
+ // unique -> phone
10
+ {
11
+ coid:{type:String,default:''},
12
+ custCode : {type:String,default:''},
13
+ custName:{type:String,default:''},
14
+ fname: { type: String, default: '' },
15
+ lname: { type: String, default: '' },
16
+ contactName:{type:String,default:''},
17
+ phone: { type: String, default: '' }, // id
18
+ phone2: { type: String, default: '' },
19
+ email: { type: String, default: '' },
20
+
21
+ createDate: { type: String, default: '' },
22
+ lastTransaction: { type: String, default: '' },
23
+ salesRep: { type: String, default: '' }
24
+ }
25
+ ```
26
+
27
+ # Home
28
+
29
+ ```javascript
30
+ // unique -> hhid
31
+ {
32
+ hhid:{type:String,default:''},
33
+ street:{type:String,default:''},
34
+ unit:{type:String,default:''},
35
+ city:{type:String,default:''},
36
+ state:{type:String,default:''},
37
+ zip:{type:String,default:''},
38
+
39
+ lat:{type:Number,default:''},
40
+ lon:{type:Number,default:''},
41
+
42
+ custid:{type:String,default:''},
43
+
44
+ utilities:{type:Object,default:{
45
+ eleccomp:'',
46
+ gascomp:''
47
+ }},
48
+ activeProjects:{type:Array,default:[]},
49
+ activeService:{type:Array,default:[]},
50
+ measurements:{type:Object,default:{}},
51
+ features:{
52
+ elecService:{
53
+ panel:{type:String,default:''},
54
+ serviceSize:{type:String,default:''},
55
+ wireType:{type:String,default:''},
56
+ provider:{type:String,default:''}
57
+ },
58
+ gasService:{
59
+ provider:{type:String,default:''},
60
+ type:{type:String,default:''}
61
+ },
62
+ roof:{
63
+ roofTint:{type:String,default:''},
64
+ roofMake:{type:String,default:''},
65
+ pitch:{type:String,default:''},
66
+ gutters:{
67
+ material:{type:String,default:''},
68
+ feet:{type:Number,default:0}
69
+ }
70
+ },
71
+ waterheater:{
72
+ capacity:{type:Number,default:0},
73
+ btus:{type:Number,default:0},
74
+ type:{type:String,default:''},
75
+ condition:{type:Number,default:''}
76
+ },
77
+ foundation:{type:String,default:''},
78
+ frontFace:{type:String,default:''},
79
+ buildYear:{type:Number,default:0},
80
+ sqft:{type:Number,default:0},
81
+ floors:{type:Number,default:0},
82
+ baths:{type:Number,default:0},
83
+ rooms:{type:Number,default:0}
84
+ },
85
+ spaces:{type:Array,default:[]},
86
+ systems:{type:Array,default:[]},
87
+ froot:{type:String,default:''}
88
+ }
89
+ ```
package/docs/Logs.md ADDED
@@ -0,0 +1,22 @@
1
+
2
+ # Table of Contents
3
+ - [Server](#server)
4
+
5
+
6
+ # Server
7
+
8
+ ## schema
9
+ ```
10
+ {
11
+ id: { type: String, default: '' },
12
+ cat: { type: String, default: '' },
13
+ html: { type: Array, default: [] },
14
+ css: { type: Array, default: [] },
15
+ filename: { type: String, default: '' },
16
+ type: { type: String, default: '' },
17
+ contentType: { type: String, default: 'application/pdf' }
18
+ },
19
+ {
20
+ strict:false
21
+ }
22
+ ```
@@ -0,0 +1,43 @@
1
+ ## Table of Contents
2
+ - [Pvmaint](#pvmaint)
3
+
4
+ # Pvmaint
5
+
6
+ ```javascript
7
+ {
8
+ jobref: { type: String, default: '' },
9
+
10
+ contractNum: { type: String, default: '' },
11
+ custCode: { type: String, default: '' },
12
+ custName: { type: String, default: '' },
13
+
14
+ status: { type: String, default: 'A' },
15
+ renewed: { type: Boolean, default: false },
16
+
17
+ installers: { type: Array, default: [] },
18
+
19
+ street: { type: String, default: '' },
20
+ unit: { type: String, default: '' },
21
+ state: { type: String, default: '' },
22
+ zip: { type: String, default: '' },
23
+
24
+ phone: { type: String, default: '' },
25
+ email: { type: String, default: '' },
26
+
27
+ notes: { type: String, default: '' },
28
+
29
+ visits: { type: Array, default: [] },
30
+
31
+ coolingdate: { type: Date, default: '' },
32
+ coolingscheduled: { type: Boolean, default: false },
33
+ heatingdate: { type: Date, default: '' },
34
+ heatingscheduled: { type: Boolean, default: false },
35
+
36
+ //move to review section
37
+ coolingcheck: { type: Date, default: '' },
38
+ coolingphotos: { type: Boolean, default: false },
39
+
40
+ heatingphotos: { type: Boolean, default: false },
41
+ heatingcheck: { type: Date, default: '' }
42
+ }
43
+ ```
@@ -0,0 +1,42 @@
1
+ # Table of Contents
2
+ [PriceBook](#pricebook)
3
+ [Pricing350](#pricing350)
4
+ [PricingBEE](#pricingbee)
5
+
6
+
7
+
8
+ # PriceBook
9
+ ```javascript
10
+ // unique -> name
11
+ {
12
+ name:{type:String,default:''}, // pricebook / collection name
13
+ type:{type:String,default:''}, // versioned | table
14
+ current:{type:String,default:''}, // pkid | update date?
15
+ dept:{type:String,default:''},
16
+ user:{type:Array,default:[]}
17
+ }
18
+ ```
19
+
20
+ # Pricing350
21
+ ```javascript
22
+ {
23
+ {
24
+ version: { type: String, default: '' },
25
+ date: { type: Date, default: Date.now },
26
+ pkid: { type: String, default: '' }
27
+ },
28
+ {strict:false}
29
+ }
30
+ ```
31
+
32
+ # PricingBEE
33
+ ```javascript
34
+ {
35
+ {
36
+ version: { type: String, default: '' },
37
+ date: { type: Date, default: Date.now },
38
+ pkid: { type: String, default: '' }
39
+ },
40
+ {strict:false}
41
+ }
42
+ ```
package/docs/README.md ADDED
@@ -0,0 +1,16 @@
1
+ [Home](../../) | [CHANGELOG](CHANGELOG.md) | [VHP Portal](https://vhpportal.com) | [DEV Portal](https://dev.vhpportal.com)
2
+
3
+ This server is responsible for the following mongo databases
4
+
5
+ Schemas are organized by database, and then by collection.
6
+
7
+ - [Core Models](./CoreSchemas.md)
8
+ - [Company](./Company.md)
9
+ - [HouseHold](./HouseHold.md)
10
+ - [Systems](./Systems.md)
11
+ - [Logs](./Logs.md)
12
+ - [Replacement](./Replacement.md)
13
+ - [Service](./Service.md)
14
+ - [Memberships](./Memberships.md)
15
+ - [TaskManager](./TaskManager.md)
16
+ - [Pricing](./Pricing.md)
@@ -0,0 +1,196 @@
1
+ # Table of Contents
2
+ - [Project](#project)
3
+ - [Bid](#bid)
4
+ - [ProjectsBEE](#projectsbee)
5
+ - [Tracking](#tracking)
6
+ - [Pricing350](#pricing350)
7
+ - [PricingBEE](#pricingbee)
8
+
9
+
10
+ # Project
11
+
12
+ ## uses
13
+ - [aaddress](./CoreSchemas.md#Address)
14
+ - [acontact](./CoreSchemas.md#Contact)
15
+
16
+ ```javascript
17
+ {
18
+ {
19
+ id: { type: String, default: '' },
20
+ name: { type: String, default: '' },
21
+
22
+ jobnum: { type: String, default: '' },
23
+
24
+ hhid: { type: String, default: '' },
25
+ clientfirst: { type: String, default: '' },
26
+ clientlast: { type: String, default: '' },
27
+ ...aaddress,
28
+ ...acontact,
29
+
30
+ estimator: { type: String, default: '' },
31
+ techs: { type: Array, default: [] },
32
+
33
+ dept: { type: String, default: '' },
34
+ cat: { type: String, default: '' },
35
+
36
+ stage: { type: String, default: 'quote' },
37
+ status: { type: String, default: 'active' },
38
+
39
+
40
+ opendate: { type: Date, default: Date.now() },
41
+ lastdate: { type: Date, default: Date.now() },
42
+ solddate: { type: Date, default: '' },
43
+ scheddate: { type: Date, default: '' }, //get rid of eventually?
44
+ closedate: { type: Date, default: '' },
45
+
46
+ datelog: { type: Array, default: [] },
47
+
48
+ info: { type: Object, default: {} },
49
+ contracts:{type:Array, default:[]},
50
+
51
+ lead:{
52
+ type:Object,
53
+ default:{
54
+ apptdate:{type:Date,default:''},
55
+ prstdate:{type:Date,default:''},
56
+ time:{type:String,default:''},
57
+ carryover:{type:Boolean,default:false},
58
+ prstvia:{type:String,default:''},
59
+ rewards:{type:Boolean,default:false},
60
+ source:{type:String,default:''},
61
+ generator:{type:String,default:''},
62
+ paid:{type:Date,default:''}
63
+ }
64
+ },
65
+ trackid: { type: String, default: null },//holds doc id for tracking
66
+ refs:{type:Array, default:[]}, //remove?
67
+ wos:{type:Array, default:[]},
68
+
69
+ froot: { type: String, default: '' }
70
+ },
71
+ {
72
+ toJSON: { virtuals: true },
73
+ toObject: { virtuals: true }
74
+ }
75
+ }
76
+ ```
77
+
78
+ # Bid
79
+
80
+ ```javascript
81
+ {
82
+ {
83
+ projectId:{type:String,default:''}, //was ref
84
+ hhid:{type:String,default:''}, //new
85
+ dept:{type:String,default:''},
86
+ cat:{type:String,default:''},
87
+ type:{type:String,default:''},
88
+ bookprice:{type:Boolean,default:true},
89
+ amntTotal:{type:Number,default:0},
90
+ amntCust:{type:Number,default:0},
91
+ amntAmeren:{type:Number,default:0},
92
+ amntManf:{type:Number,default:0},
93
+ amntSpecial:{type:Number,default:0},
94
+ sold:{type:Date,default:''},
95
+ invoiced:{type:Date,default:''},
96
+ paid:{type:Date,default:''}
97
+ }
98
+ }
99
+ ```
100
+
101
+ # ProjectsBEE
102
+ ```javascript
103
+ {
104
+ id: {type:String,default:''},
105
+
106
+ ref: {type:String,default:''},
107
+ name: {type:String,default:''},
108
+
109
+ custid: {type:String,default:''},
110
+ street: {type:String,default:''},
111
+ unit: {type:String,default:''},
112
+ city: {type:String,default:''},
113
+ state: {type:String,default:''},
114
+ zip: {type:String,default:''},
115
+
116
+ customer: custcore,
117
+ estimator: {type:String,default:''},
118
+ installers: {type:Array,default:[]},
119
+
120
+ dept: {type:String,default:''},
121
+ cat: {type:String,default:''},
122
+
123
+ stage: {type:String,default:'quote'},
124
+ status: {type:String,default:'active'},
125
+
126
+ sold: {type:Boolean,default:false},
127
+
128
+ opendate: {type:Date,default:Date.now()},
129
+ lastdate: {type:Date,default:Date.now()},
130
+ scheddate: {type:Date,default:''},
131
+ closedate: {type:Date,default:''},
132
+
133
+ datelog: {type:Array,default:[]},
134
+
135
+ info: {type:Object,default:{}},
136
+
137
+ trackid: {type:String,default:null},//holds doc ids for tracking
138
+
139
+ froot: {type:String,default:''}
140
+ }
141
+ ```
142
+
143
+ # Tracking
144
+
145
+ ## uses
146
+ - [aaddress](./CoreSchemas.md#Address)
147
+ - [acontact](./CoreSchemas.md#Contact)
148
+
149
+ ```javascript
150
+ {
151
+ id: { type: String, default: '' }, // unique, given to item being tracked
152
+ projectname: { type: String, default: '' },
153
+ ref: { type: Array, default: [] },
154
+ estimator: { type: String, default: '' },
155
+
156
+ cancelled: { type: Boolean, default: false },
157
+ carryover: { type: Boolean, default: false },
158
+
159
+ bids: { type: Array, default: [] }, // holds list of bid items
160
+
161
+ stage: { type: String, default: '' }, // quote || job || archived
162
+ status: { type: String, default: '' }, //
163
+
164
+ clientfirst: { type: String, default: '' }, // moved so this block is "Job Info" while above is "Contact Info"
165
+ clientlast: {type: String, default:''},
166
+ ...aaddress,
167
+ ...acontact,
168
+
169
+ datelog: {
170
+ type: Array, default: [{
171
+ date: Date.now,
172
+ msg: 'Track Created'
173
+ }]
174
+ },//date of
175
+ apptdate: { type: Date, default: '' }, // was date
176
+ solddate: { type: Date, default: '' }, // should be there
177
+
178
+ time: { type: String, default: '' },
179
+ source: { type: String, default: '' },
180
+ generator: { type: String, default: '' },
181
+ prstvia: { type: String, default: null },
182
+ prstdate: { type: Date, default: Date.now },
183
+ rewards: { type: Boolean, default: false },
184
+
185
+ amount: { type: Number, default: 0 } // how are we saving the breakdown now (Ameren, Manf, etc.)?
186
+ }
187
+ ```
188
+
189
+ # Setting
190
+
191
+ ```javascript
192
+ {
193
+ schema:{},
194
+ options:{strict:false}
195
+ }
196
+ ```
@@ -0,0 +1,162 @@
1
+
2
+ - [ActiveTicket](#activetickets)
3
+ - [CompleteTicket](#completeticket)
4
+ - [ClosedTicket](#closedticket)
5
+ - [Spiff](#spiff)
6
+ - [SpiffReport](#spiffreport)
7
+
8
+
9
+ # ActiveTicket
10
+
11
+ ## uses
12
+ - [aaddress](./CoreSchemas.md#Address)
13
+
14
+ ## schema
15
+ ```
16
+ {
17
+ id: { type: String, default: '' },
18
+ ref: { type: Object, default: {} },
19
+ status: { type: String, default: 'active' }, // active, archived, invoice,
20
+ techs: { type: Array, default: [] },
21
+ custid: {type:String, default:''},
22
+ cat:{type:String,default:''},
23
+ dept:{type:String,default:''},
24
+ hhid:{type:String,default:''},
25
+
26
+ ...aaddress,
27
+ documents: { type: Array, default: [] },
28
+
29
+ checks: { type: Array, default: [] },
30
+ conform: { type: Object, default: {} },
31
+ contract: { type: Object, default: {} },
32
+ final: { type: Object, default: {} },
33
+ repairs: { type: Array, default: [] },
34
+ salesrep:{type:String,default:''},
35
+ sitems: { type: Array, default: [] },
36
+ wo: { type: Object, default: {} },
37
+ todo:{type:Object, default: {}},
38
+ office: { type: Object, default: {} },
39
+ logs:{type:Array,default:[]}
40
+ }
41
+ ```
42
+
43
+ # CompleteTicket
44
+
45
+ ## uses
46
+ - [aaddress](./CoreSchemas.md#Address)
47
+
48
+ ## schema
49
+ ```
50
+ {
51
+ id: { type: String, default: '' },
52
+ ref: { type: Object, default: {} },
53
+ status: { type: String, default: 'active' }, // active, archived, invoice,
54
+ techs: { type: Array, default: [] },
55
+ custid: {type:String, default:''},
56
+ cat:{type:String,default:''},
57
+ dept:{type:String,default:''},
58
+ hhid:{type:String,default:''},
59
+
60
+ ...aaddress,
61
+ documents: { type: Array, default: [] },
62
+
63
+ checks: { type: Array, default: [] },
64
+ conform: { type: Object, default: {} },
65
+ contract: { type: Object, default: {} },
66
+ final: { type: Object, default: {} },
67
+ repairs: { type: Array, default: [] },
68
+ salesrep:{type:String,default:''},
69
+ sitems: { type: Array, default: [] },
70
+ wo: { type: Object, default: {} },
71
+ todo:{type:Object, default: {}},
72
+ office: { type: Object, default: {} },
73
+ logs:{type:Array,default:[]}
74
+ }
75
+ ```
76
+
77
+ # ClosedTicket
78
+
79
+ ## uses
80
+ - [aaddress](./CoreSchemas.md#Address)
81
+
82
+ ## schema
83
+ ```
84
+ {
85
+ id: { type: String, default: '' },
86
+ ref: { type: Object, default: {} },
87
+ status: { type: String, default: 'active' }, // active, archived, invoice,
88
+ techs: { type: Array, default: [] },
89
+ custid: {type:String, default:''},
90
+ cat:{type:String,default:''},
91
+ dept:{type:String,default:''},
92
+ hhid:{type:String,default:''},
93
+
94
+ ...aaddress,
95
+ documents: { type: Array, default: [] },
96
+
97
+ checks: { type: Array, default: [] },
98
+ conform: { type: Object, default: {} },
99
+ contract: { type: Object, default: {} },
100
+ final: { type: Object, default: {} },
101
+ repairs: { type: Array, default: [] },
102
+ salesrep:{type:String,default:''},
103
+ sitems: { type: Array, default: [] },
104
+ wo: { type: Object, default: {} },
105
+ todo:{type:Object, default: {}},
106
+ office: { type: Object, default: {} },
107
+ logs:{type:Array,default:[]}
108
+ }
109
+ ```
110
+
111
+ # Spiff
112
+
113
+ ## schema
114
+ ```
115
+ {
116
+ FormID: { type: String, default: '' },
117
+ TechID: { type: String, default: '' },
118
+ TechLName: { type: String, default: '' },
119
+ TechFName: { type: String, default: '' },
120
+ Date: { type: Date, default: '' },
121
+ WO: { type: String, default: '' },
122
+ Address: { type: String, default: '' },
123
+ CustLName: { type: String, default: '' },
124
+ CustFName: { type: String, default: '' },
125
+ ReferTo: { type: String, default: '' },
126
+ SpiffFor: { type: String, default: '' },
127
+ status: { type: String, default: '' },
128
+ paid: { type: String, default: '' },
129
+ comments: { type: Array, default: [] },
130
+ closedate: { type: Date, default: '' },
131
+ reportmonth: { type: String, default: '' },
132
+ reportid: { type: String, default: '' },
133
+ lastdate: { type: Date, default: '' },
134
+ editor: { type: Array, defualt: [] },
135
+ reportStatus: { type: String, deafult: '' }
136
+ }
137
+ ```
138
+
139
+ # SpiffReport
140
+
141
+ ## schema
142
+ ```
143
+ {
144
+ id: { type: String, default: '' },
145
+ cleaned: { type: Boolean, default: false },
146
+ comInfo: {
147
+ type: Object, default: {
148
+ lost: 0,
149
+ approved: 0,
150
+ commission: 0,
151
+ open: 0,
152
+ submitted: 0
153
+ }
154
+ },
155
+ document: { type: Object, default: {} },
156
+ spiffTypes: { type: Object, default: {} },
157
+ closedate: { type: Date, default: '' },
158
+ month: { type: String, default: '' },
159
+ runner: { type: String, default: '' },
160
+ techs: { type: Object, default: {} }
161
+ }
162
+ ```
@@ -0,0 +1,68 @@
1
+ # Table of Contents
2
+ [User](#user)
3
+ [UserSetting](#usersettings)
4
+ [UserProfile](#userprofile)
5
+ [General](#general)
6
+ [Group](#group)
7
+ [App](#app)
8
+
9
+ # User
10
+
11
+ ```javascript
12
+ //unique -> user
13
+ {
14
+ id:{type:String,default:''},
15
+ user: {type:String,default:''},//unique
16
+ pswrd: {type:String,default:''},
17
+ lock: {type:Boolean,default:false}
18
+ }
19
+ ```
20
+ # UserSetting
21
+
22
+ ```javascript
23
+ {
24
+ empID:{type:String,default:''},
25
+ user:{type:String,defaullt:''},
26
+ type:{type:String,default:''},//optional to connect to a UserProfile
27
+ apps:{type:Object,default:{}},
28
+ admin:{type:Boolean,default:false},
29
+ permissions:{type:Array,default:[]}
30
+ },{
31
+ toJSON: { virtuals: true },
32
+ toObject: { virtuals: true }
33
+ }
34
+ ```
35
+
36
+ # UserProfile
37
+ ```javascript
38
+ {
39
+ type:{type:String,default:''},
40
+ apps:{type:Object,default:{}},
41
+ admin:{type:Boolean,default:false},
42
+ permissions:{type:Array,default:[]}
43
+ },{
44
+ toJSON: { virtuals: true },
45
+ toObject: { virtuals: true },
46
+ strictQuery: false,
47
+ }
48
+ ```
49
+
50
+ # General
51
+ ```javascript
52
+ {},{strict:false}
53
+ ```
54
+
55
+ # Group
56
+ ```javascript
57
+ {},{strict:false}
58
+ ```
59
+
60
+ # App
61
+ ```javascript
62
+ {
63
+ code:{type:String,default:''},
64
+ name:{type:String,default:''},
65
+ config:{type:Object,default:''},
66
+ views:{type:Array,default:[]}
67
+ }
68
+ ```
@@ -0,0 +1,108 @@
1
+
2
+ # Table of Contents
3
+ - [ActiveTask](#activetask)
4
+ - [FinishedTask](#finishedtask)
5
+ - [Workflow](#workflow)
6
+ - [Todo](#todo)
7
+
8
+
9
+ # ActiveTask
10
+ ```javascript
11
+ {
12
+ startdate: {type:Date, default:Date.now()},
13
+ duedate:{ type:Date,default:''},
14
+ finishdate:{ type:Date,default:''},
15
+
16
+ complete:{ type:Boolean,default:false},
17
+ level:{ type:String,default:'0'},//0-5
18
+
19
+ workflow:{type:String, default:''}, //id of workflow
20
+ flow: { type:String, default:''}, //id of flow in workflow
21
+ group: { type: String, default: '' }, // refering to database
22
+ work: { type: String, default: '' }, // refering to the collection
23
+ dept: { type: String, default: ''},
24
+ ref: { type: String, default: '' }, // refering to an item in the collection
25
+ type: { type: String, default: ''}, //to identify the type
26
+ assignees: { type: Array, default: [] },
27
+
28
+ checks: { type: Object, default: {} }, // for specific review checks
29
+
30
+ followup: { type: Boolean, default: false },
31
+ employees: { type: Array, default: [] },
32
+ notes: { type: String, default: '' },
33
+ notify: { type: Array, default: [] },
34
+ comments: { type: Array, default: [] },
35
+ logs: {// this is datelog in projects, should we align?
36
+ type: Array, default: [{
37
+ date: Date.now,
38
+ msg: 'Review Created'
39
+ }]
40
+ }
41
+ }
42
+ ```
43
+
44
+ # FinishedTask
45
+ ```javascript
46
+ {
47
+ startdate: {type:Date, default:Date.now()},
48
+ duedate:{ type:Date,default:''},
49
+ finishdate:{ type:Date,default:''},
50
+
51
+ complete:{ type:Boolean,default:false},
52
+ level:{ type:String,default:'0'},//0-5
53
+
54
+ workflow:{type:String, default:''}, //id of workflow
55
+ flow: { type:String, default:''}, //id of flow in workflow
56
+ group: { type: String, default: '' }, // refering to database
57
+ work: { type: String, default: '' }, // refering to the collection
58
+ dept: { type: String, default: ''},
59
+ ref: { type: String, default: '' }, // refering to an item in the collection
60
+ type: { type: String, default: ''}, //to identify the type
61
+ assignees: { type: Array, default: [] },
62
+
63
+ checks: { type: Object, default: {} }, // for specific review checks
64
+
65
+ followup: { type: Boolean, default: false },
66
+ employees: { type: Array, default: [] },
67
+ notes: { type: String, default: '' },
68
+ notify: { type: Array, default: [] },
69
+ comments: { type: Array, default: [] },
70
+ logs: {// this is datelog in projects, should we align?
71
+ type: Array, default: [{
72
+ date: Date.now,
73
+ msg: 'Review Created'
74
+ }]
75
+ }
76
+ }
77
+ ```
78
+
79
+ # Workflow
80
+ ```javascript
81
+ // unique -> id
82
+ {
83
+ id:{type:String,default:''},
84
+ name:{type:String,default:''},
85
+ dept:{type:String,default:''},
86
+ group:{type:String,default:''},
87
+ work:{type:String,default:''},
88
+ watchers:{type:Array,default:[]},//people responsible for the overall flow
89
+ workheaders:{type:Array,default:[]},
90
+ flow:{type:Array,default:[]}
91
+ }
92
+ ```
93
+
94
+ ## Todo
95
+ ```javascript
96
+ {
97
+ type:{type:String,default:''}, // work | watching
98
+ workflow:{type:String,default:''}
99
+
100
+ // type watching only -
101
+ // list:{type:Array,default:[]} // all of the active work
102
+
103
+ // type work only -
104
+ // todo:{type:Object,default:{}}
105
+ // ref: {type:String,default:''} // id of work
106
+ //
107
+ }
108
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vhp-mongo-models",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "productName": "VHP Mongo Models",
5
5
  "description": "Mongo Models library to setup Mongoose Schemas",
6
6
  "author": "VHPim",
@@ -9,7 +9,7 @@
9
9
  "main": "index.js",
10
10
  "scripts": {
11
11
  },
12
- "peerDependencies": {
12
+ "dependencies": {
13
13
  "mongoose": "^7.0.5"
14
14
  },
15
15
  "devDependencies": {
@@ -1,66 +0,0 @@
1
-
2
- const { aaddress, acontact } = require('../../core-models.js');
3
- /** ProjectBEE Schema
4
- *
5
- * index
6
- * - id - {unique:true,name:"id"}
7
- */
8
- module.exports=[
9
- {
10
- id: { type: String, default: '' },
11
- name: { type: String, default: '' },
12
-
13
- jobnum: { type: String, default: '' },
14
-
15
- hhid: { type: String, default: '' },
16
- clientfirst: { type: String, default: '' },
17
- clientlast: { type: String, default: '' },
18
- ...aaddress,
19
- ...acontact,
20
-
21
- estimator: { type: String, default: '' },
22
- techs: { type: Array, default: [] },
23
-
24
- dept: { type: String, default: '' },
25
- cat: { type: String, default: '' },
26
-
27
- stage: { type: String, default: 'quote' },
28
- status: { type: String, default: 'active' },
29
-
30
-
31
- opendate: { type: Date, default: Date.now() },
32
- lastdate: { type: Date, default: Date.now() },
33
- solddate: { type: Date, default: '' },
34
- scheddate: { type: Date, default: '' }, //get rid of eventually?
35
- closedate: { type: Date, default: '' },
36
-
37
- datelog: { type: Array, default: [] },
38
-
39
- info: { type: Object, default: {} },
40
- contracts:{type:Array, default:[]},
41
-
42
- lead:{
43
- type:Object,
44
- default:{
45
- apptdate:{type:Date,default:''},
46
- prstdate:{type:Date,default:''},
47
- time:{type:String,default:''},
48
- carryover:{type:Boolean,default:false},
49
- prstvia:{type:String,default:''},
50
- rewards:{type:Boolean,default:false},
51
- source:{type:String,default:''},
52
- generator:{type:String,default:''},
53
- paid:{type:Date,default:''}
54
- }
55
- },
56
- trackid: { type: String, default: null },//holds doc id for tracking
57
- refs:{type:Array, default:[]}, //remove?
58
- wos:{type:Array, default:[]},
59
-
60
- froot: { type: String, default: '' }
61
- },
62
- {
63
- toJSON: { virtuals: true },
64
- toObject: { virtuals: true }
65
- }
66
- ]
@@ -1,48 +0,0 @@
1
-
2
- const { aaddress, acontact } = require('../../core-models.js');
3
-
4
- /** Tracking Scheme
5
- *
6
- * index
7
- * - id - {unique:true,name:"id"}
8
- */
9
- module.exports=[
10
- {
11
- id: { type: String, default: '' }, // unique, given to item being tracked
12
- projectname: { type: String, default: '' },
13
- ref: { type: Array, default: [] },
14
- estimator: { type: String, default: '' },
15
-
16
- cancelled: { type: Boolean, default: false },
17
- carryover: { type: Boolean, default: false },
18
-
19
- bids: { type: Array, default: [] }, // holds list of bid items
20
-
21
- stage: { type: String, default: '' }, // quote || job || archived
22
- status: { type: String, default: '' }, //
23
-
24
- clientfirst: { type: String, default: '' }, // moved so this block is "Job Info" while above is "Contact Info"
25
- clientlast: { type: String, default: '' },
26
- ...aaddress,
27
- ...acontact,
28
-
29
- datelog: {
30
- type: Array, default: [{
31
- date: Date.now,
32
- msg: 'Track Created'
33
- }]
34
- },//date of
35
- apptdate: { type: Date, default: '' }, // was date
36
- solddate: { type: Date, default: '' }, // should be there
37
-
38
- time: { type: String, default: '' },
39
- source: { type: String, default: '' },
40
- generator: { type: String, default: '' }, // changed from "lead"; will need a cleanup!
41
- //leadref: { type: String, default: '' }, // now directly part of generator
42
- prstvia: { type: String, default: null },
43
- prstdate: { type: Date, default: Date.now },
44
- rewards: { type: Boolean, default: false },
45
-
46
- amount: { type: Number, default: 0 } // how are we saving the breakdown now (Ameren, Manf, etc.)?
47
- }
48
- ]