@resolveio/server-lib 1.0.2 → 1.0.4
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 +41 -0
- package/package.json +1 -1
- package/server-app.js +26 -4
|
@@ -77,6 +77,47 @@ var schema = {
|
|
|
77
77
|
type: Object,
|
|
78
78
|
blackbox: true,
|
|
79
79
|
optional: true
|
|
80
|
+
},
|
|
81
|
+
assets: {
|
|
82
|
+
type: Array,
|
|
83
|
+
optional: true
|
|
84
|
+
},
|
|
85
|
+
'assets.$': {
|
|
86
|
+
type: Object
|
|
87
|
+
},
|
|
88
|
+
'assets.$.type': {
|
|
89
|
+
type: String
|
|
90
|
+
},
|
|
91
|
+
'assets.$.id_asset': {
|
|
92
|
+
type: String
|
|
93
|
+
},
|
|
94
|
+
'assets.$.asset_number': {
|
|
95
|
+
type: String
|
|
96
|
+
},
|
|
97
|
+
'assets.$.ownership': {
|
|
98
|
+
type: String
|
|
99
|
+
},
|
|
100
|
+
'assets.$.ownership_driver': {
|
|
101
|
+
type: String
|
|
102
|
+
},
|
|
103
|
+
'assets.$.date_start': {
|
|
104
|
+
type: Date
|
|
105
|
+
},
|
|
106
|
+
'assets.$.date_end': {
|
|
107
|
+
type: Date,
|
|
108
|
+
optional: true
|
|
109
|
+
},
|
|
110
|
+
id_function: {
|
|
111
|
+
type: String,
|
|
112
|
+
optional: true
|
|
113
|
+
},
|
|
114
|
+
customer: {
|
|
115
|
+
type: String,
|
|
116
|
+
optional: true,
|
|
117
|
+
},
|
|
118
|
+
id_customer: {
|
|
119
|
+
type: String,
|
|
120
|
+
optional: true,
|
|
80
121
|
}
|
|
81
122
|
};
|
|
82
123
|
var DefaultSchema = new mongoose_1.Schema(schema, {
|
package/package.json
CHANGED
package/server-app.js
CHANGED
|
@@ -248,7 +248,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
248
248
|
}, 10000);
|
|
249
249
|
// On data received (message)
|
|
250
250
|
ws.on('message', function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
251
|
-
var _a, _b, _c, _d, _e, data, messageId, type, method, serverRes, methodCall, subType, pub, supportMethod, serverRes;
|
|
251
|
+
var _a, _b, _c, _d, _e, data, messageId, type, method, serverRes, query, methodCall, subType, pub, supportMethod, serverRes;
|
|
252
252
|
var _this = this;
|
|
253
253
|
return __generator(this, function (_f) {
|
|
254
254
|
switch (_f.label) {
|
|
@@ -338,12 +338,34 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
338
338
|
if (!this._methodManager._methods[method].skipQueue) return [3 /*break*/, 1];
|
|
339
339
|
(_a = this._methodManager).callMethod.apply(_a, [ws, messageId, method].concat(data));
|
|
340
340
|
return [3 /*break*/, 5];
|
|
341
|
-
case 1:
|
|
341
|
+
case 1:
|
|
342
|
+
query = { $and: [
|
|
342
343
|
{ id_user: ws['id_user'] },
|
|
343
344
|
{ message_id: messageId },
|
|
344
|
-
{ method: method },
|
|
345
345
|
{ data: JSON.stringify(data) }
|
|
346
|
-
] }
|
|
346
|
+
] };
|
|
347
|
+
if (method !== 'updateDocumentOffline' && method !== 'updateDocumentPropsOffline') {
|
|
348
|
+
query.$and.push({ method: method });
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
if (method === 'updateDocumentOffline') {
|
|
352
|
+
query.$and.push({
|
|
353
|
+
$or: [
|
|
354
|
+
{ method: method },
|
|
355
|
+
{ method: 'updateDocument' }
|
|
356
|
+
]
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
else if (method === 'updateDocumentPropsOffline') {
|
|
360
|
+
query.$and.push({
|
|
361
|
+
$or: [
|
|
362
|
+
{ method: method },
|
|
363
|
+
{ method: 'updateDocumentProps' }
|
|
364
|
+
]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return [4 /*yield*/, method_call_collection_1.MethodCalls.findOne(query).exec()];
|
|
347
369
|
case 2:
|
|
348
370
|
methodCall = _f.sent();
|
|
349
371
|
if (!!methodCall) return [3 /*break*/, 4];
|