@ricado/api-client 2.4.0 → 2.4.2
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 +2 -1
- package/lib/Controllers/Lab/Site/ProbeCalibrationController.js +921 -0
- package/lib/Controllers/Lab/Site/SampleController.js +151 -47
- package/lib/Controllers/Lab/Site/SampleFailureReasonController.js +2 -1
- package/lib/Controllers/Lab/Site/index.js +3 -0
- package/lib/Models/Lab/Site/ProbeCalibrationModel.js +303 -0
- package/lib/Models/Lab/Site/SampleModel.js +46 -2
- package/lib/Models/Lab/Site/index.js +3 -0
- package/lib/PackageVersion.js +1 -1
- package/lib/index.d.ts +585 -19
- package/package.json +1 -1
- package/src/Controllers/Lab/Site/FruitProfileController.js +2 -1
- package/src/Controllers/Lab/Site/ProbeCalibrationController.js +1052 -0
- package/src/Controllers/Lab/Site/SampleController.js +157 -56
- package/src/Controllers/Lab/Site/SampleFailureReasonController.js +2 -1
- package/src/Controllers/Lab/Site/index.js +2 -0
- package/src/Models/Lab/Site/ProbeCalibrationModel.js +290 -0
- package/src/Models/Lab/Site/SampleModel.js +52 -2
- package/src/Models/Lab/Site/index.js +2 -0
- package/src/PackageVersion.js +1 -1
|
@@ -16,66 +16,46 @@ import SampleResultModel from '../../../Models/Lab/Site/SampleResultModel';
|
|
|
16
16
|
class SampleController
|
|
17
17
|
{
|
|
18
18
|
/**
|
|
19
|
-
* Retrieve
|
|
20
|
-
*
|
|
21
|
-
* Retrieves Temperature Data for a Sample
|
|
19
|
+
* Retrieve a Sample [GET /lab/sites/{siteId}/samples/{id}]
|
|
22
20
|
*
|
|
23
21
|
* @static
|
|
24
22
|
* @public
|
|
25
23
|
* @param {number} siteId The Site ID
|
|
26
24
|
* @param {string} id The Sample ID
|
|
27
|
-
* @return {Promise<
|
|
25
|
+
* @return {Promise<SampleModel>}
|
|
28
26
|
*/
|
|
29
|
-
static
|
|
27
|
+
static getOne(siteId, id)
|
|
30
28
|
{
|
|
31
29
|
return new Promise((resolve, reject) => {
|
|
32
30
|
RequestHelper.getRequest(`/lab/sites/${siteId}/samples/${id}`)
|
|
33
31
|
.then((result) => {
|
|
34
32
|
let resolveValue = (function(){
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return result.map((resultItem) => {
|
|
41
|
-
return (function(){
|
|
42
|
-
let resultItemObject = {};
|
|
43
|
-
|
|
44
|
-
if(typeof resultItem === 'object' && 'timestamp' in resultItem)
|
|
45
|
-
{
|
|
46
|
-
resultItemObject.timestamp = (function(){
|
|
47
|
-
if(typeof resultItem.timestamp !== 'string')
|
|
48
|
-
{
|
|
49
|
-
return new Date(String(resultItem.timestamp));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return new Date(resultItem.timestamp);
|
|
53
|
-
}());
|
|
54
|
-
}
|
|
55
|
-
else
|
|
56
|
-
{
|
|
57
|
-
resultItemObject.timestamp = new Date();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if(typeof resultItem === 'object' && 'temperature' in resultItem)
|
|
61
|
-
{
|
|
62
|
-
resultItemObject.temperature = (function(){
|
|
63
|
-
if(typeof resultItem.temperature !== 'number')
|
|
64
|
-
{
|
|
65
|
-
return Number(resultItem.temperature);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return resultItem.temperature;
|
|
69
|
-
}());
|
|
70
|
-
}
|
|
71
|
-
else
|
|
72
|
-
{
|
|
73
|
-
resultItemObject.temperature = 0;
|
|
74
|
-
}
|
|
33
|
+
return SampleModel.fromJSON(result, siteId);
|
|
34
|
+
}());
|
|
75
35
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
36
|
+
resolve(resolveValue);
|
|
37
|
+
})
|
|
38
|
+
.catch(error => reject(error));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Update a Sample [PATCH /lab/sites/{siteId}/samples/{id}]
|
|
44
|
+
*
|
|
45
|
+
* @static
|
|
46
|
+
* @public
|
|
47
|
+
* @param {number} siteId The Site ID
|
|
48
|
+
* @param {string} id The Sample ID
|
|
49
|
+
* @param {SampleController.UpdateData} updateData The Sample Update Data
|
|
50
|
+
* @return {Promise<SampleModel>}
|
|
51
|
+
*/
|
|
52
|
+
static update(siteId, id, updateData)
|
|
53
|
+
{
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
RequestHelper.patchRequest(`/lab/sites/${siteId}/samples/${id}`, updateData)
|
|
56
|
+
.then((result) => {
|
|
57
|
+
let resolveValue = (function(){
|
|
58
|
+
return SampleModel.fromJSON(result, siteId);
|
|
79
59
|
}());
|
|
80
60
|
|
|
81
61
|
resolve(resolveValue);
|
|
@@ -84,6 +64,26 @@ class SampleController
|
|
|
84
64
|
});
|
|
85
65
|
}
|
|
86
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Delete a Sample [DELETE /lab/sites/{siteId}/samples/{id}]
|
|
69
|
+
*
|
|
70
|
+
* @static
|
|
71
|
+
* @public
|
|
72
|
+
* @param {number} siteId The Site ID
|
|
73
|
+
* @param {string} id The Sample ID
|
|
74
|
+
* @return {Promise<boolean>}
|
|
75
|
+
*/
|
|
76
|
+
static delete(siteId, id)
|
|
77
|
+
{
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
RequestHelper.deleteRequest(`/lab/sites/${siteId}/samples/${id}`)
|
|
80
|
+
.then((result) => {
|
|
81
|
+
resolve(result ?? true);
|
|
82
|
+
})
|
|
83
|
+
.catch(error => reject(error));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
87
|
/**
|
|
88
88
|
* Retrieve Comments [GET /lab/sites/{siteId}/samples/{id}/comments]
|
|
89
89
|
*
|
|
@@ -918,6 +918,75 @@ class SampleController
|
|
|
918
918
|
});
|
|
919
919
|
}
|
|
920
920
|
|
|
921
|
+
/**
|
|
922
|
+
* Retrieve Temperature Data [GET /lab/sites/{siteId}/samples/{id}/temperature-data]
|
|
923
|
+
*
|
|
924
|
+
* Retrieves Temperature Data for a Sample
|
|
925
|
+
*
|
|
926
|
+
* @static
|
|
927
|
+
* @public
|
|
928
|
+
* @param {number} siteId The Site ID
|
|
929
|
+
* @param {string} id The Sample ID
|
|
930
|
+
* @return {Promise<Array<SampleController.TemperatureDataItem>>}
|
|
931
|
+
*/
|
|
932
|
+
static getTemperatureData(siteId, id)
|
|
933
|
+
{
|
|
934
|
+
return new Promise((resolve, reject) => {
|
|
935
|
+
RequestHelper.getRequest(`/lab/sites/${siteId}/samples/${id}/temperature-data`)
|
|
936
|
+
.then((result) => {
|
|
937
|
+
let resolveValue = (function(){
|
|
938
|
+
if(Array.isArray(result) !== true)
|
|
939
|
+
{
|
|
940
|
+
return [];
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
return result.map((resultItem) => {
|
|
944
|
+
return (function(){
|
|
945
|
+
let resultItemObject = {};
|
|
946
|
+
|
|
947
|
+
if(typeof resultItem === 'object' && 'timestamp' in resultItem)
|
|
948
|
+
{
|
|
949
|
+
resultItemObject.timestamp = (function(){
|
|
950
|
+
if(typeof resultItem.timestamp !== 'string')
|
|
951
|
+
{
|
|
952
|
+
return new Date(String(resultItem.timestamp));
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
return new Date(resultItem.timestamp);
|
|
956
|
+
}());
|
|
957
|
+
}
|
|
958
|
+
else
|
|
959
|
+
{
|
|
960
|
+
resultItemObject.timestamp = new Date();
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
if(typeof resultItem === 'object' && 'temperature' in resultItem)
|
|
964
|
+
{
|
|
965
|
+
resultItemObject.temperature = (function(){
|
|
966
|
+
if(typeof resultItem.temperature !== 'number')
|
|
967
|
+
{
|
|
968
|
+
return Number(resultItem.temperature);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
return resultItem.temperature;
|
|
972
|
+
}());
|
|
973
|
+
}
|
|
974
|
+
else
|
|
975
|
+
{
|
|
976
|
+
resultItemObject.temperature = 0;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
return resultItemObject;
|
|
980
|
+
}());
|
|
981
|
+
});
|
|
982
|
+
}());
|
|
983
|
+
|
|
984
|
+
resolve(resolveValue);
|
|
985
|
+
})
|
|
986
|
+
.catch(error => reject(error));
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
|
|
921
990
|
/**
|
|
922
991
|
* List all Samples [GET /lab/sites/{siteId}/samples]
|
|
923
992
|
*
|
|
@@ -985,8 +1054,8 @@ export default SampleController;
|
|
|
985
1054
|
* @property {string} [labId] The Lab ID this Sample is associated with
|
|
986
1055
|
* @property {string} [sampleNumber] The Numeric Sample Number
|
|
987
1056
|
* @property {string} [createdSource] The Source that Created this Sample
|
|
988
|
-
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is '
|
|
989
|
-
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is '
|
|
1057
|
+
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
1058
|
+
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
990
1059
|
* @property {?string} [publishUserId] ID of the User who Published this Sample
|
|
991
1060
|
* @property {?string} [publishUserName] Name of the User who Published this Sample
|
|
992
1061
|
* @property {string} [fruitProfileId] The Fruit Profile for this Sample
|
|
@@ -999,10 +1068,14 @@ export default SampleController;
|
|
|
999
1068
|
* @property {Date} [createdTimestampEnd] Filter by the Timestamp when Samples were Created. Results Less than or Equal to Timestamp
|
|
1000
1069
|
* @property {Date} [scheduledTimestampBegin] Filter by the Timestamp when Samples were Scheduled to Begin. Results Greater than or Equal to Timestamp
|
|
1001
1070
|
* @property {Date} [scheduledTimestampEnd] Filter by the Timestamp when Samples were Scheduled to Begin. Results Less than or Equal to Timestamp
|
|
1071
|
+
* @property {Date} [loadedTimestampBegin] Filter by the Timestamp when Samples were Loaded. Results Greater than or Equal to Timestamp
|
|
1072
|
+
* @property {Date} [loadedTimestampEnd] Filter by the Timestamp when Samples were Loaded. Results Less than or Equal to Timestamp
|
|
1002
1073
|
* @property {Date} [startTimestampBegin] Filter by the Timestamp when Samples were Started. Results Greater than or Equal to Timestamp
|
|
1003
1074
|
* @property {Date} [startTimestampEnd] Filter by the Timestamp when Samples were Started. Results Less than or Equal to Timestamp
|
|
1004
1075
|
* @property {Date} [finishTimestampBegin] Filter by the Timestamp when Samples were Finished. Results Greater than or Equal to Timestamp
|
|
1005
1076
|
* @property {Date} [finishTimestampEnd] Filter by the Timestamp when Samples were Finished. Results Less than or Equal to Timestamp
|
|
1077
|
+
* @property {Date} [unloadedTimestampBegin] Filter by the Timestamp when Samples were Unloaded. Results Greater than or Equal to Timestamp
|
|
1078
|
+
* @property {Date} [unloadedTimestampEnd] Filter by the Timestamp when Samples were Unloaded. Results Less than or Equal to Timestamp
|
|
1006
1079
|
* @property {Date} [publishTimestampBegin] Filter by the Timestamp when Samples were Published. Results Greater than or Equal to Timestamp
|
|
1007
1080
|
* @property {Date} [publishTimestampEnd] Filter by the Timestamp when Samples were Published. Results Less than or Equal to Timestamp
|
|
1008
1081
|
* @property {Date} [updateTimestampBegin] Filter by the Timestamp when Samples were last Updated. Results Greater than or Equal to Timestamp
|
|
@@ -1018,11 +1091,13 @@ export default SampleController;
|
|
|
1018
1091
|
* @property {string} [sampleNumber] The Numeric Sample Number
|
|
1019
1092
|
* @property {Date} [createdTimestamp] When this Sample was Created
|
|
1020
1093
|
* @property {string} createdSource The Source that Created this Sample
|
|
1021
|
-
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is '
|
|
1022
|
-
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is '
|
|
1094
|
+
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
1095
|
+
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
1023
1096
|
* @property {?Date} [scheduledTimestamp] Optional Scheduled Timestamp when this Sample should Begin
|
|
1097
|
+
* @property {?Date} [loadedTimestamp] When this Sample was Loaded into the Dehydrator
|
|
1024
1098
|
* @property {?Date} [startTimestamp] When this Sample was Started
|
|
1025
1099
|
* @property {?Date} [finishTimestamp] When this Sample was Finished
|
|
1100
|
+
* @property {?Date} [unloadedTimestamp] When this Sample was Unloaded from the Dehydrator
|
|
1026
1101
|
* @property {?Date} [publishTimestamp] When this Sample was Published
|
|
1027
1102
|
* @property {?string} [publishUserId] ID of the User who Published this Sample
|
|
1028
1103
|
* @property {?string} [publishUserName] Name of the User who Published this Sample
|
|
@@ -1036,11 +1111,28 @@ export default SampleController;
|
|
|
1036
1111
|
*/
|
|
1037
1112
|
|
|
1038
1113
|
/**
|
|
1039
|
-
*
|
|
1114
|
+
* The Update Data for a Sample
|
|
1040
1115
|
*
|
|
1041
|
-
* @typedef {Object} SampleController.
|
|
1042
|
-
* @property {
|
|
1043
|
-
* @property {
|
|
1116
|
+
* @typedef {Object} SampleController.UpdateData
|
|
1117
|
+
* @property {string} [labId] The Lab ID this Sample is associated with
|
|
1118
|
+
* @property {Date} [createdTimestamp] When this Sample was Created
|
|
1119
|
+
* @property {string} [createdSource] The Source that Created this Sample
|
|
1120
|
+
* @property {?string} [createdUserId] ID of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
1121
|
+
* @property {?string} [createdUserName] Name of the User who Created this Sample. Only applies if the `createdSource` is 'User'
|
|
1122
|
+
* @property {?Date} [scheduledTimestamp] Optional Scheduled Timestamp when this Sample should Begin
|
|
1123
|
+
* @property {?Date} [loadedTimestamp] When this Sample was Loaded into the Dehydrator
|
|
1124
|
+
* @property {?Date} [startTimestamp] When this Sample was Started
|
|
1125
|
+
* @property {?Date} [finishTimestamp] When this Sample was Finished
|
|
1126
|
+
* @property {?Date} [unloadedTimestamp] When this Sample was Unloaded from the Dehydrator
|
|
1127
|
+
* @property {?Date} [publishTimestamp] When this Sample was Published
|
|
1128
|
+
* @property {?string} [publishUserId] ID of the User who Published this Sample
|
|
1129
|
+
* @property {?string} [publishUserName] Name of the User who Published this Sample
|
|
1130
|
+
* @property {string} [fruitProfileId] The Fruit Profile for this Sample
|
|
1131
|
+
* @property {string} [rackPositionId] The Rack Position used for this Sample
|
|
1132
|
+
* @property {string} [dehydratorId] The Dehydrator used for this Sample
|
|
1133
|
+
* @property {?string} [outcome] The Outcome of this Sample
|
|
1134
|
+
* @property {?string} [failureReasonId] A Sample Failure Reason ID if this Sample Failed
|
|
1135
|
+
* @property {?string} [resultId] The Sample Result ID asociated with this Sample
|
|
1044
1136
|
* @memberof Controllers.Lab.Site
|
|
1045
1137
|
*/
|
|
1046
1138
|
|
|
@@ -1064,4 +1156,13 @@ export default SampleController;
|
|
|
1064
1156
|
* @property {?Date} createdTimestamp When the Comment was Created
|
|
1065
1157
|
* @property {?Date} updatedTimestamp When the Comment was last Updated
|
|
1066
1158
|
* @memberof Controllers.Lab.Site
|
|
1159
|
+
*/
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* A **TemperatureDataItem** Type
|
|
1163
|
+
*
|
|
1164
|
+
* @typedef {Object} SampleController.TemperatureDataItem
|
|
1165
|
+
* @property {Date} timestamp The Timestamp for the Temperature Value
|
|
1166
|
+
* @property {number} temperature The Temperature Value
|
|
1167
|
+
* @memberof Controllers.Lab.Site
|
|
1067
1168
|
*/
|
|
@@ -155,7 +155,7 @@ export default SampleFailureReasonController;
|
|
|
155
155
|
* The Create Data for a Sample Failure Reason
|
|
156
156
|
*
|
|
157
157
|
* @typedef {Object} SampleFailureReasonController.CreateData
|
|
158
|
-
* @property {string}
|
|
158
|
+
* @property {string} name The Sample Failure Reason Name
|
|
159
159
|
* @property {string} description The Sample Failure Reason Description
|
|
160
160
|
* @memberof Controllers.Lab.Site
|
|
161
161
|
*/
|
|
@@ -164,6 +164,7 @@ export default SampleFailureReasonController;
|
|
|
164
164
|
* The Update Data for a Sample Failure Reason
|
|
165
165
|
*
|
|
166
166
|
* @typedef {Object} SampleFailureReasonController.UpdateData
|
|
167
|
+
* @property {string} [name] The Sample Failure Reason Name
|
|
167
168
|
* @property {string} [description] The Sample Failure Reason Description
|
|
168
169
|
* @memberof Controllers.Lab.Site
|
|
169
170
|
*/
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import DehydratorController from './DehydratorController';
|
|
11
11
|
import FruitProfileController from './FruitProfileController';
|
|
12
12
|
import LabController from './LabController';
|
|
13
|
+
import ProbeCalibrationController from './ProbeCalibrationController';
|
|
13
14
|
import RackController from './RackController';
|
|
14
15
|
import RackPositionController from './RackPositionController';
|
|
15
16
|
import SampleController from './SampleController';
|
|
@@ -20,6 +21,7 @@ const Site = {
|
|
|
20
21
|
DehydratorController,
|
|
21
22
|
FruitProfileController,
|
|
22
23
|
LabController,
|
|
24
|
+
ProbeCalibrationController,
|
|
23
25
|
RackController,
|
|
24
26
|
RackPositionController,
|
|
25
27
|
SampleController,
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Auto-Generated by the RICADO Gen 4 PHP API Project
|
|
3
|
+
*
|
|
4
|
+
* Do Not Edit this File Manually!
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import BaseModel from '../../../Models/BaseModel';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Model Class for a Probe Calibration
|
|
11
|
+
*
|
|
12
|
+
* @class
|
|
13
|
+
* @hideconstructor
|
|
14
|
+
* @extends BaseModel
|
|
15
|
+
*/
|
|
16
|
+
class ProbeCalibrationModel extends BaseModel
|
|
17
|
+
{
|
|
18
|
+
/**
|
|
19
|
+
* ProbeCalibrationModel Constructor
|
|
20
|
+
*
|
|
21
|
+
* @protected
|
|
22
|
+
* @param {number} siteId The Site ID associated with this Probe Calibration
|
|
23
|
+
*/
|
|
24
|
+
constructor(siteId)
|
|
25
|
+
{
|
|
26
|
+
super();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The Probe Calibration ID
|
|
30
|
+
*
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
this.id = "";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The Rack Position ID this Probe Calibration is associated with
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
this.rackPositionId = "";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* When this Probe Calibration was Created
|
|
46
|
+
*
|
|
47
|
+
* @type {Date}
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
this.createdTimestamp = new Date();
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* ID of the User who Completed this Probe Calibration
|
|
54
|
+
*
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
this.userId = "";
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Name of the User who Completed this Probe Calibration
|
|
62
|
+
*
|
|
63
|
+
* @type {string}
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
this.userName = "";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The Calibration Offset prior to this Probe Calibration being Created
|
|
70
|
+
*
|
|
71
|
+
* @type {number}
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
this.preCalibrationOffset = 0;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The Calibration Offset after this Probe Calibration was Created
|
|
78
|
+
*
|
|
79
|
+
* @type {number}
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
this.postCalibrationOffset = 0;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The Temperature Probe reading prior to this Probe Calibration being Created
|
|
86
|
+
*
|
|
87
|
+
* @type {number}
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
this.preCalibrationTemperature = 0;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The Temperature Probe reading after this Probe Calibration was Created
|
|
94
|
+
*
|
|
95
|
+
* @type {number}
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
this.postCalibrationTemperature = 0;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Whether the Probe Calibration has been deleted
|
|
102
|
+
*
|
|
103
|
+
* @type {boolean}
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
this.deleted = false;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* When the Probe Calibration was last updated
|
|
110
|
+
*
|
|
111
|
+
* @type {Date}
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
this.updateTimestamp = new Date();
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The Site ID associated with this Probe Calibration
|
|
118
|
+
*
|
|
119
|
+
* @type {number}
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
this.siteId = siteId;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Create a new **ProbeCalibrationModel** from a JSON Object or JSON String
|
|
127
|
+
*
|
|
128
|
+
* @static
|
|
129
|
+
* @public
|
|
130
|
+
* @param {Object<string, any>|string} json A JSON Object or JSON String
|
|
131
|
+
* @param {number} siteId The Site ID associated with this Probe Calibration
|
|
132
|
+
* @return {ProbeCalibrationModel}
|
|
133
|
+
*/
|
|
134
|
+
static fromJSON(json, siteId)
|
|
135
|
+
{
|
|
136
|
+
let model = new ProbeCalibrationModel(siteId);
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The JSON Object
|
|
140
|
+
*
|
|
141
|
+
* @type {Object<string, any>}
|
|
142
|
+
*/
|
|
143
|
+
let jsonObject = {};
|
|
144
|
+
|
|
145
|
+
if(typeof json === 'string')
|
|
146
|
+
{
|
|
147
|
+
jsonObject = JSON.parse(json);
|
|
148
|
+
}
|
|
149
|
+
else if(typeof json === 'object')
|
|
150
|
+
{
|
|
151
|
+
jsonObject = json;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if('id' in jsonObject)
|
|
155
|
+
{
|
|
156
|
+
model.id = (function(){
|
|
157
|
+
if(typeof jsonObject['id'] !== 'string')
|
|
158
|
+
{
|
|
159
|
+
return String(jsonObject['id']);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return jsonObject['id'];
|
|
163
|
+
}());
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if('rackPositionId' in jsonObject)
|
|
167
|
+
{
|
|
168
|
+
model.rackPositionId = (function(){
|
|
169
|
+
if(typeof jsonObject['rackPositionId'] !== 'string')
|
|
170
|
+
{
|
|
171
|
+
return String(jsonObject['rackPositionId']);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return jsonObject['rackPositionId'];
|
|
175
|
+
}());
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if('createdTimestamp' in jsonObject)
|
|
179
|
+
{
|
|
180
|
+
model.createdTimestamp = (function(){
|
|
181
|
+
if(typeof jsonObject['createdTimestamp'] !== 'string')
|
|
182
|
+
{
|
|
183
|
+
return new Date(String(jsonObject['createdTimestamp']));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return new Date(jsonObject['createdTimestamp']);
|
|
187
|
+
}());
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if('userId' in jsonObject)
|
|
191
|
+
{
|
|
192
|
+
model.userId = (function(){
|
|
193
|
+
if(typeof jsonObject['userId'] !== 'string')
|
|
194
|
+
{
|
|
195
|
+
return String(jsonObject['userId']);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return jsonObject['userId'];
|
|
199
|
+
}());
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if('userName' in jsonObject)
|
|
203
|
+
{
|
|
204
|
+
model.userName = (function(){
|
|
205
|
+
if(typeof jsonObject['userName'] !== 'string')
|
|
206
|
+
{
|
|
207
|
+
return String(jsonObject['userName']);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return jsonObject['userName'];
|
|
211
|
+
}());
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if('preCalibrationOffset' in jsonObject)
|
|
215
|
+
{
|
|
216
|
+
model.preCalibrationOffset = (function(){
|
|
217
|
+
if(typeof jsonObject['preCalibrationOffset'] !== 'number')
|
|
218
|
+
{
|
|
219
|
+
return Number(jsonObject['preCalibrationOffset']);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return jsonObject['preCalibrationOffset'];
|
|
223
|
+
}());
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if('postCalibrationOffset' in jsonObject)
|
|
227
|
+
{
|
|
228
|
+
model.postCalibrationOffset = (function(){
|
|
229
|
+
if(typeof jsonObject['postCalibrationOffset'] !== 'number')
|
|
230
|
+
{
|
|
231
|
+
return Number(jsonObject['postCalibrationOffset']);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return jsonObject['postCalibrationOffset'];
|
|
235
|
+
}());
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if('preCalibrationTemperature' in jsonObject)
|
|
239
|
+
{
|
|
240
|
+
model.preCalibrationTemperature = (function(){
|
|
241
|
+
if(typeof jsonObject['preCalibrationTemperature'] !== 'number')
|
|
242
|
+
{
|
|
243
|
+
return Number(jsonObject['preCalibrationTemperature']);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return jsonObject['preCalibrationTemperature'];
|
|
247
|
+
}());
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if('postCalibrationTemperature' in jsonObject)
|
|
251
|
+
{
|
|
252
|
+
model.postCalibrationTemperature = (function(){
|
|
253
|
+
if(typeof jsonObject['postCalibrationTemperature'] !== 'number')
|
|
254
|
+
{
|
|
255
|
+
return Number(jsonObject['postCalibrationTemperature']);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return jsonObject['postCalibrationTemperature'];
|
|
259
|
+
}());
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if('deleted' in jsonObject)
|
|
263
|
+
{
|
|
264
|
+
model.deleted = (function(){
|
|
265
|
+
if(typeof jsonObject['deleted'] !== 'boolean')
|
|
266
|
+
{
|
|
267
|
+
return Boolean(jsonObject['deleted']);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return jsonObject['deleted'];
|
|
271
|
+
}());
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if('updateTimestamp' in jsonObject)
|
|
275
|
+
{
|
|
276
|
+
model.updateTimestamp = (function(){
|
|
277
|
+
if(typeof jsonObject['updateTimestamp'] !== 'string')
|
|
278
|
+
{
|
|
279
|
+
return new Date(String(jsonObject['updateTimestamp']));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return new Date(jsonObject['updateTimestamp']);
|
|
283
|
+
}());
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return model;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export default ProbeCalibrationModel;
|