@resolveio/server-lib 3.1.2 → 3.1.3-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 +45 -34
- package/fixtures/init.js +1 -1
- package/models/user.model.d.ts +22 -5
- package/package.json +1 -1
- package/server-app.js +0 -68
|
@@ -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,78 @@ 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: {
|
|
121
|
+
type: String,
|
|
122
|
+
optional: true
|
|
123
|
+
},
|
|
124
|
+
phonenumber: {
|
|
119
125
|
type: String,
|
|
126
|
+
optional: true
|
|
127
|
+
},
|
|
128
|
+
other: {
|
|
129
|
+
type: Object,
|
|
120
130
|
optional: true,
|
|
131
|
+
blackbox: true
|
|
121
132
|
}
|
|
122
133
|
};
|
|
123
134
|
var DefaultSchema = new mongoose_1.Schema(schema, {
|
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/models/user.model.d.ts
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
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
|
other?: object;
|
|
14
14
|
}
|
|
15
|
+
export interface UserRoleModel {
|
|
16
|
+
super_admin: boolean;
|
|
17
|
+
approvals: UserRoleApprovalModel[];
|
|
18
|
+
groups: UserRoleGroupModel[];
|
|
19
|
+
notifications: string[];
|
|
20
|
+
miscs: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface UserRoleApprovalModel {
|
|
23
|
+
accounting_code: string;
|
|
24
|
+
type: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}
|
|
27
|
+
export interface UserRoleGroupModel {
|
|
28
|
+
name: string;
|
|
29
|
+
views: string[];
|
|
30
|
+
yard?: string;
|
|
31
|
+
}
|
package/package.json
CHANGED
package/server-app.js
CHANGED
|
@@ -376,19 +376,6 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
else {
|
|
380
|
-
log_collection_1.Logs.create({
|
|
381
|
-
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
382
|
-
date: new Date(),
|
|
383
|
-
type: 'client-request',
|
|
384
|
-
title: 'Client Request - Method',
|
|
385
|
-
message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
386
|
-
payload: 'Too Big',
|
|
387
|
-
method: method,
|
|
388
|
-
user: ws['user'],
|
|
389
|
-
messageId: messageId
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
379
|
serverRes = {
|
|
393
380
|
messageId: messageId,
|
|
394
381
|
hasError: false,
|
|
@@ -510,19 +497,6 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
510
497
|
});
|
|
511
498
|
}
|
|
512
499
|
}
|
|
513
|
-
else {
|
|
514
|
-
log_collection_1.Logs.create({
|
|
515
|
-
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
516
|
-
date: new Date(),
|
|
517
|
-
type: 'client-request',
|
|
518
|
-
title: 'Client Request - Method Retry',
|
|
519
|
-
message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
520
|
-
payload: 'Too Big',
|
|
521
|
-
method: method,
|
|
522
|
-
user: ws['user'],
|
|
523
|
-
messageId: messageId
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
500
|
method_call_collection_1.MethodCalls.findOne({ $and: [
|
|
527
501
|
{ id_user: ws['id_user'] },
|
|
528
502
|
{ message_id: messageId },
|
|
@@ -563,47 +537,6 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
563
537
|
}
|
|
564
538
|
else if (type === 'methodResponse') {
|
|
565
539
|
method = data.shift();
|
|
566
|
-
// if (method !== 'generatePDF' && method !== 'getWOOfflineData' &&method !== 'countQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'setWSAppVersion') {
|
|
567
|
-
// if (getBinarySize(JSON.stringify(data)) < 200000) {
|
|
568
|
-
// Logs.create({
|
|
569
|
-
// _id: Types.ObjectId().toHexString(),
|
|
570
|
-
// date: new Date(),
|
|
571
|
-
// type: 'client-request',
|
|
572
|
-
// title: 'Client Request - Method Response',
|
|
573
|
-
// message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
574
|
-
// payload: data,
|
|
575
|
-
// method: method,
|
|
576
|
-
// user: ws['user'],
|
|
577
|
-
// messageId: messageId
|
|
578
|
-
// });
|
|
579
|
-
// }
|
|
580
|
-
// else {
|
|
581
|
-
// Logs.create({
|
|
582
|
-
// _id: Types.ObjectId().toHexString(),
|
|
583
|
-
// date: new Date(),
|
|
584
|
-
// type: 'client-request',
|
|
585
|
-
// title: 'Client Request - Method Response',
|
|
586
|
-
// message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
587
|
-
// payload: 'Too Big',
|
|
588
|
-
// method: method,
|
|
589
|
-
// user: ws['user'],
|
|
590
|
-
// messageId: messageId
|
|
591
|
-
// });
|
|
592
|
-
// }
|
|
593
|
-
// }
|
|
594
|
-
// else {
|
|
595
|
-
// Logs.create({
|
|
596
|
-
// _id: Types.ObjectId().toHexString(),
|
|
597
|
-
// date: new Date(),
|
|
598
|
-
// type: 'client-request',
|
|
599
|
-
// title: 'Client Request - Method Response',
|
|
600
|
-
// message: 'User: ' + ws['user'] + ', Type: ' + type + ', MessageId: ' + messageId + ', Method: ' + method,
|
|
601
|
-
// payload: 'Too Big',
|
|
602
|
-
// method: method,
|
|
603
|
-
// user: ws['user'],
|
|
604
|
-
// messageId: messageId
|
|
605
|
-
// });
|
|
606
|
-
// }
|
|
607
540
|
method_response_collection_1.MethodResponses.findOne({ $and: [
|
|
608
541
|
{ id_user: ws['id_user'] },
|
|
609
542
|
{ message_id: messageId },
|
|
@@ -624,7 +557,6 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
624
557
|
}
|
|
625
558
|
else if (type === 'support') {
|
|
626
559
|
supportMethod = data.shift();
|
|
627
|
-
// if (supportMethod !== 'countQuery' && supportMethod !== 'countCollectionWithQuery' && supportMethod !== 'find' && supportMethod !== 'findOne' && supportMethod !== 'findWithOptions' && method !== 'setWSAppVersion' && method !== 'uploadFileAndSave') {
|
|
628
560
|
if (common_1.getBinarySize(JSON.stringify(data)) < 200000) {
|
|
629
561
|
log_collection_1.Logs.create({
|
|
630
562
|
_id: mongoose_1.Types.ObjectId().toHexString(),
|