vhp-mongo-models 1.0.0
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.
- package/Company/company.js +30 -0
- package/Company/schemas/account.js +13 -0
- package/Company/schemas/device.js +30 -0
- package/Company/schemas/employee.js +34 -0
- package/Company/schemas/sim.js +17 -0
- package/Document/document.js +6 -0
- package/Document/schemas/replacement.js +14 -0
- package/Document/schemas/service.js +14 -0
- package/HouseHolds/households.js +8 -0
- package/HouseHolds/schemas/client.js +18 -0
- package/HouseHolds/schemas/home.js +60 -0
- package/HouseHolds/schemas/serviceitem.js +10 -0
- package/HouseHolds/schemas/siupdate.js +27 -0
- package/HouseHolds/schemas/system.js +10 -0
- package/Logs/logs.js +5 -0
- package/Logs/schemas/server.js +14 -0
- package/Memberships/memberships.js +6 -0
- package/Memberships/schemas/pvmaint.js +38 -0
- package/Memberships/schemas/rewardmem.js +4 -0
- package/Pricing/pricing.js +7 -0
- package/Pricing/schemas/pricebook.js +9 -0
- package/Pricing/schemas/pricing300.js +8 -0
- package/Pricing/schemas/pricing350.js +8 -0
- package/Pricing/schemas/pricingbee.js +8 -0
- package/Replacement/replacement.js +8 -0
- package/Replacement/schemas/bid.js +18 -0
- package/Replacement/schemas/projectbee.js +66 -0
- package/Replacement/schemas/projects.js +69 -0
- package/Replacement/schemas/setting.js +4 -0
- package/Replacement/schemas/tracking.js +48 -0
- package/Service/schemas/activeticket.js +31 -0
- package/Service/schemas/completeticket.js +31 -0
- package/Service/schemas/spiff.js +24 -0
- package/Service/schemas/spiffreport.js +21 -0
- package/Service/service.js +8 -0
- package/Systems/schemas/app.js +8 -0
- package/Systems/schemas/general.js +4 -0
- package/Systems/schemas/group.js +4 -0
- package/Systems/schemas/user.js +9 -0
- package/Systems/schemas/userprofile.js +13 -0
- package/Systems/schemas/usersetting.js +14 -0
- package/Systems/systems.js +25 -0
- package/TaskManager/schemas/activetask.js +33 -0
- package/TaskManager/schemas/finishedtask.js +33 -0
- package/TaskManager/schemas/todo.js +14 -0
- package/TaskManager/schemas/workflow.js +12 -0
- package/TaskManager/taskmanager.js +8 -0
- package/core-models.js +17 -0
- package/index.js +15 -0
- package/old/CompanySchemes.js +107 -0
- package/old/DocumentSchemes.js +30 -0
- package/old/HistorySchemes.js +39 -0
- package/old/HouseHoldSchemes.js +93 -0
- package/old/LogSchemes.js +14 -0
- package/old/MembershipsSchemes.js +48 -0
- package/old/PricingSchemes.js +15 -0
- package/old/ReplacementSchemes.js +194 -0
- package/old/ReportingSchemes.js +5 -0
- package/old/ServiceItems.js +21 -0
- package/old/ServiceSchemes.js +35 -0
- package/old/SpiffSchemes.js +49 -0
- package/old/SystemsSchemes.js +71 -0
- package/old/WorkFlowSchemes.js +69 -0
- package/old/spares.js +22 -0
- package/package.json +19 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const { Schema } = require('mongoose');
|
|
2
|
+
|
|
3
|
+
/**PVmaints
|
|
4
|
+
*
|
|
5
|
+
* index
|
|
6
|
+
* - contractNum - {unique:true,name:"contractNum"}
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
module.exports={
|
|
11
|
+
PVmaint: new Schema({
|
|
12
|
+
jobref: { type: String, default: '' },
|
|
13
|
+
|
|
14
|
+
contractNum: { type: String, default: '' },
|
|
15
|
+
custCode: { type: String, default: '' },
|
|
16
|
+
custName: { type: String, default: '' },
|
|
17
|
+
|
|
18
|
+
status: { type: String, default: 'A' },
|
|
19
|
+
renewed: { type: Boolean, default: false },
|
|
20
|
+
|
|
21
|
+
installers: { type: Array, default: [] },
|
|
22
|
+
|
|
23
|
+
street: { type: String, default: '' },
|
|
24
|
+
unit: { type: String, default: '' },
|
|
25
|
+
state: { type: String, default: '' },
|
|
26
|
+
zip: { type: String, default: '' },
|
|
27
|
+
|
|
28
|
+
phone: { type: String, default: '' },
|
|
29
|
+
email: { type: String, default: '' },
|
|
30
|
+
|
|
31
|
+
notes: { type: String, default: '' },
|
|
32
|
+
|
|
33
|
+
visits: { type: Array, default: [] },
|
|
34
|
+
|
|
35
|
+
coolingdate: { type: Date, default: '' },
|
|
36
|
+
coolingscheduled: { type: Boolean, default: false },
|
|
37
|
+
heatingdate: { type: Date, default: '' },
|
|
38
|
+
heatingscheduled: { type: Boolean, default: false },
|
|
39
|
+
|
|
40
|
+
//move to review section
|
|
41
|
+
coolingcheck: { type: Date, default: '' },
|
|
42
|
+
coolingphotos: { type: Boolean, default: false },
|
|
43
|
+
|
|
44
|
+
heatingphotos: { type: Boolean, default: false },
|
|
45
|
+
heatingcheck: { type: Date, default: '' }
|
|
46
|
+
}),
|
|
47
|
+
RewardMem:new Schema({},{strict:false})
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { Schema } = require('mongoose');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Geared toward Price Keys
|
|
5
|
+
* Do we need something more general?
|
|
6
|
+
*/
|
|
7
|
+
var pricingCore = {
|
|
8
|
+
version: { type: String, default: '' },
|
|
9
|
+
date: { type: Date, default: Date.now },
|
|
10
|
+
pkid: { type: String, default: '' }
|
|
11
|
+
}
|
|
12
|
+
module.exports = {
|
|
13
|
+
Pricing350: new Schema({ ...pricingCore }, { strict: false }),
|
|
14
|
+
PricingBEE: new Schema({ ...pricingCore }, { strict: false }),
|
|
15
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
const { Schema } = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const { aaddress, acontact } = require('./core-models.js');
|
|
4
|
+
|
|
5
|
+
var projectCoreBEE = {
|
|
6
|
+
id: { type: String, default: '' },
|
|
7
|
+
name: { type: String, default: '' },
|
|
8
|
+
|
|
9
|
+
jobnum: { type: String, default: '' },
|
|
10
|
+
|
|
11
|
+
custid: { type: String, default: '' },
|
|
12
|
+
street: { type: String, default: '' },
|
|
13
|
+
unit: { type: String, default: '' },
|
|
14
|
+
city: { type: String, default: '' },
|
|
15
|
+
state: { type: String, default: '' },
|
|
16
|
+
zip: { type: String, default: '' },
|
|
17
|
+
|
|
18
|
+
customer: {
|
|
19
|
+
id: { type: String, default: '' },
|
|
20
|
+
name: { type: String, default: '' }, // do we need to make this a virtual instead?
|
|
21
|
+
fname: { type: String, default: '' },
|
|
22
|
+
lname: { type: String, default: '' },
|
|
23
|
+
street: { type: String, default: '' },
|
|
24
|
+
unit: { type: String, default: '' },
|
|
25
|
+
city: { type: String, default: '' },
|
|
26
|
+
state: { type: String, default: '' },
|
|
27
|
+
zip: { type: String, default: '' },
|
|
28
|
+
strdate: { type: String, default: '' },
|
|
29
|
+
lastsale: { type: String, default: '' },
|
|
30
|
+
type: { type: String, default: '' },
|
|
31
|
+
phone: { type: String, default: '' },
|
|
32
|
+
phone2: { type: String, default: '' },
|
|
33
|
+
email: { type: String, default: '' },
|
|
34
|
+
rep: { type: String, default: '' } // we have this info, but we never fill this
|
|
35
|
+
},
|
|
36
|
+
estimator: { type: String, default: '' },
|
|
37
|
+
installers: { type: Array, default: [] },
|
|
38
|
+
|
|
39
|
+
dept: { type: String, default: '' },
|
|
40
|
+
cat: { type: String, default: '' },
|
|
41
|
+
|
|
42
|
+
stage: { type: String, default: 'quote' },
|
|
43
|
+
status: { type: String, default: 'active' },
|
|
44
|
+
|
|
45
|
+
sold: { type: Boolean, default: false },
|
|
46
|
+
|
|
47
|
+
opendate: { type: Date, default: Date.now() },
|
|
48
|
+
lastdate: { type: Date, default: Date.now() },
|
|
49
|
+
scheddate: { type: Date, default: '' },
|
|
50
|
+
closedate: { type: Date, default: '' },
|
|
51
|
+
|
|
52
|
+
datelog: { type: Array, default: [] },
|
|
53
|
+
|
|
54
|
+
info: { type: Object, default: {} },
|
|
55
|
+
|
|
56
|
+
trackid: { type: String, default: null },//holds doc ids for tracking
|
|
57
|
+
|
|
58
|
+
froot: { type: String, default: '' }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
Am not going to have an index in case there is a need for two
|
|
63
|
+
items with the same job ref
|
|
64
|
+
*/
|
|
65
|
+
/** Projects Schema
|
|
66
|
+
*
|
|
67
|
+
* index
|
|
68
|
+
* - id - {unique:true,name:"id"}
|
|
69
|
+
*/
|
|
70
|
+
/** Tracking Scheme
|
|
71
|
+
*
|
|
72
|
+
* index
|
|
73
|
+
* - id - {unique:true,name:"id"}
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
const projectCore = {
|
|
77
|
+
id: { type: String, default: '' },
|
|
78
|
+
name: { type: String, default: '' },
|
|
79
|
+
|
|
80
|
+
jobnum: { type: String, default: '' },
|
|
81
|
+
|
|
82
|
+
hhid: { type: String, default: '' },
|
|
83
|
+
clientfirst: { type: String, default: '' },
|
|
84
|
+
clientlast: { type: String, default: '' },
|
|
85
|
+
...aaddress,
|
|
86
|
+
...acontact,
|
|
87
|
+
|
|
88
|
+
estimator: { type: String, default: '' },
|
|
89
|
+
techs: { type: Array, default: [] },
|
|
90
|
+
|
|
91
|
+
dept: { type: String, default: '' },
|
|
92
|
+
cat: { type: String, default: '' },
|
|
93
|
+
|
|
94
|
+
stage: { type: String, default: 'quote' },
|
|
95
|
+
status: { type: String, default: 'active' },
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
opendate: { type: Date, default: Date.now() },
|
|
99
|
+
lastdate: { type: Date, default: Date.now() },
|
|
100
|
+
solddate: { type: Date, default: '' },
|
|
101
|
+
scheddate: { type: Date, default: '' }, //get rid of eventually?
|
|
102
|
+
closedate: { type: Date, default: '' },
|
|
103
|
+
|
|
104
|
+
datelog: { type: Array, default: [] },
|
|
105
|
+
|
|
106
|
+
info: { type: Object, default: {} },
|
|
107
|
+
contracts:{type:Array, default:[]},
|
|
108
|
+
|
|
109
|
+
lead:{
|
|
110
|
+
type:Object,
|
|
111
|
+
default:{
|
|
112
|
+
apptdate:{type:Date,default:''},
|
|
113
|
+
prstdate:{type:Date,default:''},
|
|
114
|
+
time:{type:String,default:''},
|
|
115
|
+
carryover:{type:Boolean,default:false},
|
|
116
|
+
prstvia:{type:String,default:''},
|
|
117
|
+
rewards:{type:Boolean,default:false},
|
|
118
|
+
source:{type:String,default:''},
|
|
119
|
+
generator:{type:String,default:''},
|
|
120
|
+
paid:{type:Date,default:''}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
trackid: { type: String, default: null },//holds doc id for tracking
|
|
124
|
+
refs:{type:Array, default:[]}, //remove?
|
|
125
|
+
wos:{type:Array, default:[]},
|
|
126
|
+
|
|
127
|
+
froot: { type: String, default: '' }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
module.exports = {
|
|
131
|
+
Project: new Schema({ ...projectCore }, {
|
|
132
|
+
toJSON: { virtuals: true },
|
|
133
|
+
toObject: { virtuals: true }
|
|
134
|
+
}),
|
|
135
|
+
Bid: new Schema({
|
|
136
|
+
projectId:{type:String,default:''}, //was ref
|
|
137
|
+
hhid:{type:String,default:''}, //new
|
|
138
|
+
dept:{type:String,default:''},
|
|
139
|
+
cat:{type:String,default:''},
|
|
140
|
+
type:{type:String,default:''},
|
|
141
|
+
bookprice:{type:Boolean,default:true},
|
|
142
|
+
amntTotal:{type:Number,default:0},
|
|
143
|
+
amntCust:{type:Number,default:0},
|
|
144
|
+
amntAmeren:{type:Number,default:0},
|
|
145
|
+
amntManf:{type:Number,default:0},
|
|
146
|
+
amntSpecial:{type:Number,default:0},
|
|
147
|
+
sold:{type:Date,default:''},
|
|
148
|
+
invoiced:{type:Date,default:''},
|
|
149
|
+
paid:{type:Date,default:''}
|
|
150
|
+
}),
|
|
151
|
+
ProjectsBEE: new Schema({ ...projectCore }, {
|
|
152
|
+
toJSON: { virtuals: true },
|
|
153
|
+
toObject: { virtuals: true },
|
|
154
|
+
}),
|
|
155
|
+
Tracking: new Schema({
|
|
156
|
+
id: { type: String, default: '' }, // unique, given to item being tracked
|
|
157
|
+
projectname: { type: String, default: '' },
|
|
158
|
+
ref: { type: Array, default: [] },
|
|
159
|
+
estimator: { type: String, default: '' },
|
|
160
|
+
|
|
161
|
+
cancelled: { type: Boolean, default: false },
|
|
162
|
+
carryover: { type: Boolean, default: false },
|
|
163
|
+
|
|
164
|
+
bids: { type: Array, default: [] }, // holds list of bid items
|
|
165
|
+
|
|
166
|
+
stage: { type: String, default: '' }, // quote || job || archived
|
|
167
|
+
status: { type: String, default: '' }, //
|
|
168
|
+
|
|
169
|
+
clientfirst: { type: String, default: '' }, // moved so this block is "Job Info" while above is "Contact Info"
|
|
170
|
+
clientlast: { type: String, default: '' },
|
|
171
|
+
...aaddress,
|
|
172
|
+
...acontact,
|
|
173
|
+
|
|
174
|
+
datelog: {
|
|
175
|
+
type: Array, default: [{
|
|
176
|
+
date: Date.now,
|
|
177
|
+
msg: 'Track Created'
|
|
178
|
+
}]
|
|
179
|
+
},//date of
|
|
180
|
+
apptdate: { type: Date, default: '' }, // was date
|
|
181
|
+
solddate: { type: Date, default: '' }, // should be there
|
|
182
|
+
|
|
183
|
+
time: { type: String, default: '' },
|
|
184
|
+
source: { type: String, default: '' },
|
|
185
|
+
generator: { type: String, default: '' }, // changed from "lead"; will need a cleanup!
|
|
186
|
+
//leadref: { type: String, default: '' }, // now directly part of generator
|
|
187
|
+
prstvia: { type: String, default: null },
|
|
188
|
+
prstdate: { type: Date, default: Date.now },
|
|
189
|
+
rewards: { type: Boolean, default: false },
|
|
190
|
+
|
|
191
|
+
amount: { type: Number, default: 0 } // how are we saving the breakdown now (Ameren, Manf, etc.)?
|
|
192
|
+
}),
|
|
193
|
+
Setting: new Schema({}, { strict: false })
|
|
194
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const { Schema } = mongoose;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
this schema needs addition properties, but
|
|
7
|
+
its here for testing. The current structure
|
|
8
|
+
is more of suggestions
|
|
9
|
+
*/
|
|
10
|
+
var sichecklist = {
|
|
11
|
+
custcode: { type: String, default: '' },
|
|
12
|
+
ref: { type: String, default: '' },
|
|
13
|
+
date: { type: Date, default: '' },
|
|
14
|
+
|
|
15
|
+
sitems: { type: Array, default: [] },
|
|
16
|
+
checkinfo: { type: String, default: '' }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
SIchecklist: new Schema({ ...sichecklist })
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const { Schema } = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const {aaddress}=require('./core-models.js');
|
|
4
|
+
|
|
5
|
+
var ticketCore = {
|
|
6
|
+
id: { type: String, default: '' },
|
|
7
|
+
ref: { type: Object, default: {} },
|
|
8
|
+
status: { type: String, default: 'active' }, // active, archived, invoice,
|
|
9
|
+
techs: { type: Array, default: [] },
|
|
10
|
+
custid: {type:String, default:''},
|
|
11
|
+
cat:{type:String,default:''},
|
|
12
|
+
dept:{type:String,default:''},
|
|
13
|
+
hhid:{type:String,default:''},
|
|
14
|
+
|
|
15
|
+
...aaddress,
|
|
16
|
+
documents: { type: Array, default: [] },
|
|
17
|
+
|
|
18
|
+
checks: { type: Array, default: [] },
|
|
19
|
+
conform: { type: Object, default: {} },
|
|
20
|
+
contract: { type: Object, default: {} },
|
|
21
|
+
final: { type: Object, default: {} },
|
|
22
|
+
repairs: { type: Array, default: [] },
|
|
23
|
+
salesrep:{type:String,default:''},
|
|
24
|
+
sitems: { type: Array, default: [] },
|
|
25
|
+
wo: { type: Object, default: {} },
|
|
26
|
+
todo:{type:Object, default: {}},
|
|
27
|
+
office: { type: Object, default: {} },
|
|
28
|
+
logs:{type:Array,default:[]}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = {
|
|
32
|
+
ActiveTicket: new Schema({...ticketCore},{}),
|
|
33
|
+
CompleteTicket: new Schema({...ticketCore},{}),
|
|
34
|
+
ClosedTicket: new Schema({...ticketCore},{})
|
|
35
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const { Schema } = require('mongoose');
|
|
2
|
+
|
|
3
|
+
var Spiff = new Schema({
|
|
4
|
+
FormID: { type: String, default: '' },
|
|
5
|
+
TechID: { type: String, default: '' },
|
|
6
|
+
TechLName: { type: String, default: '' },
|
|
7
|
+
TechFName: { type: String, default: '' },
|
|
8
|
+
Date: { type: Date, default: '' },
|
|
9
|
+
WO: { type: String, default: '' },
|
|
10
|
+
Address: { type: String, default: '' },
|
|
11
|
+
CustLName: { type: String, default: '' },
|
|
12
|
+
CustFName: { type: String, default: '' },
|
|
13
|
+
ReferTo: { type: String, default: '' },
|
|
14
|
+
SpiffFor: { type: String, default: '' },
|
|
15
|
+
status: { type: String, default: '' },
|
|
16
|
+
paid: { type: String, default: '' },
|
|
17
|
+
comments: { type: Array, default: [] },
|
|
18
|
+
closedate: { type: Date, default: '' },
|
|
19
|
+
reportmonth: { type: String, default: '' },
|
|
20
|
+
reportid: { type: String, default: '' },
|
|
21
|
+
lastdate: { type: Date, default: '' },
|
|
22
|
+
editor: { type: Array, defualt: [] },
|
|
23
|
+
reportStatus: { type: String, deafult: '' }
|
|
24
|
+
}, {});
|
|
25
|
+
|
|
26
|
+
var SpiffReport = new Schema({
|
|
27
|
+
id: { type: String, default: '' },
|
|
28
|
+
cleaned: { type: Boolean, default: false },
|
|
29
|
+
comInfo: {
|
|
30
|
+
type: Object, default: {
|
|
31
|
+
lost: 0,
|
|
32
|
+
approved: 0,
|
|
33
|
+
commission: 0,
|
|
34
|
+
open: 0,
|
|
35
|
+
submitted: 0
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
document: { type: Object, default: {} },
|
|
39
|
+
spiffTypes: { type: Object, default: {} },
|
|
40
|
+
closedate: { type: Date, default: '' },
|
|
41
|
+
month: { type: String, default: '' },
|
|
42
|
+
runner: { type: String, default: '' },
|
|
43
|
+
techs: { type: Object, default: {} }
|
|
44
|
+
}, {});
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
Spiff,
|
|
48
|
+
SpiffReport
|
|
49
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const { Schema } = require('mongoose');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const UserSetting = new Schema({
|
|
5
|
+
empID:{type:String,default:''},
|
|
6
|
+
user:{type:String,defaullt:''},
|
|
7
|
+
type:{type:String,default:''},//optional to connect to a UserProfile
|
|
8
|
+
apps:{type:Object,default:{}},
|
|
9
|
+
admin:{type:Boolean,default:false},
|
|
10
|
+
permissions:{type:Array,default:[]}
|
|
11
|
+
},{
|
|
12
|
+
toJSON: { virtuals: true },
|
|
13
|
+
toObject: { virtuals: true }
|
|
14
|
+
})
|
|
15
|
+
UserSetting.virtual('profile',{
|
|
16
|
+
ref:'UserProfile',
|
|
17
|
+
localField:'type',
|
|
18
|
+
foreignField:'type'
|
|
19
|
+
})
|
|
20
|
+
UserSetting.virtual('employee',{
|
|
21
|
+
ref:'Employee',
|
|
22
|
+
localField:'empID',
|
|
23
|
+
foreignField:'empID'
|
|
24
|
+
})
|
|
25
|
+
const UserProfile = new Schema({
|
|
26
|
+
type:{type:String,default:''},
|
|
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
|
+
strictQuery: false,
|
|
34
|
+
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
App Schemes
|
|
39
|
+
|
|
40
|
+
Holds all
|
|
41
|
+
- app index - {
|
|
42
|
+
{
|
|
43
|
+
name:RRB
|
|
44
|
+
group:String,
|
|
45
|
+
work:String
|
|
46
|
+
cat:[]
|
|
47
|
+
views:[]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
- app settings - {
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
*/
|
|
54
|
+
module.exports={
|
|
55
|
+
User:new Schema({
|
|
56
|
+
id:{type:String,default:''},//unique?
|
|
57
|
+
user: {type:String,default:''},//unique
|
|
58
|
+
pswrd: {type:String,default:''},
|
|
59
|
+
lock: {type:Boolean,default:false}
|
|
60
|
+
}),
|
|
61
|
+
UserSetting:UserSetting,
|
|
62
|
+
UserProfile:UserProfile,
|
|
63
|
+
App: new Schema({
|
|
64
|
+
code:{type:String,default:''},
|
|
65
|
+
name:{type:String,default:''},
|
|
66
|
+
config:{type:Object,default:''},
|
|
67
|
+
views:{type:Array,default:[]}
|
|
68
|
+
}),
|
|
69
|
+
General: new Schema({}, {strict:false}),
|
|
70
|
+
Group: new Schema({}, {strict:false})
|
|
71
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const { Schema } = mongoose;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var TaskCore = {
|
|
6
|
+
startdate: {type:Date, default:Date.now()},
|
|
7
|
+
duedate:{ type:Date,default:''},
|
|
8
|
+
finishdate:{ type:Date,default:''},
|
|
9
|
+
|
|
10
|
+
complete:{ type:Boolean,default:false},
|
|
11
|
+
level:{ type:String,default:'0'},//0-5
|
|
12
|
+
|
|
13
|
+
workflow:{type:String, default:''}, //id of workflow
|
|
14
|
+
flow: { type:String, default:''}, //id of flow in workflow
|
|
15
|
+
group: { type: String, default: '' }, // refering to database
|
|
16
|
+
work: { type: String, default: '' }, // refering to the collection
|
|
17
|
+
dept: { type: String, default: ''},
|
|
18
|
+
ref: { type: String, default: '' }, // refering to an item in the collection
|
|
19
|
+
type: { type: String, default: ''}, //to identify the type
|
|
20
|
+
assignees: { type: Array, default: [] },
|
|
21
|
+
|
|
22
|
+
checks: { type: Object, default: {} }, // for specific review checks
|
|
23
|
+
|
|
24
|
+
followup: { type: Boolean, default: false },
|
|
25
|
+
employees: { type: Array, default: [] },
|
|
26
|
+
notes: { type: String, default: '' },
|
|
27
|
+
notify: { type: Array, default: [] },
|
|
28
|
+
comments: { type: Array, default: [] },
|
|
29
|
+
logs: {// this is datelog in projects, should we align?
|
|
30
|
+
type: Array, default: [{
|
|
31
|
+
date: Date.now,
|
|
32
|
+
msg: 'Review Created'
|
|
33
|
+
}]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
let WorkFlowCore = {
|
|
37
|
+
id:{type:String,default:''},
|
|
38
|
+
name:{type:String,default:''},
|
|
39
|
+
dept:{type:String,default:''},
|
|
40
|
+
group:{type:String,default:''},
|
|
41
|
+
work:{type:String,default:''},
|
|
42
|
+
watchers:{type:Array,default:[]},//people responsible for the overall flow
|
|
43
|
+
workheaders:{type:Array,default:[]},
|
|
44
|
+
flow:{type:Array,default:[]}
|
|
45
|
+
}
|
|
46
|
+
/* Workflow.flow example
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
*/
|
|
52
|
+
let TodoCore = {
|
|
53
|
+
type:{type:String,default:''}, // work | watching
|
|
54
|
+
workflow:{type:String,default:''}
|
|
55
|
+
|
|
56
|
+
// type watching only -
|
|
57
|
+
// list:{type:Array,default:[]} // all of the active work
|
|
58
|
+
|
|
59
|
+
// type work only -
|
|
60
|
+
// todo:{type:Object,default:{}}
|
|
61
|
+
// ref: {type:String,default:''} // id of work
|
|
62
|
+
//
|
|
63
|
+
}
|
|
64
|
+
module.exports ={
|
|
65
|
+
ActiveTask:new Schema({...TaskCore},{}),
|
|
66
|
+
FinishedTask:new Schema({...TaskCore},{}),
|
|
67
|
+
WorkFlow:new Schema({...WorkFlowCore},{}),
|
|
68
|
+
Todo:new Schema({...TodoCore}, {strict: false})
|
|
69
|
+
}
|
package/old/spares.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If Leads will flow through to Quotes and then to Jobs,
|
|
3
|
+
* it should have the same structure as them so things don't need to be re-mapped.
|
|
4
|
+
* It can be a pared-down version of the full Project object, but it should align as much as possible
|
|
5
|
+
*/
|
|
6
|
+
var leadCore = {
|
|
7
|
+
custCode: { type: String, default: '' },
|
|
8
|
+
client: { type: String, default: '' },
|
|
9
|
+
date: { type: Date, default: null },
|
|
10
|
+
email: { type: String, default: '' },
|
|
11
|
+
phone: { type: String, default: '' },
|
|
12
|
+
street: { type: String, default: '' },
|
|
13
|
+
unit: { type: String, default: '' },
|
|
14
|
+
city: { type: String, default: '' },
|
|
15
|
+
zip: { type: String, default: '' },
|
|
16
|
+
comp: { type: String, default: '' },
|
|
17
|
+
dept: { type: String, default: '' },
|
|
18
|
+
estimator: { type: String, default: '' },
|
|
19
|
+
lead: { type: String, default: '' },
|
|
20
|
+
source: { type: String, default: '' },
|
|
21
|
+
log: { type: String, default: '' } //logging lead through lifecycle <- this is taken care of by stage/status now
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vhp-mongo-models",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"productName": "VHP Mongo Models",
|
|
5
|
+
"description": "Mongo Models library to setup Mongoose Schemas",
|
|
6
|
+
"author": "VHPim",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": "VHP1946/vhp-mongo-models",
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"mongoose": "^7.0.5"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"jsdoc": "^4.0.3"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|