@resolveio/server-lib 3.1.4-newrole → 3.1.5
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 +34 -45
- package/fixtures/init.js +1 -1
- package/models/user.model.d.ts +5 -22
- package/package.json +1 -1
- package/util/common.js +14 -7
|
@@ -21,6 +21,13 @@ 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
|
+
},
|
|
24
31
|
attempts: {
|
|
25
32
|
type: Number,
|
|
26
33
|
optional: true
|
|
@@ -57,78 +64,60 @@ var schema = {
|
|
|
57
64
|
type: String
|
|
58
65
|
},
|
|
59
66
|
roles: {
|
|
60
|
-
type: Object
|
|
61
|
-
},
|
|
62
|
-
'roles.super_admin': {
|
|
63
|
-
type: Boolean
|
|
64
|
-
},
|
|
65
|
-
'roles.approvals': {
|
|
66
67
|
type: Array
|
|
67
68
|
},
|
|
68
|
-
'roles
|
|
69
|
-
type: Object
|
|
70
|
-
},
|
|
71
|
-
'roles.approvals.$.name': {
|
|
69
|
+
'roles.$': {
|
|
72
70
|
type: String
|
|
73
71
|
},
|
|
74
|
-
|
|
75
|
-
type: String
|
|
72
|
+
phonenumber: {
|
|
73
|
+
type: String,
|
|
74
|
+
optional: true
|
|
76
75
|
},
|
|
77
|
-
|
|
78
|
-
type:
|
|
76
|
+
other: {
|
|
77
|
+
type: Object,
|
|
78
|
+
blackbox: true,
|
|
79
|
+
optional: true
|
|
79
80
|
},
|
|
80
|
-
|
|
81
|
-
type: Array
|
|
81
|
+
assets: {
|
|
82
|
+
type: Array,
|
|
83
|
+
optional: true
|
|
82
84
|
},
|
|
83
|
-
'
|
|
85
|
+
'assets.$': {
|
|
84
86
|
type: Object
|
|
85
87
|
},
|
|
86
|
-
'
|
|
88
|
+
'assets.$.type': {
|
|
87
89
|
type: String
|
|
88
90
|
},
|
|
89
|
-
'
|
|
90
|
-
type: Array
|
|
91
|
-
},
|
|
92
|
-
'roles.groups.$.views.$': {
|
|
91
|
+
'assets.$.id_asset': {
|
|
93
92
|
type: String
|
|
94
93
|
},
|
|
95
|
-
'
|
|
96
|
-
type: String,
|
|
97
|
-
optional: true
|
|
98
|
-
},
|
|
99
|
-
'roles.notifications': {
|
|
100
|
-
type: Array
|
|
101
|
-
},
|
|
102
|
-
'roles.notifications.$': {
|
|
94
|
+
'assets.$.asset_number': {
|
|
103
95
|
type: String
|
|
104
96
|
},
|
|
105
|
-
'
|
|
106
|
-
type:
|
|
97
|
+
'assets.$.ownership': {
|
|
98
|
+
type: String
|
|
107
99
|
},
|
|
108
|
-
'
|
|
100
|
+
'assets.$.ownership_driver': {
|
|
109
101
|
type: String
|
|
110
102
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
type: String,
|
|
114
|
-
optional: true
|
|
103
|
+
'assets.$.date_start': {
|
|
104
|
+
type: Date
|
|
115
105
|
},
|
|
116
|
-
|
|
117
|
-
type:
|
|
106
|
+
'assets.$.date_end': {
|
|
107
|
+
type: Date,
|
|
118
108
|
optional: true
|
|
119
109
|
},
|
|
120
|
-
|
|
110
|
+
id_function: {
|
|
121
111
|
type: String,
|
|
122
112
|
optional: true
|
|
123
113
|
},
|
|
124
|
-
|
|
114
|
+
customer: {
|
|
125
115
|
type: String,
|
|
126
|
-
optional: true
|
|
116
|
+
optional: true,
|
|
127
117
|
},
|
|
128
|
-
|
|
129
|
-
type:
|
|
118
|
+
id_customer: {
|
|
119
|
+
type: String,
|
|
130
120
|
optional: true,
|
|
131
|
-
blackbox: true
|
|
132
121
|
}
|
|
133
122
|
};
|
|
134
123
|
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 mongoose_1 = require("mongoose");
|
|
41
40
|
var active_subscription_collection_1 = require("../collections/active-subscription.collection");
|
|
41
|
+
var mongoose_1 = require("mongoose");
|
|
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,31 +1,14 @@
|
|
|
1
1
|
import { CollectionDocument } from './collection-document.model';
|
|
2
2
|
export interface UserModel extends CollectionDocument {
|
|
3
|
+
attempts: number;
|
|
4
|
+
last: Date;
|
|
5
|
+
services?: any;
|
|
3
6
|
fullname: string;
|
|
4
|
-
roles: UserRoleModel;
|
|
5
7
|
username?: string;
|
|
6
8
|
email?: string;
|
|
9
|
+
roles?: string[];
|
|
7
10
|
active?: boolean;
|
|
8
|
-
|
|
9
|
-
id_customer?: string;
|
|
10
|
-
customer?: string;
|
|
11
|
-
customer_type?: string;
|
|
11
|
+
readonly?: boolean;
|
|
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/util/common.js
CHANGED
|
@@ -153,11 +153,13 @@ function applyMongoUpdate(uDoc, delta) {
|
|
|
153
153
|
delete o1[n1[0]];
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
throw new Error(o2 + '/' + n2 + ' - couldn\'t resolve first for ' + uDoc + ' ' + v);
|
|
156
|
+
// throw new Error(o2 + '/' + n2 + ' - couldn\'t resolve first for ' + uDoc + ' ' + v);
|
|
157
|
+
console.log('Error', o2 + '/' + n2 + ' - couldn\'t resolve first for ' + uDoc + ' ' + v);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
else {
|
|
160
|
-
throw new Error(o1 + '/' + n1 + ' - couldn\'t resolve second for ' + uDoc + ' ' + k);
|
|
161
|
+
// throw new Error(o1 + '/' + n1 + ' - couldn\'t resolve second for ' + uDoc + ' ' + k);
|
|
162
|
+
console.log('Error', o1 + '/' + n1 + ' - couldn\'t resolve second for ' + uDoc + ' ' + k);
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
165
|
}
|
|
@@ -173,7 +175,8 @@ function applyMongoUpdate(uDoc, delta) {
|
|
|
173
175
|
o[n[0]] = v;
|
|
174
176
|
}
|
|
175
177
|
else {
|
|
176
|
-
throw new Error(o + '/' + n + ' - couldn\'t set for ' + uDoc + ' ' + k);
|
|
178
|
+
// throw new Error(o + '/' + n + ' - couldn\'t set for ' + uDoc + ' ' + k);
|
|
179
|
+
console.log('Error', o + '/' + n + ' - couldn\'t set for ' + uDoc + ' ' + k);
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
}
|
|
@@ -192,7 +195,8 @@ function applyMongoUpdate(uDoc, delta) {
|
|
|
192
195
|
o[n[0]] += v;
|
|
193
196
|
}
|
|
194
197
|
else {
|
|
195
|
-
throw new Error(o + '/' + n + ' - couldn\'t set for ' + uDoc + ' ' + k);
|
|
198
|
+
// throw new Error(o + '/' + n + ' - couldn\'t set for ' + uDoc + ' ' + k);
|
|
199
|
+
console.log('Error', o + '/' + n + ' - couldn\'t set for ' + uDoc + ' ' + k);
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
}
|
|
@@ -206,7 +210,8 @@ function applyMongoUpdate(uDoc, delta) {
|
|
|
206
210
|
delete o[n[0]];
|
|
207
211
|
}
|
|
208
212
|
else {
|
|
209
|
-
throw new Error(o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + k);
|
|
213
|
+
// throw new Error(o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + k);
|
|
214
|
+
console.log('Error', o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + k);
|
|
210
215
|
}
|
|
211
216
|
}
|
|
212
217
|
}
|
|
@@ -223,7 +228,8 @@ function applyMongoUpdate(uDoc, delta) {
|
|
|
223
228
|
o[n[0]].splice(o2[n2[0]].findIndex(function (z) { return JSON.stringify(z) === JSON.stringify(vk); }), 1);
|
|
224
229
|
}
|
|
225
230
|
else {
|
|
226
|
-
throw new Error(o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + pathk);
|
|
231
|
+
// throw new Error(o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + pathk);
|
|
232
|
+
console.log('Error', o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + pathk);
|
|
227
233
|
}
|
|
228
234
|
}
|
|
229
235
|
}
|
|
@@ -241,7 +247,8 @@ function applyMongoUpdate(uDoc, delta) {
|
|
|
241
247
|
o[n[0]].push(vk);
|
|
242
248
|
}
|
|
243
249
|
else {
|
|
244
|
-
throw new Error(o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + pathk);
|
|
250
|
+
// throw new Error(o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + pathk);
|
|
251
|
+
console.log('Error', o + '/' + n + ' - couldn\'t unset for ' + uDoc + ' ' + pathk);
|
|
245
252
|
}
|
|
246
253
|
}
|
|
247
254
|
}
|