@ricado/api-client 2.1.0 → 2.3.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/README.md +5 -7
- package/dist/ricado.api.client.js +1 -1
- package/lib/Controllers/Packhouse/Site/BinTipBinController.js +622 -0
- package/lib/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
- package/lib/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +657 -0
- package/lib/Controllers/Packhouse/Site/PackingLineController.js +25 -1
- package/lib/Controllers/Packhouse/Site/PackrunController.js +42 -0
- package/lib/Controllers/Packhouse/Site/RejectBinScaleController.js +24 -2
- package/lib/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
- package/lib/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +661 -0
- package/lib/Controllers/Packhouse/Site/ShiftTaskController.js +628 -0
- package/lib/Controllers/Packhouse/Site/SoftSortBeltController.js +453 -0
- package/lib/Controllers/Packhouse/Site/index.js +15 -0
- package/lib/DataItems/PointValueItem.js +3 -3
- package/lib/Models/AccountPolicyModel.js +7 -7
- package/lib/Models/ApiAccountModel.js +7 -7
- package/lib/Models/CompanyModel.js +5 -5
- package/lib/Models/FirebaseTokenModel.js +8 -8
- package/lib/Models/Packhouse/Site/BinTipBinModel.js +367 -0
- package/lib/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
- package/lib/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
- package/lib/Models/Packhouse/Site/CompacSizerModel.js +15 -15
- package/lib/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
- package/lib/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
- package/lib/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
- package/lib/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
- package/lib/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
- package/lib/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
- package/lib/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +481 -0
- package/lib/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
- package/lib/Models/Packhouse/Site/PackTypeModel.js +8 -8
- package/lib/Models/Packhouse/Site/PackingLineModel.js +539 -16
- package/lib/Models/Packhouse/Site/PackrunModel.js +81 -15
- package/lib/Models/Packhouse/Site/RejectBinModel.js +9 -9
- package/lib/Models/Packhouse/Site/RejectBinScaleModel.js +271 -15
- package/lib/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
- package/lib/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
- package/lib/Models/Packhouse/Site/ShiftHourlyEntryModel.js +204 -38
- package/lib/Models/Packhouse/Site/ShiftModel.js +26 -19
- package/lib/Models/Packhouse/Site/ShiftQualitySummaryModel.js +599 -0
- package/lib/Models/Packhouse/Site/ShiftTaskModel.js +373 -0
- package/lib/Models/Packhouse/Site/SoftSortBeltModel.js +235 -0
- package/lib/Models/Packhouse/Site/VarietyModel.js +8 -8
- package/lib/Models/Packhouse/Site/index.js +15 -0
- package/lib/Models/RTUModel.js +6 -6
- package/lib/Models/RTUPluginModel.js +5 -5
- package/lib/Models/Site/AlarmGroupModel.js +7 -7
- package/lib/Models/Site/AlarmModel.js +17 -17
- package/lib/Models/Site/DefinitionModel.js +6 -6
- package/lib/Models/Site/PermanentObjectDataModel.js +8 -8
- package/lib/Models/Site/PermanentObjectModel.js +7 -7
- package/lib/Models/Site/PointModel.js +11 -11
- package/lib/Models/Site/TemporaryObjectModel.js +6 -6
- package/lib/Models/SiteModel.js +6 -6
- package/lib/Models/TokenModel.js +10 -10
- package/lib/Models/UserAccountActionTokenModel.js +11 -11
- package/lib/Models/UserAccountModel.js +10 -10
- package/lib/PackageVersion.js +1 -1
- package/lib/Points.js +22 -12
- package/lib/WebSocketHelper.js +29 -13
- package/lib/index.d.ts +3853 -1290
- package/lib/index.js +3 -3
- package/package.json +1 -1
- package/src/Controllers/Packhouse/Site/BinTipBinController.js +665 -0
- package/src/Controllers/Packhouse/Site/CompacSizerController.js +3 -3
- package/src/Controllers/Packhouse/Site/FreshQualityPackrunSummaryController.js +700 -0
- package/src/Controllers/Packhouse/Site/PackingLineController.js +25 -1
- package/src/Controllers/Packhouse/Site/PackrunController.js +52 -0
- package/src/Controllers/Packhouse/Site/RejectBinScaleController.js +24 -2
- package/src/Controllers/Packhouse/Site/ShiftHourlyEntryController.js +15 -0
- package/src/Controllers/Packhouse/Site/ShiftQualitySummaryController.js +704 -0
- package/src/Controllers/Packhouse/Site/ShiftTaskController.js +671 -0
- package/src/Controllers/Packhouse/Site/SoftSortBeltController.js +474 -0
- package/src/Controllers/Packhouse/Site/index.js +10 -0
- package/src/DataItems/PointValueItem.js +3 -3
- package/src/Models/AccountPolicyModel.js +7 -7
- package/src/Models/ApiAccountModel.js +7 -7
- package/src/Models/CompanyModel.js +5 -5
- package/src/Models/FirebaseTokenModel.js +8 -8
- package/src/Models/Packhouse/Site/BinTipBinModel.js +365 -0
- package/src/Models/Packhouse/Site/BinTipWeightModel.js +9 -9
- package/src/Models/Packhouse/Site/CompacSizerBatchModel.js +8 -8
- package/src/Models/Packhouse/Site/CompacSizerModel.js +15 -15
- package/src/Models/Packhouse/Site/CompacSizerOutletProductChangeModel.js +10 -10
- package/src/Models/Packhouse/Site/CompacSizerOutletTypeChangeModel.js +8 -8
- package/src/Models/Packhouse/Site/CompacSizerOutletTypeModel.js +6 -6
- package/src/Models/Packhouse/Site/CompacSizerPackrunSummaryModel.js +12 -12
- package/src/Models/Packhouse/Site/DowntimeEventModel.js +14 -14
- package/src/Models/Packhouse/Site/FreshPackPackrunSummaryModel.js +8 -8
- package/src/Models/Packhouse/Site/FreshQualityPackrunSummaryModel.js +523 -0
- package/src/Models/Packhouse/Site/GrowingMethodModel.js +6 -6
- package/src/Models/Packhouse/Site/PackTypeModel.js +8 -8
- package/src/Models/Packhouse/Site/PackingLineModel.js +720 -16
- package/src/Models/Packhouse/Site/PackrunModel.js +90 -15
- package/src/Models/Packhouse/Site/RejectBinModel.js +9 -9
- package/src/Models/Packhouse/Site/RejectBinScaleModel.js +308 -15
- package/src/Models/Packhouse/Site/RejectBinWeightModel.js +10 -10
- package/src/Models/Packhouse/Site/ShiftFocusMeetingModel.js +12 -12
- package/src/Models/Packhouse/Site/ShiftHourlyEntryModel.js +229 -38
- package/src/Models/Packhouse/Site/ShiftModel.js +29 -19
- package/src/Models/Packhouse/Site/ShiftQualitySummaryModel.js +664 -0
- package/src/Models/Packhouse/Site/ShiftTaskModel.js +369 -0
- package/src/Models/Packhouse/Site/SoftSortBeltModel.js +215 -0
- package/src/Models/Packhouse/Site/VarietyModel.js +8 -8
- package/src/Models/Packhouse/Site/index.js +10 -0
- package/src/Models/RTUModel.js +6 -6
- package/src/Models/RTUPluginModel.js +5 -5
- package/src/Models/Site/AlarmGroupModel.js +7 -7
- package/src/Models/Site/AlarmModel.js +17 -17
- package/src/Models/Site/DefinitionModel.js +6 -6
- package/src/Models/Site/PermanentObjectDataModel.js +8 -8
- package/src/Models/Site/PermanentObjectModel.js +7 -7
- package/src/Models/Site/PointModel.js +11 -11
- package/src/Models/Site/TemporaryObjectModel.js +6 -6
- package/src/Models/SiteModel.js +6 -6
- package/src/Models/TokenModel.js +10 -10
- package/src/Models/UserAccountActionTokenModel.js +11 -11
- package/src/Models/UserAccountModel.js +10 -10
- package/src/PackageVersion.js +1 -1
- package/src/Points.js +24 -12
- package/src/WebSocketHelper.js +34 -13
- package/src/index.js +3 -3
- package/types/tslint.json +2 -1
|
@@ -0,0 +1,671 @@
|
|
|
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 RequestHelper from '../../../RequestHelper';
|
|
8
|
+
import ShiftTaskModel from '../../../Models/Packhouse/Site/ShiftTaskModel';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Controller Class for Shift Tasks
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
class ShiftTaskController
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve a Shift Task [GET /packhouse/sites/{siteId}/shift-tasks/{id}]
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @public
|
|
22
|
+
* @param {number} siteId The Site ID
|
|
23
|
+
* @param {string} id The Shift Task ID
|
|
24
|
+
* @return {Promise<ShiftTaskModel>}
|
|
25
|
+
*/
|
|
26
|
+
static getOne(siteId, id)
|
|
27
|
+
{
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}`)
|
|
30
|
+
.then((result) => {
|
|
31
|
+
let resolveValue = (function(){
|
|
32
|
+
return ShiftTaskModel.fromJSON(result, siteId);
|
|
33
|
+
}());
|
|
34
|
+
|
|
35
|
+
resolve(resolveValue);
|
|
36
|
+
})
|
|
37
|
+
.catch(error => reject(error));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Update a Shift Task [PATCH /packhouse/sites/{siteId}/shift-tasks/{id}]
|
|
43
|
+
*
|
|
44
|
+
* @static
|
|
45
|
+
* @public
|
|
46
|
+
* @param {number} siteId The Site ID
|
|
47
|
+
* @param {string} id The Shift Task ID
|
|
48
|
+
* @param {ShiftTaskController.UpdateData} updateData The Shift Task Update Data
|
|
49
|
+
* @return {Promise<ShiftTaskModel>}
|
|
50
|
+
*/
|
|
51
|
+
static update(siteId, id, updateData)
|
|
52
|
+
{
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
RequestHelper.patchRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}`, updateData)
|
|
55
|
+
.then((result) => {
|
|
56
|
+
let resolveValue = (function(){
|
|
57
|
+
return ShiftTaskModel.fromJSON(result, siteId);
|
|
58
|
+
}());
|
|
59
|
+
|
|
60
|
+
resolve(resolveValue);
|
|
61
|
+
})
|
|
62
|
+
.catch(error => reject(error));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Delete a Shift Task [DELETE /packhouse/sites/{siteId}/shift-tasks/{id}]
|
|
68
|
+
*
|
|
69
|
+
* @static
|
|
70
|
+
* @public
|
|
71
|
+
* @param {number} siteId The Site ID
|
|
72
|
+
* @param {string} id The Shift Task ID
|
|
73
|
+
* @return {Promise<boolean>}
|
|
74
|
+
*/
|
|
75
|
+
static delete(siteId, id)
|
|
76
|
+
{
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}`)
|
|
79
|
+
.then((result) => {
|
|
80
|
+
resolve(result ?? true);
|
|
81
|
+
})
|
|
82
|
+
.catch(error => reject(error));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Retrieve Comments [GET /packhouse/sites/{siteId}/shift-tasks/{id}/comments]
|
|
88
|
+
*
|
|
89
|
+
* Retrieves Comments for a Shift Task
|
|
90
|
+
*
|
|
91
|
+
* @static
|
|
92
|
+
* @public
|
|
93
|
+
* @param {number} siteId The Site ID
|
|
94
|
+
* @param {string} id The Shift Task ID
|
|
95
|
+
* @return {Promise<Array<ShiftTaskController.CommentItem>>}
|
|
96
|
+
*/
|
|
97
|
+
static getComments(siteId, id)
|
|
98
|
+
{
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}/comments`)
|
|
101
|
+
.then((result) => {
|
|
102
|
+
let resolveValue = (function(){
|
|
103
|
+
if(Array.isArray(result) !== true)
|
|
104
|
+
{
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return result.map((resultItem) => {
|
|
109
|
+
return (function(){
|
|
110
|
+
let resultItemObject = {};
|
|
111
|
+
|
|
112
|
+
if(typeof resultItem === 'object' && 'id' in resultItem)
|
|
113
|
+
{
|
|
114
|
+
resultItemObject.id = (function(){
|
|
115
|
+
if(typeof resultItem.id !== 'string')
|
|
116
|
+
{
|
|
117
|
+
return String(resultItem.id);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return resultItem.id;
|
|
121
|
+
}());
|
|
122
|
+
}
|
|
123
|
+
else
|
|
124
|
+
{
|
|
125
|
+
resultItemObject.id = "";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if(typeof resultItem === 'object' && 'content' in resultItem)
|
|
129
|
+
{
|
|
130
|
+
resultItemObject.content = (function(){
|
|
131
|
+
if(resultItem.content === null)
|
|
132
|
+
{
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if(typeof resultItem.content !== 'string')
|
|
137
|
+
{
|
|
138
|
+
return String(resultItem.content);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return resultItem.content;
|
|
142
|
+
}());
|
|
143
|
+
}
|
|
144
|
+
else
|
|
145
|
+
{
|
|
146
|
+
resultItemObject.content = null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if(typeof resultItem === 'object' && 'createdTimestamp' in resultItem)
|
|
150
|
+
{
|
|
151
|
+
resultItemObject.createdTimestamp = (function(){
|
|
152
|
+
if(resultItem.createdTimestamp === null)
|
|
153
|
+
{
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if(typeof resultItem.createdTimestamp !== 'string')
|
|
158
|
+
{
|
|
159
|
+
return new Date(String(resultItem.createdTimestamp));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return new Date(resultItem.createdTimestamp);
|
|
163
|
+
}());
|
|
164
|
+
}
|
|
165
|
+
else
|
|
166
|
+
{
|
|
167
|
+
resultItemObject.createdTimestamp = null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if(typeof resultItem === 'object' && 'updatedTimestamp' in resultItem)
|
|
171
|
+
{
|
|
172
|
+
resultItemObject.updatedTimestamp = (function(){
|
|
173
|
+
if(resultItem.updatedTimestamp === null)
|
|
174
|
+
{
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if(typeof resultItem.updatedTimestamp !== 'string')
|
|
179
|
+
{
|
|
180
|
+
return new Date(String(resultItem.updatedTimestamp));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return new Date(resultItem.updatedTimestamp);
|
|
184
|
+
}());
|
|
185
|
+
}
|
|
186
|
+
else
|
|
187
|
+
{
|
|
188
|
+
resultItemObject.updatedTimestamp = null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return resultItemObject;
|
|
192
|
+
}());
|
|
193
|
+
});
|
|
194
|
+
}());
|
|
195
|
+
|
|
196
|
+
resolve(resolveValue);
|
|
197
|
+
})
|
|
198
|
+
.catch(error => reject(error));
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Create a Comment [POST /packhouse/sites/{siteId}/shift-tasks/{id}/comments]
|
|
204
|
+
*
|
|
205
|
+
* Create a Comment for a Shift Task
|
|
206
|
+
*
|
|
207
|
+
* @static
|
|
208
|
+
* @public
|
|
209
|
+
* @param {number} siteId The Site ID
|
|
210
|
+
* @param {string} id The Shift Task ID
|
|
211
|
+
* @param {string} content The Content of the New Comment
|
|
212
|
+
* @return {Promise<ShiftTaskController.CommentItem>}
|
|
213
|
+
*/
|
|
214
|
+
static createComment(siteId, id, content)
|
|
215
|
+
{
|
|
216
|
+
return new Promise((resolve, reject) => {
|
|
217
|
+
RequestHelper.postRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}/comments`, {content})
|
|
218
|
+
.then((result) => {
|
|
219
|
+
let resolveValue = (function(){
|
|
220
|
+
let resultObject = {};
|
|
221
|
+
|
|
222
|
+
if(typeof result === 'object' && 'id' in result)
|
|
223
|
+
{
|
|
224
|
+
resultObject.id = (function(){
|
|
225
|
+
if(typeof result.id !== 'string')
|
|
226
|
+
{
|
|
227
|
+
return String(result.id);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return result.id;
|
|
231
|
+
}());
|
|
232
|
+
}
|
|
233
|
+
else
|
|
234
|
+
{
|
|
235
|
+
resultObject.id = "";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if(typeof result === 'object' && 'content' in result)
|
|
239
|
+
{
|
|
240
|
+
resultObject.content = (function(){
|
|
241
|
+
if(result.content === null)
|
|
242
|
+
{
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if(typeof result.content !== 'string')
|
|
247
|
+
{
|
|
248
|
+
return String(result.content);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return result.content;
|
|
252
|
+
}());
|
|
253
|
+
}
|
|
254
|
+
else
|
|
255
|
+
{
|
|
256
|
+
resultObject.content = null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if(typeof result === 'object' && 'createdTimestamp' in result)
|
|
260
|
+
{
|
|
261
|
+
resultObject.createdTimestamp = (function(){
|
|
262
|
+
if(result.createdTimestamp === null)
|
|
263
|
+
{
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if(typeof result.createdTimestamp !== 'string')
|
|
268
|
+
{
|
|
269
|
+
return new Date(String(result.createdTimestamp));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return new Date(result.createdTimestamp);
|
|
273
|
+
}());
|
|
274
|
+
}
|
|
275
|
+
else
|
|
276
|
+
{
|
|
277
|
+
resultObject.createdTimestamp = null;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if(typeof result === 'object' && 'updatedTimestamp' in result)
|
|
281
|
+
{
|
|
282
|
+
resultObject.updatedTimestamp = (function(){
|
|
283
|
+
if(result.updatedTimestamp === null)
|
|
284
|
+
{
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if(typeof result.updatedTimestamp !== 'string')
|
|
289
|
+
{
|
|
290
|
+
return new Date(String(result.updatedTimestamp));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return new Date(result.updatedTimestamp);
|
|
294
|
+
}());
|
|
295
|
+
}
|
|
296
|
+
else
|
|
297
|
+
{
|
|
298
|
+
resultObject.updatedTimestamp = null;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return resultObject;
|
|
302
|
+
}());
|
|
303
|
+
|
|
304
|
+
resolve(resolveValue);
|
|
305
|
+
})
|
|
306
|
+
.catch(error => reject(error));
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Retrieve a Comment [GET /packhouse/sites/{siteId}/shift-tasks/{id}/comments/{commentId}]
|
|
312
|
+
*
|
|
313
|
+
* Retrieves Comments for a Shift Task
|
|
314
|
+
*
|
|
315
|
+
* @static
|
|
316
|
+
* @public
|
|
317
|
+
* @param {number} siteId The Site ID
|
|
318
|
+
* @param {string} id The Shift Task ID
|
|
319
|
+
* @param {string} commentId The Comment ID
|
|
320
|
+
* @return {Promise<ShiftTaskController.CommentItem>}
|
|
321
|
+
*/
|
|
322
|
+
static getOneComment(siteId, id, commentId)
|
|
323
|
+
{
|
|
324
|
+
return new Promise((resolve, reject) => {
|
|
325
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}/comments/${commentId}`)
|
|
326
|
+
.then((result) => {
|
|
327
|
+
let resolveValue = (function(){
|
|
328
|
+
let resultObject = {};
|
|
329
|
+
|
|
330
|
+
if(typeof result === 'object' && 'id' in result)
|
|
331
|
+
{
|
|
332
|
+
resultObject.id = (function(){
|
|
333
|
+
if(typeof result.id !== 'string')
|
|
334
|
+
{
|
|
335
|
+
return String(result.id);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return result.id;
|
|
339
|
+
}());
|
|
340
|
+
}
|
|
341
|
+
else
|
|
342
|
+
{
|
|
343
|
+
resultObject.id = "";
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if(typeof result === 'object' && 'content' in result)
|
|
347
|
+
{
|
|
348
|
+
resultObject.content = (function(){
|
|
349
|
+
if(result.content === null)
|
|
350
|
+
{
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if(typeof result.content !== 'string')
|
|
355
|
+
{
|
|
356
|
+
return String(result.content);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return result.content;
|
|
360
|
+
}());
|
|
361
|
+
}
|
|
362
|
+
else
|
|
363
|
+
{
|
|
364
|
+
resultObject.content = null;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if(typeof result === 'object' && 'createdTimestamp' in result)
|
|
368
|
+
{
|
|
369
|
+
resultObject.createdTimestamp = (function(){
|
|
370
|
+
if(result.createdTimestamp === null)
|
|
371
|
+
{
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if(typeof result.createdTimestamp !== 'string')
|
|
376
|
+
{
|
|
377
|
+
return new Date(String(result.createdTimestamp));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return new Date(result.createdTimestamp);
|
|
381
|
+
}());
|
|
382
|
+
}
|
|
383
|
+
else
|
|
384
|
+
{
|
|
385
|
+
resultObject.createdTimestamp = null;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if(typeof result === 'object' && 'updatedTimestamp' in result)
|
|
389
|
+
{
|
|
390
|
+
resultObject.updatedTimestamp = (function(){
|
|
391
|
+
if(result.updatedTimestamp === null)
|
|
392
|
+
{
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if(typeof result.updatedTimestamp !== 'string')
|
|
397
|
+
{
|
|
398
|
+
return new Date(String(result.updatedTimestamp));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return new Date(result.updatedTimestamp);
|
|
402
|
+
}());
|
|
403
|
+
}
|
|
404
|
+
else
|
|
405
|
+
{
|
|
406
|
+
resultObject.updatedTimestamp = null;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return resultObject;
|
|
410
|
+
}());
|
|
411
|
+
|
|
412
|
+
resolve(resolveValue);
|
|
413
|
+
})
|
|
414
|
+
.catch(error => reject(error));
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Update a Comment [PATCH /packhouse/sites/{siteId}/shift-tasks/{id}/comments/{commentId}]
|
|
420
|
+
*
|
|
421
|
+
* Update a Comment for a Shift Task
|
|
422
|
+
*
|
|
423
|
+
* @static
|
|
424
|
+
* @public
|
|
425
|
+
* @param {number} siteId The Site ID
|
|
426
|
+
* @param {string} id The Shift Task ID
|
|
427
|
+
* @param {string} commentId The Comment ID
|
|
428
|
+
* @param {string} content The Updated Content for the Comment
|
|
429
|
+
* @return {Promise<ShiftTaskController.CommentItem>}
|
|
430
|
+
*/
|
|
431
|
+
static updateOneComment(siteId, id, commentId, content)
|
|
432
|
+
{
|
|
433
|
+
return new Promise((resolve, reject) => {
|
|
434
|
+
RequestHelper.patchRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}/comments/${commentId}`, {content})
|
|
435
|
+
.then((result) => {
|
|
436
|
+
let resolveValue = (function(){
|
|
437
|
+
let resultObject = {};
|
|
438
|
+
|
|
439
|
+
if(typeof result === 'object' && 'id' in result)
|
|
440
|
+
{
|
|
441
|
+
resultObject.id = (function(){
|
|
442
|
+
if(typeof result.id !== 'string')
|
|
443
|
+
{
|
|
444
|
+
return String(result.id);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return result.id;
|
|
448
|
+
}());
|
|
449
|
+
}
|
|
450
|
+
else
|
|
451
|
+
{
|
|
452
|
+
resultObject.id = "";
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if(typeof result === 'object' && 'content' in result)
|
|
456
|
+
{
|
|
457
|
+
resultObject.content = (function(){
|
|
458
|
+
if(result.content === null)
|
|
459
|
+
{
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if(typeof result.content !== 'string')
|
|
464
|
+
{
|
|
465
|
+
return String(result.content);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return result.content;
|
|
469
|
+
}());
|
|
470
|
+
}
|
|
471
|
+
else
|
|
472
|
+
{
|
|
473
|
+
resultObject.content = null;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if(typeof result === 'object' && 'createdTimestamp' in result)
|
|
477
|
+
{
|
|
478
|
+
resultObject.createdTimestamp = (function(){
|
|
479
|
+
if(result.createdTimestamp === null)
|
|
480
|
+
{
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
if(typeof result.createdTimestamp !== 'string')
|
|
485
|
+
{
|
|
486
|
+
return new Date(String(result.createdTimestamp));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return new Date(result.createdTimestamp);
|
|
490
|
+
}());
|
|
491
|
+
}
|
|
492
|
+
else
|
|
493
|
+
{
|
|
494
|
+
resultObject.createdTimestamp = null;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if(typeof result === 'object' && 'updatedTimestamp' in result)
|
|
498
|
+
{
|
|
499
|
+
resultObject.updatedTimestamp = (function(){
|
|
500
|
+
if(result.updatedTimestamp === null)
|
|
501
|
+
{
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if(typeof result.updatedTimestamp !== 'string')
|
|
506
|
+
{
|
|
507
|
+
return new Date(String(result.updatedTimestamp));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return new Date(result.updatedTimestamp);
|
|
511
|
+
}());
|
|
512
|
+
}
|
|
513
|
+
else
|
|
514
|
+
{
|
|
515
|
+
resultObject.updatedTimestamp = null;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return resultObject;
|
|
519
|
+
}());
|
|
520
|
+
|
|
521
|
+
resolve(resolveValue);
|
|
522
|
+
})
|
|
523
|
+
.catch(error => reject(error));
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Delete a Comment [DELETE /packhouse/sites/{siteId}/shift-tasks/{id}/comments/{commentId}]
|
|
529
|
+
*
|
|
530
|
+
* Delete a Comment for a Shift Task
|
|
531
|
+
*
|
|
532
|
+
* @static
|
|
533
|
+
* @public
|
|
534
|
+
* @param {number} siteId The Site ID
|
|
535
|
+
* @param {string} id The Shift Task ID
|
|
536
|
+
* @param {string} commentId The Comment ID
|
|
537
|
+
* @return {Promise<boolean>}
|
|
538
|
+
*/
|
|
539
|
+
static deleteOneComment(siteId, id, commentId)
|
|
540
|
+
{
|
|
541
|
+
return new Promise((resolve, reject) => {
|
|
542
|
+
RequestHelper.deleteRequest(`/packhouse/sites/${siteId}/shift-tasks/${id}/comments/${commentId}`)
|
|
543
|
+
.then((result) => {
|
|
544
|
+
resolve(result ?? true);
|
|
545
|
+
})
|
|
546
|
+
.catch(error => reject(error));
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* List all Shift Tasks [GET /packhouse/sites/{siteId}/shift-tasks]
|
|
552
|
+
*
|
|
553
|
+
* @static
|
|
554
|
+
* @public
|
|
555
|
+
* @param {number} siteId The Site ID
|
|
556
|
+
* @param {ShiftTaskController.GetAllQueryParameters} [queryParameters] The Optional Query Parameters
|
|
557
|
+
* @return {Promise<ShiftTaskModel[]>}
|
|
558
|
+
*/
|
|
559
|
+
static getAll(siteId, queryParameters = {})
|
|
560
|
+
{
|
|
561
|
+
return new Promise((resolve, reject) => {
|
|
562
|
+
RequestHelper.getRequest(`/packhouse/sites/${siteId}/shift-tasks`, queryParameters)
|
|
563
|
+
.then((result) => {
|
|
564
|
+
let resolveValue = (function(){
|
|
565
|
+
if(Array.isArray(result) !== true)
|
|
566
|
+
{
|
|
567
|
+
return [];
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
return result.map((resultItem) => {
|
|
571
|
+
return (function(){
|
|
572
|
+
return ShiftTaskModel.fromJSON(resultItem, siteId);
|
|
573
|
+
}());
|
|
574
|
+
});
|
|
575
|
+
}());
|
|
576
|
+
|
|
577
|
+
resolve(resolveValue);
|
|
578
|
+
})
|
|
579
|
+
.catch(error => reject(error));
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Create a Shift Task [POST /packhouse/sites/{siteId}/shift-tasks]
|
|
585
|
+
*
|
|
586
|
+
* @static
|
|
587
|
+
* @public
|
|
588
|
+
* @param {number} siteId The Site ID
|
|
589
|
+
* @param {ShiftTaskController.CreateData} createData The Shift Task Create Data
|
|
590
|
+
* @return {Promise<ShiftTaskModel>}
|
|
591
|
+
*/
|
|
592
|
+
static create(siteId, createData)
|
|
593
|
+
{
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
RequestHelper.postRequest(`/packhouse/sites/${siteId}/shift-tasks`, createData)
|
|
596
|
+
.then((result) => {
|
|
597
|
+
let resolveValue = (function(){
|
|
598
|
+
return ShiftTaskModel.fromJSON(result, siteId);
|
|
599
|
+
}());
|
|
600
|
+
|
|
601
|
+
resolve(resolveValue);
|
|
602
|
+
})
|
|
603
|
+
.catch(error => reject(error));
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export default ShiftTaskController;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* The Optional Query Parameters for the getAll Function
|
|
612
|
+
*
|
|
613
|
+
* @typedef {Object} ShiftTaskController.GetAllQueryParameters
|
|
614
|
+
* @property {string} [packingLineId] The Packing Line ID this Task is associated with
|
|
615
|
+
* @property {string} [shiftId] The Shift ID this Task is asssociated with
|
|
616
|
+
* @property {?string} [authorUserId] The User ID of the Author for this Task
|
|
617
|
+
* @property {string} [authorName] The Name of the Author for this Task
|
|
618
|
+
* @property {string} [type] The Task Type
|
|
619
|
+
* @property {string[]} [tags] An Array of Tag IDs for this Task
|
|
620
|
+
* @property {Date} [createdTimestampBegin] Filter by the Timestamp when Tasks were Created. Results Greater than or Equal to Timestamp
|
|
621
|
+
* @property {Date} [createdTimestampEnd] Filter by the Timestamp when Tasks were Created. Results Less than or Equal to Timestamp
|
|
622
|
+
* @property {Date} [completedTimestampBegin] Filter by the Timestamp when Tasks were Completed. Results Greater than or Equal to Timestamp
|
|
623
|
+
* @property {Date} [completedTimestampEnd] Filter by the Timestamp when Tasks were Completed. Results Less than or Equal to Timestamp
|
|
624
|
+
* @property {Date} [updateTimestampBegin] Filter by the Timestamp when Tasks were last Updated. Results Greater than or Equal to Timestamp
|
|
625
|
+
* @property {Date} [updateTimestampEnd] Filter by the Timestamp when Tasks were last Updated. Results Less than or Equal to Timestamp
|
|
626
|
+
* @memberof Controllers.Packhouse.Site
|
|
627
|
+
*/
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* The Create Data for a Shift Task
|
|
631
|
+
*
|
|
632
|
+
* @typedef {Object} ShiftTaskController.CreateData
|
|
633
|
+
* @property {string} packingLineId The Packing Line ID this Task is associated with
|
|
634
|
+
* @property {string} [shiftId] The Shift ID this Task is asssociated with
|
|
635
|
+
* @property {Date} [createdTimestamp] When this Task was Created
|
|
636
|
+
* @property {?Date} [completedTimestamp] When this Task was Completed
|
|
637
|
+
* @property {?string} [authorUserId] The User ID of the Author for this Task
|
|
638
|
+
* @property {string} authorName The Name of the Author for this Task
|
|
639
|
+
* @property {string} type The Task Type
|
|
640
|
+
* @property {string[]} [tags] An Array of Tag IDs for this Task
|
|
641
|
+
* @property {string} title The Title of this Task
|
|
642
|
+
* @property {string} [content] The Content of this Task
|
|
643
|
+
* @memberof Controllers.Packhouse.Site
|
|
644
|
+
*/
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* The Update Data for a Shift Task
|
|
648
|
+
*
|
|
649
|
+
* @typedef {Object} ShiftTaskController.UpdateData
|
|
650
|
+
* @property {string} [packingLineId] The Packing Line ID this Task is associated with
|
|
651
|
+
* @property {Date} [createdTimestamp] When this Task was Created
|
|
652
|
+
* @property {?Date} [completedTimestamp] When this Task was Completed
|
|
653
|
+
* @property {?string} [authorUserId] The User ID of the Author for this Task
|
|
654
|
+
* @property {string} [authorName] The Name of the Author for this Task
|
|
655
|
+
* @property {string} [type] The Task Type
|
|
656
|
+
* @property {string[]} [tags] An Array of Tag IDs for this Task
|
|
657
|
+
* @property {string} [title] The Title of this Task
|
|
658
|
+
* @property {string} [content] The Content of this Task
|
|
659
|
+
* @memberof Controllers.Packhouse.Site
|
|
660
|
+
*/
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* A **CommentItem** Type
|
|
664
|
+
*
|
|
665
|
+
* @typedef {Object} ShiftTaskController.CommentItem
|
|
666
|
+
* @property {string} id The Comment ID
|
|
667
|
+
* @property {?string} content The Content of the Comment
|
|
668
|
+
* @property {?Date} createdTimestamp When the Comment was Created
|
|
669
|
+
* @property {?Date} updatedTimestamp When the Comment was last Updated
|
|
670
|
+
* @memberof Controllers.Packhouse.Site
|
|
671
|
+
*/
|