@resolveio/server-lib 2.0.0 → 2.0.1-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.
|
@@ -26,7 +26,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
|
|
|
26
26
|
versionKey: false,
|
|
27
27
|
timestamps: true
|
|
28
28
|
});
|
|
29
|
-
DefaultSchema.index({ createdAt: 1 }, { expireAfterSeconds:
|
|
29
|
+
DefaultSchema.index({ createdAt: 1 }, { expireAfterSeconds: 60 });
|
|
30
30
|
exports.QueueFlags = index_1.ResolveIOServer.getMainDB().model('queue-flags', DefaultSchema);
|
|
31
31
|
exports.QueueFlags['simplschema'] = new simpl_schema_1.default(schema);
|
|
32
32
|
schema._id = {
|
|
@@ -21,13 +21,6 @@ var schema = {
|
|
|
21
21
|
type: Date,
|
|
22
22
|
optional: true
|
|
23
23
|
},
|
|
24
|
-
readonly: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
optional: true
|
|
27
|
-
},
|
|
28
|
-
active: {
|
|
29
|
-
type: Boolean
|
|
30
|
-
},
|
|
31
24
|
attempts: {
|
|
32
25
|
type: Number,
|
|
33
26
|
optional: true
|
|
@@ -64,60 +57,73 @@ var schema = {
|
|
|
64
57
|
type: String
|
|
65
58
|
},
|
|
66
59
|
roles: {
|
|
60
|
+
type: Object
|
|
61
|
+
},
|
|
62
|
+
'roles.super_admin': {
|
|
63
|
+
type: Boolean
|
|
64
|
+
},
|
|
65
|
+
'roles.approvals': {
|
|
67
66
|
type: Array
|
|
68
67
|
},
|
|
69
|
-
'roles.$': {
|
|
68
|
+
'roles.approvals.$': {
|
|
69
|
+
type: Object
|
|
70
|
+
},
|
|
71
|
+
'roles.approvals.$.name': {
|
|
70
72
|
type: String
|
|
71
73
|
},
|
|
72
|
-
|
|
73
|
-
type: String
|
|
74
|
-
optional: true
|
|
74
|
+
'roles.approvals.$.type': {
|
|
75
|
+
type: String
|
|
75
76
|
},
|
|
76
|
-
|
|
77
|
-
type:
|
|
78
|
-
blackbox: true,
|
|
79
|
-
optional: true
|
|
77
|
+
'roles.approvals.$.accounting_code': {
|
|
78
|
+
type: String
|
|
80
79
|
},
|
|
81
|
-
|
|
82
|
-
type: Array
|
|
83
|
-
optional: true
|
|
80
|
+
'roles.groups': {
|
|
81
|
+
type: Array
|
|
84
82
|
},
|
|
85
|
-
'
|
|
83
|
+
'roles.groups.$': {
|
|
86
84
|
type: Object
|
|
87
85
|
},
|
|
88
|
-
'
|
|
86
|
+
'roles.groups.$.name': {
|
|
89
87
|
type: String
|
|
90
88
|
},
|
|
91
|
-
'
|
|
92
|
-
type:
|
|
89
|
+
'roles.groups.$.views': {
|
|
90
|
+
type: Array
|
|
93
91
|
},
|
|
94
|
-
'
|
|
92
|
+
'roles.groups.$.views.$': {
|
|
95
93
|
type: String
|
|
96
94
|
},
|
|
97
|
-
'
|
|
98
|
-
type: String
|
|
95
|
+
'roles.groups.$.yard': {
|
|
96
|
+
type: String,
|
|
97
|
+
optional: true
|
|
99
98
|
},
|
|
100
|
-
'
|
|
99
|
+
'roles.notifications': {
|
|
100
|
+
type: Array
|
|
101
|
+
},
|
|
102
|
+
'roles.notifications.$': {
|
|
101
103
|
type: String
|
|
102
104
|
},
|
|
103
|
-
'
|
|
104
|
-
type:
|
|
105
|
+
'roles.miscs': {
|
|
106
|
+
type: Array
|
|
105
107
|
},
|
|
106
|
-
'
|
|
107
|
-
type:
|
|
108
|
-
optional: true
|
|
108
|
+
'roles.miscs.$': {
|
|
109
|
+
type: String
|
|
109
110
|
},
|
|
110
|
-
|
|
111
|
+
active: Boolean,
|
|
112
|
+
id_customer: {
|
|
111
113
|
type: String,
|
|
112
114
|
optional: true
|
|
113
115
|
},
|
|
114
116
|
customer: {
|
|
115
117
|
type: String,
|
|
116
|
-
optional: true
|
|
118
|
+
optional: true
|
|
117
119
|
},
|
|
118
|
-
|
|
120
|
+
customer_type: {
|
|
119
121
|
type: String,
|
|
120
|
-
optional: true
|
|
122
|
+
optional: true
|
|
123
|
+
},
|
|
124
|
+
phonenumber: {
|
|
125
|
+
type: String,
|
|
126
|
+
optional: true
|
|
121
127
|
}
|
|
122
128
|
};
|
|
123
129
|
var DefaultSchema = new mongoose_1.Schema(schema, {
|
package/fixtures/init.js
CHANGED
|
@@ -37,7 +37,6 @@ 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
|
-
// import { ActiveSubscriptions } from '../collections/active-subscription.collection';
|
|
41
40
|
var mongoose_1 = require("mongoose");
|
|
42
41
|
function loadServerInit() {
|
|
43
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -295,7 +295,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
295
295
|
data: 'Internal Error'
|
|
296
296
|
};
|
|
297
297
|
_this._mainServer.getQueueManager().addMethodResponse(updateCopy, serverRes);
|
|
298
|
-
return
|
|
298
|
+
return resolve('No Method: ' + update.method);
|
|
299
299
|
}
|
|
300
300
|
if ((update.method_data.length > 1 || update.method_data[0]) && !that._methods[update.method].skipValidation) {
|
|
301
301
|
if (!that._methods[update.method].check) {
|
|
@@ -307,7 +307,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
307
307
|
data: 'Internal Error'
|
|
308
308
|
};
|
|
309
309
|
_this._mainServer.getQueueManager().addMethodResponse(updateCopy, serverRes);
|
|
310
|
-
return
|
|
310
|
+
return resolve('No Check Function For Method ' + update.method);
|
|
311
311
|
}
|
|
312
312
|
else if (!that._methods[update.method].check._schema) {
|
|
313
313
|
console.error('No Check Schema For Method ' + update.method);
|
|
@@ -318,7 +318,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
318
318
|
data: 'Internal Error'
|
|
319
319
|
};
|
|
320
320
|
_this._mainServer.getQueueManager().addMethodResponse(updateCopy, serverRes);
|
|
321
|
-
return
|
|
321
|
+
return resolve('No Check Schema For Method ' + update.method);
|
|
322
322
|
}
|
|
323
323
|
else {
|
|
324
324
|
var valObj = {};
|
|
@@ -340,7 +340,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
340
340
|
data: 'Internal Error'
|
|
341
341
|
};
|
|
342
342
|
_this._mainServer.getQueueManager().addMethodResponse(updateCopy, serverRes);
|
|
343
|
-
return
|
|
343
|
+
return resolve('Error in Method Check (' + update.method + ')');
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -348,8 +348,8 @@ var MethodManager = /** @class */ (function () {
|
|
|
348
348
|
var timeout = setTimeout(function () {
|
|
349
349
|
console.error('Timeout on method', update);
|
|
350
350
|
_this.callMethodInternal.call(_this, 'insertErrorLog', 'Timeout on method: ', [update]);
|
|
351
|
-
|
|
352
|
-
},
|
|
351
|
+
resolve('Timeout');
|
|
352
|
+
}, 5000);
|
|
353
353
|
// console.log('Run Method', update.method);
|
|
354
354
|
(_a = that._methods[update.method].function).call.apply(_a, [Object.assign({}, that, MethodManager.prototype, { id_user: update.id_user, user: update.user, id_ws: update.id_ws })].concat(update.method_data)).then(function (res) {
|
|
355
355
|
var serverRes = {
|
|
@@ -368,7 +368,7 @@ var MethodManager = /** @class */ (function () {
|
|
|
368
368
|
};
|
|
369
369
|
_this._mainServer.getQueueManager().addMethodResponse(updateCopy, serverRes);
|
|
370
370
|
clearTimeout(timeout);
|
|
371
|
-
|
|
371
|
+
resolve(serverRes);
|
|
372
372
|
});
|
|
373
373
|
});
|
|
374
374
|
};
|
package/models/user.model.d.ts
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface UserModel extends CollectionDocument {
|
|
3
|
-
attempts: number;
|
|
4
|
-
last: Date;
|
|
5
|
-
services?: any;
|
|
6
3
|
fullname: string;
|
|
4
|
+
roles: UserRoleModel;
|
|
7
5
|
username?: string;
|
|
8
6
|
email?: string;
|
|
9
|
-
roles?: string[];
|
|
10
7
|
active?: boolean;
|
|
11
|
-
|
|
8
|
+
services?: any;
|
|
9
|
+
id_customer?: string;
|
|
10
|
+
customer?: string;
|
|
11
|
+
customer_type?: string;
|
|
12
12
|
phonenumber?: string;
|
|
13
|
-
|
|
13
|
+
}
|
|
14
|
+
export interface UserRoleModel {
|
|
15
|
+
super_admin: boolean;
|
|
16
|
+
approvals: UserRoleApprovalModel[];
|
|
17
|
+
groups: UserRoleGroupModel[];
|
|
18
|
+
notifications: string[];
|
|
19
|
+
miscs: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface UserRoleApprovalModel {
|
|
22
|
+
accounting_code: string;
|
|
23
|
+
type: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UserRoleGroupModel {
|
|
27
|
+
name: string;
|
|
28
|
+
views: string[];
|
|
29
|
+
yard?: string;
|
|
14
30
|
}
|