@ricado/api-client 2.4.2 → 2.5.0
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/dist/ricado.api.client.js +1 -1
- package/lib/Controllers/Lab/Site/FruitProfileController.js +10 -8
- package/lib/Controllers/Lab/Site/RackPositionController.js +2 -2
- package/lib/Controllers/Lab/Site/SampleController.js +7 -15
- package/lib/Controllers/Lab/Site/SampleResultController.js +29 -27
- package/lib/Controllers/Lab/Site/index.js +0 -3
- package/lib/Models/Lab/Site/FruitProfileModel.js +22 -4
- package/lib/Models/Lab/Site/RackPositionModel.js +67 -15
- package/lib/Models/Lab/Site/SampleModel.js +9 -75
- package/lib/Models/Lab/Site/SampleResultModel.js +45 -23
- package/lib/Models/Lab/Site/index.js +0 -3
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +119 -309
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/FruitProfileController.js +10 -8
- package/src/Controllers/Lab/Site/RackPositionController.js +2 -2
- package/src/Controllers/Lab/Site/SampleController.js +7 -15
- package/src/Controllers/Lab/Site/SampleResultController.js +29 -27
- package/src/Controllers/Lab/Site/index.js +0 -2
- package/src/Models/Lab/Site/FruitProfileModel.js +24 -4
- package/src/Models/Lab/Site/RackPositionModel.js +87 -15
- package/src/Models/Lab/Site/SampleModel.js +9 -84
- package/src/Models/Lab/Site/SampleResultModel.js +48 -23
- package/src/Models/Lab/Site/index.js +0 -2
- package/src/PackageVersion.js +1 -1
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +0 -193
- package/lib/Models/Lab/Site/SampleFailureReasonModel.js +0 -195
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +0 -170
- package/src/Models/Lab/Site/SampleFailureReasonModel.js +0 -170
|
@@ -66,15 +66,7 @@ class SampleModel extends BaseModel
|
|
|
66
66
|
this.createdSource = "";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* @type {?string}
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
this.createdUserId = null;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Name of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
69
|
+
* Name of the User who Created this Sample
|
|
78
70
|
*
|
|
79
71
|
* @type {?string}
|
|
80
72
|
* @public
|
|
@@ -130,12 +122,12 @@ class SampleModel extends BaseModel
|
|
|
130
122
|
this.publishTimestamp = null;
|
|
131
123
|
|
|
132
124
|
/**
|
|
133
|
-
*
|
|
125
|
+
* The Source that Published this Sample
|
|
134
126
|
*
|
|
135
127
|
* @type {?string}
|
|
136
128
|
* @public
|
|
137
129
|
*/
|
|
138
|
-
this.
|
|
130
|
+
this.publishSource = null;
|
|
139
131
|
|
|
140
132
|
/**
|
|
141
133
|
* Name of the User who Published this Sample
|
|
@@ -169,22 +161,6 @@ class SampleModel extends BaseModel
|
|
|
169
161
|
*/
|
|
170
162
|
this.dehydratorId = "";
|
|
171
163
|
|
|
172
|
-
/**
|
|
173
|
-
* The Outcome of this Sample
|
|
174
|
-
*
|
|
175
|
-
* @type {?string}
|
|
176
|
-
* @public
|
|
177
|
-
*/
|
|
178
|
-
this.outcome = null;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* A Sample Failure Reason ID if this Sample Failed
|
|
182
|
-
*
|
|
183
|
-
* @type {?string}
|
|
184
|
-
* @public
|
|
185
|
-
*/
|
|
186
|
-
this.failureReasonId = null;
|
|
187
|
-
|
|
188
164
|
/**
|
|
189
165
|
* The Sample Result ID asociated with this Sample
|
|
190
166
|
*
|
|
@@ -315,23 +291,6 @@ class SampleModel extends BaseModel
|
|
|
315
291
|
}());
|
|
316
292
|
}
|
|
317
293
|
|
|
318
|
-
if('createdUserId' in jsonObject)
|
|
319
|
-
{
|
|
320
|
-
model.createdUserId = (function(){
|
|
321
|
-
if(jsonObject['createdUserId'] === null)
|
|
322
|
-
{
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if(typeof jsonObject['createdUserId'] !== 'string')
|
|
327
|
-
{
|
|
328
|
-
return String(jsonObject['createdUserId']);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return jsonObject['createdUserId'];
|
|
332
|
-
}());
|
|
333
|
-
}
|
|
334
|
-
|
|
335
294
|
if('createdUserName' in jsonObject)
|
|
336
295
|
{
|
|
337
296
|
model.createdUserName = (function(){
|
|
@@ -451,20 +410,20 @@ class SampleModel extends BaseModel
|
|
|
451
410
|
}());
|
|
452
411
|
}
|
|
453
412
|
|
|
454
|
-
if('
|
|
413
|
+
if('publishSource' in jsonObject)
|
|
455
414
|
{
|
|
456
|
-
model.
|
|
457
|
-
if(jsonObject['
|
|
415
|
+
model.publishSource = (function(){
|
|
416
|
+
if(jsonObject['publishSource'] === null)
|
|
458
417
|
{
|
|
459
418
|
return null;
|
|
460
419
|
}
|
|
461
420
|
|
|
462
|
-
if(typeof jsonObject['
|
|
421
|
+
if(typeof jsonObject['publishSource'] !== 'string')
|
|
463
422
|
{
|
|
464
|
-
return String(jsonObject['
|
|
423
|
+
return String(jsonObject['publishSource']);
|
|
465
424
|
}
|
|
466
425
|
|
|
467
|
-
return jsonObject['
|
|
426
|
+
return jsonObject['publishSource'];
|
|
468
427
|
}());
|
|
469
428
|
}
|
|
470
429
|
|
|
@@ -521,40 +480,6 @@ class SampleModel extends BaseModel
|
|
|
521
480
|
}());
|
|
522
481
|
}
|
|
523
482
|
|
|
524
|
-
if('outcome' in jsonObject)
|
|
525
|
-
{
|
|
526
|
-
model.outcome = (function(){
|
|
527
|
-
if(jsonObject['outcome'] === null)
|
|
528
|
-
{
|
|
529
|
-
return null;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
if(typeof jsonObject['outcome'] !== 'string')
|
|
533
|
-
{
|
|
534
|
-
return String(jsonObject['outcome']);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
return jsonObject['outcome'];
|
|
538
|
-
}());
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if('failureReasonId' in jsonObject)
|
|
542
|
-
{
|
|
543
|
-
model.failureReasonId = (function(){
|
|
544
|
-
if(jsonObject['failureReasonId'] === null)
|
|
545
|
-
{
|
|
546
|
-
return null;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if(typeof jsonObject['failureReasonId'] !== 'string')
|
|
550
|
-
{
|
|
551
|
-
return String(jsonObject['failureReasonId']);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
return jsonObject['failureReasonId'];
|
|
555
|
-
}());
|
|
556
|
-
}
|
|
557
|
-
|
|
558
483
|
if('resultId' in jsonObject)
|
|
559
484
|
{
|
|
560
485
|
model.resultId = (function(){
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import BaseModel from '../../../Models/BaseModel';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Model Class for a Sample
|
|
10
|
+
* Model Class for a Sample Result
|
|
11
11
|
*
|
|
12
12
|
* @class
|
|
13
13
|
* @hideconstructor
|
|
@@ -19,14 +19,14 @@ class SampleResultModel extends BaseModel
|
|
|
19
19
|
* SampleResultModel Constructor
|
|
20
20
|
*
|
|
21
21
|
* @protected
|
|
22
|
-
* @param {number} siteId The Site ID associated with this Sample
|
|
22
|
+
* @param {number} siteId The Site ID associated with this Sample Result
|
|
23
23
|
*/
|
|
24
24
|
constructor(siteId)
|
|
25
25
|
{
|
|
26
26
|
super();
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* The Sample
|
|
29
|
+
* The Sample Result ID
|
|
30
30
|
*
|
|
31
31
|
* @type {string}
|
|
32
32
|
* @public
|
|
@@ -106,20 +106,20 @@ class SampleResultModel extends BaseModel
|
|
|
106
106
|
this.withinTargetDuration = 0;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* Timestamp of when the
|
|
109
|
+
* Timestamp of when the Finish Criteria was Met for the Sample - `null` if not Met
|
|
110
110
|
*
|
|
111
111
|
* @type {?Date}
|
|
112
112
|
* @public
|
|
113
113
|
*/
|
|
114
|
-
this.
|
|
114
|
+
this.finishCriteriaMetTimestamp = null;
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* Timestamp of when the
|
|
117
|
+
* Latest Possible Timestamp of when the Sample should have been Unloaded to remain Compliant
|
|
118
118
|
*
|
|
119
119
|
* @type {?Date}
|
|
120
120
|
* @public
|
|
121
121
|
*/
|
|
122
|
-
this.
|
|
122
|
+
this.latestUnloadTimestamp = null;
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* The Average Temperature for the Total Duration of the Sample
|
|
@@ -129,6 +129,14 @@ class SampleResultModel extends BaseModel
|
|
|
129
129
|
*/
|
|
130
130
|
this.totalAverageTemperature = null;
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* The Average Temperature Rate-of-Change seen during the Warm Up process for the Sample
|
|
134
|
+
*
|
|
135
|
+
* @type {?number}
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
this.warmUpRateOfChangeTemperature = null;
|
|
139
|
+
|
|
132
140
|
/**
|
|
133
141
|
* The Minimum Temperature seen Below the Temperature Target for the Sample
|
|
134
142
|
*
|
|
@@ -186,7 +194,7 @@ class SampleResultModel extends BaseModel
|
|
|
186
194
|
this.withinTargetAverageTemperature = null;
|
|
187
195
|
|
|
188
196
|
/**
|
|
189
|
-
* Whether the Sample
|
|
197
|
+
* Whether the Sample Result has been deleted
|
|
190
198
|
*
|
|
191
199
|
* @type {boolean}
|
|
192
200
|
* @public
|
|
@@ -194,7 +202,7 @@ class SampleResultModel extends BaseModel
|
|
|
194
202
|
this.deleted = false;
|
|
195
203
|
|
|
196
204
|
/**
|
|
197
|
-
* When the Sample
|
|
205
|
+
* When the Sample Result was last updated
|
|
198
206
|
*
|
|
199
207
|
* @type {Date}
|
|
200
208
|
* @public
|
|
@@ -202,7 +210,7 @@ class SampleResultModel extends BaseModel
|
|
|
202
210
|
this.updateTimestamp = new Date();
|
|
203
211
|
|
|
204
212
|
/**
|
|
205
|
-
* The Site ID associated with this Sample
|
|
213
|
+
* The Site ID associated with this Sample Result
|
|
206
214
|
*
|
|
207
215
|
* @type {number}
|
|
208
216
|
* @public
|
|
@@ -216,7 +224,7 @@ class SampleResultModel extends BaseModel
|
|
|
216
224
|
* @static
|
|
217
225
|
* @public
|
|
218
226
|
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
219
|
-
* @param {number} siteId The Site ID associated with this Sample
|
|
227
|
+
* @param {number} siteId The Site ID associated with this Sample Result
|
|
220
228
|
* @return {SampleResultModel}
|
|
221
229
|
*/
|
|
222
230
|
static fromJSON(json, siteId)
|
|
@@ -364,37 +372,37 @@ class SampleResultModel extends BaseModel
|
|
|
364
372
|
}());
|
|
365
373
|
}
|
|
366
374
|
|
|
367
|
-
if('
|
|
375
|
+
if('finishCriteriaMetTimestamp' in jsonObject)
|
|
368
376
|
{
|
|
369
|
-
model.
|
|
370
|
-
if(jsonObject['
|
|
377
|
+
model.finishCriteriaMetTimestamp = (function(){
|
|
378
|
+
if(jsonObject['finishCriteriaMetTimestamp'] === null)
|
|
371
379
|
{
|
|
372
380
|
return null;
|
|
373
381
|
}
|
|
374
382
|
|
|
375
|
-
if(typeof jsonObject['
|
|
383
|
+
if(typeof jsonObject['finishCriteriaMetTimestamp'] !== 'string')
|
|
376
384
|
{
|
|
377
|
-
return new Date(String(jsonObject['
|
|
385
|
+
return new Date(String(jsonObject['finishCriteriaMetTimestamp']));
|
|
378
386
|
}
|
|
379
387
|
|
|
380
|
-
return new Date(jsonObject['
|
|
388
|
+
return new Date(jsonObject['finishCriteriaMetTimestamp']);
|
|
381
389
|
}());
|
|
382
390
|
}
|
|
383
391
|
|
|
384
|
-
if('
|
|
392
|
+
if('latestUnloadTimestamp' in jsonObject)
|
|
385
393
|
{
|
|
386
|
-
model.
|
|
387
|
-
if(jsonObject['
|
|
394
|
+
model.latestUnloadTimestamp = (function(){
|
|
395
|
+
if(jsonObject['latestUnloadTimestamp'] === null)
|
|
388
396
|
{
|
|
389
397
|
return null;
|
|
390
398
|
}
|
|
391
399
|
|
|
392
|
-
if(typeof jsonObject['
|
|
400
|
+
if(typeof jsonObject['latestUnloadTimestamp'] !== 'string')
|
|
393
401
|
{
|
|
394
|
-
return new Date(String(jsonObject['
|
|
402
|
+
return new Date(String(jsonObject['latestUnloadTimestamp']));
|
|
395
403
|
}
|
|
396
404
|
|
|
397
|
-
return new Date(jsonObject['
|
|
405
|
+
return new Date(jsonObject['latestUnloadTimestamp']);
|
|
398
406
|
}());
|
|
399
407
|
}
|
|
400
408
|
|
|
@@ -415,6 +423,23 @@ class SampleResultModel extends BaseModel
|
|
|
415
423
|
}());
|
|
416
424
|
}
|
|
417
425
|
|
|
426
|
+
if('warmUpRateOfChangeTemperature' in jsonObject)
|
|
427
|
+
{
|
|
428
|
+
model.warmUpRateOfChangeTemperature = (function(){
|
|
429
|
+
if(jsonObject['warmUpRateOfChangeTemperature'] === null)
|
|
430
|
+
{
|
|
431
|
+
return null;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if(typeof jsonObject['warmUpRateOfChangeTemperature'] !== 'number')
|
|
435
|
+
{
|
|
436
|
+
return Number(jsonObject['warmUpRateOfChangeTemperature']);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return jsonObject['warmUpRateOfChangeTemperature'];
|
|
440
|
+
}());
|
|
441
|
+
}
|
|
442
|
+
|
|
418
443
|
if('belowTargetMinimumTemperature' in jsonObject)
|
|
419
444
|
{
|
|
420
445
|
model.belowTargetMinimumTemperature = (function(){
|
|
@@ -13,7 +13,6 @@ import LabModel from './LabModel';
|
|
|
13
13
|
import ProbeCalibrationModel from './ProbeCalibrationModel';
|
|
14
14
|
import RackModel from './RackModel';
|
|
15
15
|
import RackPositionModel from './RackPositionModel';
|
|
16
|
-
import SampleFailureReasonModel from './SampleFailureReasonModel';
|
|
17
16
|
import SampleModel from './SampleModel';
|
|
18
17
|
import SampleResultModel from './SampleResultModel';
|
|
19
18
|
|
|
@@ -24,7 +23,6 @@ const Site = {
|
|
|
24
23
|
ProbeCalibrationModel,
|
|
25
24
|
RackModel,
|
|
26
25
|
RackPositionModel,
|
|
27
|
-
SampleFailureReasonModel,
|
|
28
26
|
SampleModel,
|
|
29
27
|
SampleResultModel,
|
|
30
28
|
};
|
package/src/PackageVersion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '2.
|
|
2
|
+
export const version = '2.5.0';
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _RequestHelper = _interopRequireDefault(require("../../../RequestHelper"));
|
|
9
|
-
|
|
10
|
-
var _SampleFailureReasonModel = _interopRequireDefault(require("../../../Models/Lab/Site/SampleFailureReasonModel"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
-
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Controller Class for Sample Failure Reasons
|
|
22
|
-
*
|
|
23
|
-
* @class
|
|
24
|
-
*/
|
|
25
|
-
var SampleFailureReasonController = /*#__PURE__*/function () {
|
|
26
|
-
function SampleFailureReasonController() {
|
|
27
|
-
_classCallCheck(this, SampleFailureReasonController);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_createClass(SampleFailureReasonController, null, [{
|
|
31
|
-
key: "getOne",
|
|
32
|
-
value:
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve a Sample Failure Reason [GET /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
35
|
-
*
|
|
36
|
-
* @static
|
|
37
|
-
* @public
|
|
38
|
-
* @param {number} siteId The Site ID
|
|
39
|
-
* @param {string} id The Sample Failure Reason ID
|
|
40
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
41
|
-
*/
|
|
42
|
-
function getOne(siteId, id) {
|
|
43
|
-
return new Promise(function (resolve, reject) {
|
|
44
|
-
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons/").concat(id)).then(function (result) {
|
|
45
|
-
var resolveValue = function () {
|
|
46
|
-
return _SampleFailureReasonModel.default.fromJSON(result, siteId);
|
|
47
|
-
}();
|
|
48
|
-
|
|
49
|
-
resolve(resolveValue);
|
|
50
|
-
}).catch(function (error) {
|
|
51
|
-
return reject(error);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Update a Sample Failure Reason [PATCH /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
57
|
-
*
|
|
58
|
-
* @static
|
|
59
|
-
* @public
|
|
60
|
-
* @param {number} siteId The Site ID
|
|
61
|
-
* @param {string} id The Sample Failure Reason ID
|
|
62
|
-
* @param {SampleFailureReasonController.UpdateData} updateData The Sample Failure Reason Update Data
|
|
63
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
}, {
|
|
67
|
-
key: "update",
|
|
68
|
-
value: function update(siteId, id, updateData) {
|
|
69
|
-
return new Promise(function (resolve, reject) {
|
|
70
|
-
_RequestHelper.default.patchRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons/").concat(id), updateData).then(function (result) {
|
|
71
|
-
var resolveValue = function () {
|
|
72
|
-
return _SampleFailureReasonModel.default.fromJSON(result, siteId);
|
|
73
|
-
}();
|
|
74
|
-
|
|
75
|
-
resolve(resolveValue);
|
|
76
|
-
}).catch(function (error) {
|
|
77
|
-
return reject(error);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Delete a Sample Failure Reason [DELETE /lab/sites/{siteId}/sample-failure-reasons/{id}]
|
|
83
|
-
*
|
|
84
|
-
* @static
|
|
85
|
-
* @public
|
|
86
|
-
* @param {number} siteId The Site ID
|
|
87
|
-
* @param {string} id The Sample Failure Reason ID
|
|
88
|
-
* @return {Promise<boolean>}
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
}, {
|
|
92
|
-
key: "delete",
|
|
93
|
-
value: function _delete(siteId, id) {
|
|
94
|
-
return new Promise(function (resolve, reject) {
|
|
95
|
-
_RequestHelper.default.deleteRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons/").concat(id)).then(function (result) {
|
|
96
|
-
resolve(result !== null && result !== void 0 ? result : true);
|
|
97
|
-
}).catch(function (error) {
|
|
98
|
-
return reject(error);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* List all Sample Failure Reasons [GET /lab/sites/{siteId}/sample-failure-reasons]
|
|
104
|
-
*
|
|
105
|
-
* @static
|
|
106
|
-
* @public
|
|
107
|
-
* @param {number} siteId The Site ID
|
|
108
|
-
* @param {SampleFailureReasonController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
109
|
-
* @return {Promise<SampleFailureReasonModel[]>}
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
}, {
|
|
113
|
-
key: "getAll",
|
|
114
|
-
value: function getAll(siteId) {
|
|
115
|
-
var queryParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
116
|
-
return new Promise(function (resolve, reject) {
|
|
117
|
-
_RequestHelper.default.getRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons"), queryParameters).then(function (result) {
|
|
118
|
-
var resolveValue = function () {
|
|
119
|
-
if (Array.isArray(result) !== true) {
|
|
120
|
-
return [];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return result.map(function (resultItem) {
|
|
124
|
-
return function () {
|
|
125
|
-
return _SampleFailureReasonModel.default.fromJSON(resultItem, siteId);
|
|
126
|
-
}();
|
|
127
|
-
});
|
|
128
|
-
}();
|
|
129
|
-
|
|
130
|
-
resolve(resolveValue);
|
|
131
|
-
}).catch(function (error) {
|
|
132
|
-
return reject(error);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Create a Sample Failure Reason [POST /lab/sites/{siteId}/sample-failure-reasons]
|
|
138
|
-
*
|
|
139
|
-
* @static
|
|
140
|
-
* @public
|
|
141
|
-
* @param {number} siteId The Site ID
|
|
142
|
-
* @param {SampleFailureReasonController.CreateData} createData The Sample Failure Reason Create Data
|
|
143
|
-
* @return {Promise<SampleFailureReasonModel>}
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
}, {
|
|
147
|
-
key: "create",
|
|
148
|
-
value: function create(siteId, createData) {
|
|
149
|
-
return new Promise(function (resolve, reject) {
|
|
150
|
-
_RequestHelper.default.postRequest("/lab/sites/".concat(siteId, "/sample-failure-reasons"), createData).then(function (result) {
|
|
151
|
-
var resolveValue = function () {
|
|
152
|
-
return _SampleFailureReasonModel.default.fromJSON(result, siteId);
|
|
153
|
-
}();
|
|
154
|
-
|
|
155
|
-
resolve(resolveValue);
|
|
156
|
-
}).catch(function (error) {
|
|
157
|
-
return reject(error);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}]);
|
|
162
|
-
|
|
163
|
-
return SampleFailureReasonController;
|
|
164
|
-
}();
|
|
165
|
-
|
|
166
|
-
var _default = SampleFailureReasonController;
|
|
167
|
-
/**
|
|
168
|
-
* The Optional Query Parameters for the getAll Function
|
|
169
|
-
*
|
|
170
|
-
* @typedef {Object} SampleFailureReasonController.GetAllQueryParameters
|
|
171
|
-
* @property {string} [name] The Sample Failure Reason Name
|
|
172
|
-
* @memberof Controllers.Lab.Site
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* The Create Data for a Sample Failure Reason
|
|
177
|
-
*
|
|
178
|
-
* @typedef {Object} SampleFailureReasonController.CreateData
|
|
179
|
-
* @property {string} name The Sample Failure Reason Name
|
|
180
|
-
* @property {string} description The Sample Failure Reason Description
|
|
181
|
-
* @memberof Controllers.Lab.Site
|
|
182
|
-
*/
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* The Update Data for a Sample Failure Reason
|
|
186
|
-
*
|
|
187
|
-
* @typedef {Object} SampleFailureReasonController.UpdateData
|
|
188
|
-
* @property {string} [name] The Sample Failure Reason Name
|
|
189
|
-
* @property {string} [description] The Sample Failure Reason Description
|
|
190
|
-
* @memberof Controllers.Lab.Site
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
exports.default = _default;
|