@resolveio/server-lib 4.6.18 → 4.6.19-newrole
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/collections/user.collection.js +39 -32
- package/fixtures/init.js +1 -1
- package/methods/logs.js +158 -92
- package/package.json +1 -1
|
@@ -22,13 +22,6 @@ var schema = {
|
|
|
22
22
|
type: Date,
|
|
23
23
|
optional: true
|
|
24
24
|
},
|
|
25
|
-
readonly: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
optional: true
|
|
28
|
-
},
|
|
29
|
-
active: {
|
|
30
|
-
type: Boolean
|
|
31
|
-
},
|
|
32
25
|
attempts: {
|
|
33
26
|
type: Number,
|
|
34
27
|
optional: true
|
|
@@ -65,53 +58,67 @@ var schema = {
|
|
|
65
58
|
type: String
|
|
66
59
|
},
|
|
67
60
|
roles: {
|
|
61
|
+
type: Object
|
|
62
|
+
},
|
|
63
|
+
'roles.super_admin': {
|
|
64
|
+
type: Boolean
|
|
65
|
+
},
|
|
66
|
+
'roles.approvals': {
|
|
68
67
|
type: Array
|
|
69
68
|
},
|
|
70
|
-
'roles.$': {
|
|
69
|
+
'roles.approvals.$': {
|
|
70
|
+
type: Object
|
|
71
|
+
},
|
|
72
|
+
'roles.approvals.$.name': {
|
|
71
73
|
type: String
|
|
72
74
|
},
|
|
73
|
-
|
|
74
|
-
type: String
|
|
75
|
-
optional: true
|
|
75
|
+
'roles.approvals.$.type': {
|
|
76
|
+
type: String
|
|
76
77
|
},
|
|
77
|
-
|
|
78
|
-
type:
|
|
79
|
-
blackbox: true,
|
|
80
|
-
optional: true
|
|
78
|
+
'roles.approvals.$.accounting_code': {
|
|
79
|
+
type: String
|
|
81
80
|
},
|
|
82
|
-
|
|
83
|
-
type: Array
|
|
84
|
-
optional: true
|
|
81
|
+
'roles.groups': {
|
|
82
|
+
type: Array
|
|
85
83
|
},
|
|
86
|
-
'
|
|
84
|
+
'roles.groups.$': {
|
|
87
85
|
type: Object
|
|
88
86
|
},
|
|
89
|
-
'
|
|
87
|
+
'roles.groups.$.name': {
|
|
90
88
|
type: String
|
|
91
89
|
},
|
|
92
|
-
'
|
|
93
|
-
type:
|
|
90
|
+
'roles.groups.$.views': {
|
|
91
|
+
type: Array
|
|
94
92
|
},
|
|
95
|
-
'
|
|
93
|
+
'roles.groups.$.views.$': {
|
|
96
94
|
type: String
|
|
97
95
|
},
|
|
98
|
-
'
|
|
99
|
-
type: String
|
|
96
|
+
'roles.groups.$.yard': {
|
|
97
|
+
type: String,
|
|
98
|
+
optional: true
|
|
99
|
+
},
|
|
100
|
+
'roles.notifications': {
|
|
101
|
+
type: Array
|
|
100
102
|
},
|
|
101
|
-
'
|
|
103
|
+
'roles.notifications.$': {
|
|
102
104
|
type: String
|
|
103
105
|
},
|
|
104
|
-
'
|
|
105
|
-
type:
|
|
106
|
+
'roles.miscs': {
|
|
107
|
+
type: Array
|
|
106
108
|
},
|
|
107
|
-
'
|
|
108
|
-
type:
|
|
109
|
-
optional: true
|
|
109
|
+
'roles.miscs.$': {
|
|
110
|
+
type: String
|
|
110
111
|
},
|
|
111
|
-
|
|
112
|
+
active: Boolean,
|
|
113
|
+
phonenumber: {
|
|
112
114
|
type: String,
|
|
113
115
|
optional: true
|
|
114
116
|
},
|
|
117
|
+
other: {
|
|
118
|
+
type: Object,
|
|
119
|
+
optional: true,
|
|
120
|
+
blackbox: true
|
|
121
|
+
},
|
|
115
122
|
customers: {
|
|
116
123
|
type: Array,
|
|
117
124
|
optional: true,
|
package/fixtures/init.js
CHANGED
|
@@ -37,8 +37,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
var app_version_collection_1 = require("../collections/app-version.collection");
|
|
39
39
|
var logged_in_users_collection_1 = require("../collections/logged-in-users.collection");
|
|
40
|
-
var active_subscription_collection_1 = require("../collections/active-subscription.collection");
|
|
41
40
|
var mongoose_1 = require("mongoose");
|
|
41
|
+
var active_subscription_collection_1 = require("../collections/active-subscription.collection");
|
|
42
42
|
function loadServerInit() {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
44
44
|
var appVersion;
|
package/methods/logs.js
CHANGED
|
@@ -92,10 +92,10 @@ function loadLogMethods(methodManager) {
|
|
|
92
92
|
},
|
|
93
93
|
superadminAPM: {
|
|
94
94
|
skipQueue: true,
|
|
95
|
-
function: function (date_start, date_end) {
|
|
95
|
+
function: function (date_start, date_end, graphInterval) {
|
|
96
96
|
var _this = this;
|
|
97
97
|
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
98
|
-
var latencies, subscriptions, methodGraphData, subGraphData;
|
|
98
|
+
var latencies, subscriptions, groupId, groupSort, methodGraphData, subGraphData;
|
|
99
99
|
return __generator(this, function (_a) {
|
|
100
100
|
switch (_a.label) {
|
|
101
101
|
case 0: return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
@@ -147,6 +147,158 @@ function loadLogMethods(methodManager) {
|
|
|
147
147
|
]).allowDiskUse(true)];
|
|
148
148
|
case 2:
|
|
149
149
|
subscriptions = _a.sent();
|
|
150
|
+
groupId = {};
|
|
151
|
+
groupSort = {};
|
|
152
|
+
if (graphInterval === 'seconds') {
|
|
153
|
+
groupId = {
|
|
154
|
+
second: {
|
|
155
|
+
$second: {
|
|
156
|
+
date: '$createdAt',
|
|
157
|
+
timezone: "America/Chicago"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
minute: {
|
|
161
|
+
$minute: {
|
|
162
|
+
date: '$createdAt',
|
|
163
|
+
timezone: "America/Chicago"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
hour: {
|
|
167
|
+
$hour: {
|
|
168
|
+
date: '$createdAt',
|
|
169
|
+
timezone: "America/Chicago"
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
day: {
|
|
173
|
+
$dayOfMonth: {
|
|
174
|
+
date: '$createdAt',
|
|
175
|
+
timezone: "America/Chicago"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
month: {
|
|
179
|
+
$month: {
|
|
180
|
+
date: '$createdAt',
|
|
181
|
+
timezone: "America/Chicago"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
year: {
|
|
185
|
+
$year: {
|
|
186
|
+
date: '$createdAt',
|
|
187
|
+
timezone: "America/Chicago"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
groupSort = {
|
|
192
|
+
'_id.year': 1,
|
|
193
|
+
'_id.month': 1,
|
|
194
|
+
'_id.day': 1,
|
|
195
|
+
'_id.hour': 1,
|
|
196
|
+
'_id.minute': 1,
|
|
197
|
+
'_id.second': 1
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
else if (graphInterval === 'minutes') {
|
|
201
|
+
groupId = {
|
|
202
|
+
minute: {
|
|
203
|
+
$minute: {
|
|
204
|
+
date: '$createdAt',
|
|
205
|
+
timezone: "America/Chicago"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
hour: {
|
|
209
|
+
$hour: {
|
|
210
|
+
date: '$createdAt',
|
|
211
|
+
timezone: "America/Chicago"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
day: {
|
|
215
|
+
$dayOfMonth: {
|
|
216
|
+
date: '$createdAt',
|
|
217
|
+
timezone: "America/Chicago"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
month: {
|
|
221
|
+
$month: {
|
|
222
|
+
date: '$createdAt',
|
|
223
|
+
timezone: "America/Chicago"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
year: {
|
|
227
|
+
$year: {
|
|
228
|
+
date: '$createdAt',
|
|
229
|
+
timezone: "America/Chicago"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
groupSort = {
|
|
234
|
+
'_id.year': 1,
|
|
235
|
+
'_id.month': 1,
|
|
236
|
+
'_id.day': 1,
|
|
237
|
+
'_id.hour': 1,
|
|
238
|
+
'_id.minute': 1
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
else if (graphInterval === 'hours') {
|
|
242
|
+
groupId = {
|
|
243
|
+
hour: {
|
|
244
|
+
$hour: {
|
|
245
|
+
date: '$createdAt',
|
|
246
|
+
timezone: "America/Chicago"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
day: {
|
|
250
|
+
$dayOfMonth: {
|
|
251
|
+
date: '$createdAt',
|
|
252
|
+
timezone: "America/Chicago"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
month: {
|
|
256
|
+
$month: {
|
|
257
|
+
date: '$createdAt',
|
|
258
|
+
timezone: "America/Chicago"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
year: {
|
|
262
|
+
$year: {
|
|
263
|
+
date: '$createdAt',
|
|
264
|
+
timezone: "America/Chicago"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
groupSort = {
|
|
269
|
+
'_id.year': 1,
|
|
270
|
+
'_id.month': 1,
|
|
271
|
+
'_id.day': 1,
|
|
272
|
+
'_id.hour': 1
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
groupId = {
|
|
277
|
+
day: {
|
|
278
|
+
$dayOfMonth: {
|
|
279
|
+
date: '$createdAt',
|
|
280
|
+
timezone: "America/Chicago"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
month: {
|
|
284
|
+
$month: {
|
|
285
|
+
date: '$createdAt',
|
|
286
|
+
timezone: "America/Chicago"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
year: {
|
|
290
|
+
$year: {
|
|
291
|
+
date: '$createdAt',
|
|
292
|
+
timezone: "America/Chicago"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
groupSort = {
|
|
297
|
+
'_id.year': 1,
|
|
298
|
+
'_id.month': 1,
|
|
299
|
+
'_id.day': 1
|
|
300
|
+
};
|
|
301
|
+
}
|
|
150
302
|
return [4 /*yield*/, log_method_latency_collection_1.LogMethodLatencies.aggregate([
|
|
151
303
|
{
|
|
152
304
|
$match: {
|
|
@@ -162,57 +314,14 @@ function loadLogMethods(methodManager) {
|
|
|
162
314
|
},
|
|
163
315
|
{
|
|
164
316
|
$group: {
|
|
165
|
-
_id:
|
|
166
|
-
// second: {
|
|
167
|
-
// $second: {
|
|
168
|
-
// date: '$createdAt',
|
|
169
|
-
// timezone: "America/Chicago"
|
|
170
|
-
// }
|
|
171
|
-
// },
|
|
172
|
-
minute: {
|
|
173
|
-
$minute: {
|
|
174
|
-
date: '$createdAt',
|
|
175
|
-
timezone: "America/Chicago"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
hour: {
|
|
179
|
-
$hour: {
|
|
180
|
-
date: '$createdAt',
|
|
181
|
-
timezone: "America/Chicago"
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
day: {
|
|
185
|
-
$dayOfMonth: {
|
|
186
|
-
date: '$createdAt',
|
|
187
|
-
timezone: "America/Chicago"
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
month: {
|
|
191
|
-
$month: {
|
|
192
|
-
date: '$createdAt',
|
|
193
|
-
timezone: "America/Chicago"
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
year: {
|
|
197
|
-
$year: {
|
|
198
|
-
date: '$createdAt',
|
|
199
|
-
timezone: "America/Chicago"
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
},
|
|
317
|
+
_id: groupId,
|
|
203
318
|
count: {
|
|
204
319
|
$sum: 1
|
|
205
320
|
}
|
|
206
321
|
}
|
|
207
322
|
},
|
|
208
323
|
{
|
|
209
|
-
$sort:
|
|
210
|
-
'_id.year': 1,
|
|
211
|
-
'_id.month': 1,
|
|
212
|
-
'_id.day': 1,
|
|
213
|
-
'_id.hour': 1,
|
|
214
|
-
'_id.minute': 1,
|
|
215
|
-
}
|
|
324
|
+
$sort: groupSort
|
|
216
325
|
}
|
|
217
326
|
]).allowDiskUse(true)];
|
|
218
327
|
case 3:
|
|
@@ -232,57 +341,14 @@ function loadLogMethods(methodManager) {
|
|
|
232
341
|
},
|
|
233
342
|
{
|
|
234
343
|
$group: {
|
|
235
|
-
_id:
|
|
236
|
-
// second: {
|
|
237
|
-
// $second: {
|
|
238
|
-
// date: '$createdAt',
|
|
239
|
-
// timezone: "America/Chicago"
|
|
240
|
-
// }
|
|
241
|
-
// },
|
|
242
|
-
minute: {
|
|
243
|
-
$minute: {
|
|
244
|
-
date: '$createdAt',
|
|
245
|
-
timezone: "America/Chicago"
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
hour: {
|
|
249
|
-
$hour: {
|
|
250
|
-
date: '$createdAt',
|
|
251
|
-
timezone: "America/Chicago"
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
day: {
|
|
255
|
-
$dayOfMonth: {
|
|
256
|
-
date: '$createdAt',
|
|
257
|
-
timezone: "America/Chicago"
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
month: {
|
|
261
|
-
$month: {
|
|
262
|
-
date: '$createdAt',
|
|
263
|
-
timezone: "America/Chicago"
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
year: {
|
|
267
|
-
$year: {
|
|
268
|
-
date: '$createdAt',
|
|
269
|
-
timezone: "America/Chicago"
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
},
|
|
344
|
+
_id: groupId,
|
|
273
345
|
count: {
|
|
274
346
|
$sum: 1
|
|
275
347
|
}
|
|
276
348
|
}
|
|
277
349
|
},
|
|
278
350
|
{
|
|
279
|
-
$sort:
|
|
280
|
-
'_id.year': 1,
|
|
281
|
-
'_id.month': 1,
|
|
282
|
-
'_id.day': 1,
|
|
283
|
-
'_id.hour': 1,
|
|
284
|
-
'_id.minute': 1,
|
|
285
|
-
}
|
|
351
|
+
$sort: groupSort
|
|
286
352
|
}
|
|
287
353
|
]).allowDiskUse(true)];
|
|
288
354
|
case 4:
|