@agroyaar/sdk 2.3.0-1 → 2.4.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/index.cjs +87 -58
- package/dist/index.d.ts +23 -13
- package/dist/index.mjs +87 -58
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -91,7 +91,7 @@ var createClient = (config, middlewares = []) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
94
|
-
var
|
|
94
|
+
var import_ts_belt2 = require("@mobily/ts-belt");
|
|
95
95
|
|
|
96
96
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
97
97
|
var mappers = {
|
|
@@ -177,19 +177,7 @@ var mappers = {
|
|
|
177
177
|
date,
|
|
178
178
|
heading
|
|
179
179
|
}),
|
|
180
|
-
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// src/utils/wrapError.ts
|
|
184
|
-
var import_ts_belt = require("@mobily/ts-belt");
|
|
185
|
-
var wrapError = (error) => {
|
|
186
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
187
|
-
return import_ts_belt.R.Error(err);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
// src/services/dashboard/mechanization/temperature-changes.ts
|
|
191
|
-
var import_ts_belt2 = require("@mobily/ts-belt");
|
|
192
|
-
var mappers2 = {
|
|
180
|
+
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
193
181
|
getMechanizationTemperatureChange: ({
|
|
194
182
|
engineWaterTemperature,
|
|
195
183
|
date
|
|
@@ -197,39 +185,23 @@ var mappers2 = {
|
|
|
197
185
|
engineWaterTemperature,
|
|
198
186
|
date
|
|
199
187
|
}),
|
|
200
|
-
getMechanizationTemperatureChanges: (response) => response.map(
|
|
188
|
+
getMechanizationTemperatureChanges: (response) => response.map(mappers.getMechanizationTemperatureChange),
|
|
189
|
+
getMechanizationFuelConsumptionChange: ({
|
|
190
|
+
fuelConsumption,
|
|
191
|
+
date
|
|
192
|
+
}) => ({
|
|
193
|
+
fuelConsumption,
|
|
194
|
+
date
|
|
195
|
+
}),
|
|
196
|
+
getMechanizationFuelConsumptionChanges: (response) => response.map(mappers.getMechanizationFuelConsumptionChange)
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// src/utils/wrapError.ts
|
|
200
|
+
var import_ts_belt = require("@mobily/ts-belt");
|
|
201
|
+
var wrapError = (error) => {
|
|
202
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
203
|
+
return import_ts_belt.R.Error(err);
|
|
201
204
|
};
|
|
202
|
-
var createMechanizationTemperatureChangesServices = (client) => ({
|
|
203
|
-
getMechanizationTemperatureChanges: async ({
|
|
204
|
-
farmerId,
|
|
205
|
-
mechanizationId,
|
|
206
|
-
fromDate,
|
|
207
|
-
toDate
|
|
208
|
-
}) => {
|
|
209
|
-
try {
|
|
210
|
-
const response = await client.typed(
|
|
211
|
-
"get",
|
|
212
|
-
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/temperature-changes",
|
|
213
|
-
{
|
|
214
|
-
params: {
|
|
215
|
-
fromDate,
|
|
216
|
-
toDate
|
|
217
|
-
},
|
|
218
|
-
pathParams: {
|
|
219
|
-
farmerId,
|
|
220
|
-
mechanizationId
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
const temperatureChanges = response.result.data.temperatureChanges;
|
|
225
|
-
return import_ts_belt2.R.Ok(
|
|
226
|
-
mappers2.getMechanizationTemperatureChanges(temperatureChanges)
|
|
227
|
-
);
|
|
228
|
-
} catch (error) {
|
|
229
|
-
return wrapError(error);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
205
|
|
|
234
206
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
235
207
|
var createMechanizationServices = (client) => ({
|
|
@@ -240,7 +212,7 @@ var createMechanizationServices = (client) => ({
|
|
|
240
212
|
const { data } = await client.get(
|
|
241
213
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
242
214
|
);
|
|
243
|
-
return
|
|
215
|
+
return import_ts_belt2.R.Ok(
|
|
244
216
|
mappers.getMechanizationVarietyList(
|
|
245
217
|
data.result.data.mechanizationVarieties
|
|
246
218
|
)
|
|
@@ -257,7 +229,7 @@ var createMechanizationServices = (client) => ({
|
|
|
257
229
|
const { data } = await client.get(
|
|
258
230
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
259
231
|
);
|
|
260
|
-
return
|
|
232
|
+
return import_ts_belt2.R.Ok(
|
|
261
233
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
262
234
|
);
|
|
263
235
|
} catch (error) {
|
|
@@ -280,7 +252,7 @@ var createMechanizationServices = (client) => ({
|
|
|
280
252
|
}
|
|
281
253
|
);
|
|
282
254
|
const mechanization = response.result.data.mechanization;
|
|
283
|
-
return
|
|
255
|
+
return import_ts_belt2.R.Ok(mappers.getMechanization(mechanization));
|
|
284
256
|
} catch (error) {
|
|
285
257
|
return wrapError(error);
|
|
286
258
|
}
|
|
@@ -303,7 +275,7 @@ var createMechanizationServices = (client) => ({
|
|
|
303
275
|
}
|
|
304
276
|
);
|
|
305
277
|
const mechanizations = response.result.data.mechanizations;
|
|
306
|
-
return
|
|
278
|
+
return import_ts_belt2.R.Ok(mappers.getMechanizations(mechanizations));
|
|
307
279
|
} catch (error) {
|
|
308
280
|
return wrapError(error);
|
|
309
281
|
}
|
|
@@ -324,7 +296,7 @@ var createMechanizationServices = (client) => ({
|
|
|
324
296
|
}
|
|
325
297
|
);
|
|
326
298
|
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
327
|
-
return
|
|
299
|
+
return import_ts_belt2.R.Ok(
|
|
328
300
|
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
329
301
|
);
|
|
330
302
|
} catch (error) {
|
|
@@ -341,7 +313,7 @@ var createMechanizationServices = (client) => ({
|
|
|
341
313
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
342
314
|
{ deviceCode }
|
|
343
315
|
);
|
|
344
|
-
return
|
|
316
|
+
return import_ts_belt2.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
345
317
|
} catch (error) {
|
|
346
318
|
return wrapError(error);
|
|
347
319
|
}
|
|
@@ -351,7 +323,7 @@ var createMechanizationServices = (client) => ({
|
|
|
351
323
|
const { data } = await client.get(
|
|
352
324
|
"/statics/mechanizations-seasons-process-kinds"
|
|
353
325
|
);
|
|
354
|
-
return
|
|
326
|
+
return import_ts_belt2.R.Ok(
|
|
355
327
|
mappers.getSeasonsProcessList(
|
|
356
328
|
data.result.data.mechanizationSeasonProcessKinds
|
|
357
329
|
)
|
|
@@ -371,7 +343,7 @@ var createMechanizationServices = (client) => ({
|
|
|
371
343
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
372
344
|
{ deviceCode, verificationToken }
|
|
373
345
|
);
|
|
374
|
-
return
|
|
346
|
+
return import_ts_belt2.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
375
347
|
} catch (error) {
|
|
376
348
|
return wrapError(error);
|
|
377
349
|
}
|
|
@@ -390,7 +362,7 @@ var createMechanizationServices = (client) => ({
|
|
|
390
362
|
}
|
|
391
363
|
);
|
|
392
364
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
393
|
-
return
|
|
365
|
+
return import_ts_belt2.R.Ok(mappers.getQuestions(questions));
|
|
394
366
|
} catch (error) {
|
|
395
367
|
return wrapError(error);
|
|
396
368
|
}
|
|
@@ -417,7 +389,7 @@ var createMechanizationServices = (client) => ({
|
|
|
417
389
|
}
|
|
418
390
|
);
|
|
419
391
|
const movementChanges = response.result.data.movementChanges;
|
|
420
|
-
return
|
|
392
|
+
return import_ts_belt2.R.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
421
393
|
} catch (error) {
|
|
422
394
|
return wrapError(error);
|
|
423
395
|
}
|
|
@@ -434,12 +406,69 @@ var createMechanizationServices = (client) => ({
|
|
|
434
406
|
data: { verificationToken }
|
|
435
407
|
}
|
|
436
408
|
);
|
|
437
|
-
return
|
|
409
|
+
return import_ts_belt2.R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
410
|
+
} catch (error) {
|
|
411
|
+
return wrapError(error);
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
getMechanizationTemperatureChanges: async ({
|
|
415
|
+
farmerId,
|
|
416
|
+
mechanizationId,
|
|
417
|
+
fromDate,
|
|
418
|
+
toDate
|
|
419
|
+
}) => {
|
|
420
|
+
try {
|
|
421
|
+
const response = await client.typed(
|
|
422
|
+
"get",
|
|
423
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/temperature-changes",
|
|
424
|
+
{
|
|
425
|
+
params: {
|
|
426
|
+
fromDate,
|
|
427
|
+
toDate
|
|
428
|
+
},
|
|
429
|
+
pathParams: {
|
|
430
|
+
farmerId,
|
|
431
|
+
mechanizationId
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
);
|
|
435
|
+
const temperatureChanges = response.result.data.temperatureChanges;
|
|
436
|
+
return import_ts_belt2.R.Ok(
|
|
437
|
+
mappers.getMechanizationTemperatureChanges(temperatureChanges)
|
|
438
|
+
);
|
|
438
439
|
} catch (error) {
|
|
439
440
|
return wrapError(error);
|
|
440
441
|
}
|
|
441
442
|
},
|
|
442
|
-
|
|
443
|
+
getMechanizationFuelConsumptionChanges: async ({
|
|
444
|
+
farmerId,
|
|
445
|
+
mechanizationId,
|
|
446
|
+
fromDate,
|
|
447
|
+
toDate
|
|
448
|
+
}) => {
|
|
449
|
+
try {
|
|
450
|
+
const response = await client.typed(
|
|
451
|
+
"get",
|
|
452
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/fuel-consumption-changes",
|
|
453
|
+
{
|
|
454
|
+
params: {
|
|
455
|
+
fromDate,
|
|
456
|
+
toDate
|
|
457
|
+
},
|
|
458
|
+
pathParams: {
|
|
459
|
+
farmerId,
|
|
460
|
+
mechanizationId
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
const fuelConsumptionChanges = response.result.data.fuelConsumptionChanges;
|
|
465
|
+
return import_ts_belt2.R.Ok(
|
|
466
|
+
mappers.getMechanizationFuelConsumptionChanges(fuelConsumptionChanges)
|
|
467
|
+
);
|
|
468
|
+
} catch (error) {
|
|
469
|
+
return wrapError(error);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
443
472
|
});
|
|
444
473
|
|
|
445
474
|
// src/index.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -155,6 +155,26 @@ type MechanizationMovementChangesVariable = {
|
|
|
155
155
|
fromDate?: string | null | undefined;
|
|
156
156
|
toDate?: string | null | undefined;
|
|
157
157
|
};
|
|
158
|
+
type MechanizationTemperatureChangesModel = {
|
|
159
|
+
engineWaterTemperature: number;
|
|
160
|
+
date: string;
|
|
161
|
+
};
|
|
162
|
+
type MechanizationTemperatureChangesVariable = {
|
|
163
|
+
farmerId: string;
|
|
164
|
+
mechanizationId: string;
|
|
165
|
+
fromDate?: string | null | undefined;
|
|
166
|
+
toDate?: string | null | undefined;
|
|
167
|
+
};
|
|
168
|
+
type MechanizationFuelConsumptionChangesModel = {
|
|
169
|
+
fuelConsumption: number;
|
|
170
|
+
date: string;
|
|
171
|
+
};
|
|
172
|
+
type MechanizationFuelConsumptionChangesVariable = {
|
|
173
|
+
farmerId: string;
|
|
174
|
+
mechanizationId: string;
|
|
175
|
+
fromDate?: string | null | undefined;
|
|
176
|
+
toDate?: string | null | undefined;
|
|
177
|
+
};
|
|
158
178
|
|
|
159
179
|
/**
|
|
160
180
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -2959,17 +2979,6 @@ type ExtendedClient = AxiosInstance & {
|
|
|
2959
2979
|
}) => Promise<ResponseData<Op>>;
|
|
2960
2980
|
};
|
|
2961
2981
|
|
|
2962
|
-
type MechanizationTemperatureChangesModel = {
|
|
2963
|
-
engineWaterTemperature: number;
|
|
2964
|
-
date: string;
|
|
2965
|
-
};
|
|
2966
|
-
type MechanizationTemperatureChangesVariable = {
|
|
2967
|
-
farmerId: string;
|
|
2968
|
-
mechanizationId: string;
|
|
2969
|
-
fromDate?: string | null | undefined;
|
|
2970
|
-
toDate?: string | null | undefined;
|
|
2971
|
-
};
|
|
2972
|
-
|
|
2973
2982
|
type ClientConfig = {
|
|
2974
2983
|
readonly baseURL: string;
|
|
2975
2984
|
};
|
|
@@ -2978,7 +2987,6 @@ declare const createClient: (config: ClientConfig, middlewares?: ((_config: Inte
|
|
|
2978
2987
|
declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof createClient>[1]) => {
|
|
2979
2988
|
dashboardServices: {
|
|
2980
2989
|
mechanization: {
|
|
2981
|
-
getMechanizationTemperatureChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationTemperatureChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationTemperatureChangesModel[]>>;
|
|
2982
2990
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationVarietyModel[]>>;
|
|
2983
2991
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
|
|
2984
2992
|
getMechanization: ({ farmerId, mechanizationId, }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel>>;
|
|
@@ -2990,8 +2998,10 @@ declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof
|
|
|
2990
2998
|
getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
|
|
2991
2999
|
getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
|
|
2992
3000
|
DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
3001
|
+
getMechanizationTemperatureChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationTemperatureChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationTemperatureChangesModel[]>>;
|
|
3002
|
+
getMechanizationFuelConsumptionChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationFuelConsumptionChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationFuelConsumptionChangesModel[]>>;
|
|
2993
3003
|
};
|
|
2994
3004
|
};
|
|
2995
3005
|
};
|
|
2996
3006
|
|
|
2997
|
-
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationTemperatureChangesModel, type MechanizationTemperatureChangesVariable, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MechanizationsVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, createSDK };
|
|
3007
|
+
export { type DeleteTrackingDeviceVariables, type GetMechanizationQuestionVariable, Identifiers, type MechanizationFuelConsumptionChangesModel, type MechanizationFuelConsumptionChangesVariable, type MechanizationMachineUsageKind, type MechanizationMachineUsageType, type MechanizationModel, type MechanizationMovementChangesModel, type MechanizationMovementChangesVariable, type MechanizationQuestionModel, type MechanizationSeasonProcessKind, type MechanizationSeasonProcessType, type MechanizationTemperatureChangesModel, type MechanizationTemperatureChangesVariable, type MechanizationType, type MechanizationVariables, type MechanizationVarietyModel, type MechanizationVarietyVariables, type MechanizationsVariables, type MotorizedMechanizationSensorsModel, type MotorizedMechanizationSensorsVariables, type SeasonsProcessModel, type ServiceType, type SpeedChangesChartModel, type SpeedChangesChartVariables, type Status, type StatusType, type SubmitTrackingDeviceVariables, type TaskType, type TrackingDeviceCodeModel, type UpdateTrackingDeviceVariables, type VarietyKind, createSDK };
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ var createClient = (config, middlewares = []) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
58
|
-
import { R as
|
|
58
|
+
import { R as R2 } from "@mobily/ts-belt";
|
|
59
59
|
|
|
60
60
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
61
61
|
var mappers = {
|
|
@@ -141,19 +141,7 @@ var mappers = {
|
|
|
141
141
|
date,
|
|
142
142
|
heading
|
|
143
143
|
}),
|
|
144
|
-
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// src/utils/wrapError.ts
|
|
148
|
-
import { R } from "@mobily/ts-belt";
|
|
149
|
-
var wrapError = (error) => {
|
|
150
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
151
|
-
return R.Error(err);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// src/services/dashboard/mechanization/temperature-changes.ts
|
|
155
|
-
import { R as R2 } from "@mobily/ts-belt";
|
|
156
|
-
var mappers2 = {
|
|
144
|
+
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange),
|
|
157
145
|
getMechanizationTemperatureChange: ({
|
|
158
146
|
engineWaterTemperature,
|
|
159
147
|
date
|
|
@@ -161,39 +149,23 @@ var mappers2 = {
|
|
|
161
149
|
engineWaterTemperature,
|
|
162
150
|
date
|
|
163
151
|
}),
|
|
164
|
-
getMechanizationTemperatureChanges: (response) => response.map(
|
|
152
|
+
getMechanizationTemperatureChanges: (response) => response.map(mappers.getMechanizationTemperatureChange),
|
|
153
|
+
getMechanizationFuelConsumptionChange: ({
|
|
154
|
+
fuelConsumption,
|
|
155
|
+
date
|
|
156
|
+
}) => ({
|
|
157
|
+
fuelConsumption,
|
|
158
|
+
date
|
|
159
|
+
}),
|
|
160
|
+
getMechanizationFuelConsumptionChanges: (response) => response.map(mappers.getMechanizationFuelConsumptionChange)
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// src/utils/wrapError.ts
|
|
164
|
+
import { R } from "@mobily/ts-belt";
|
|
165
|
+
var wrapError = (error) => {
|
|
166
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
167
|
+
return R.Error(err);
|
|
165
168
|
};
|
|
166
|
-
var createMechanizationTemperatureChangesServices = (client) => ({
|
|
167
|
-
getMechanizationTemperatureChanges: async ({
|
|
168
|
-
farmerId,
|
|
169
|
-
mechanizationId,
|
|
170
|
-
fromDate,
|
|
171
|
-
toDate
|
|
172
|
-
}) => {
|
|
173
|
-
try {
|
|
174
|
-
const response = await client.typed(
|
|
175
|
-
"get",
|
|
176
|
-
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/temperature-changes",
|
|
177
|
-
{
|
|
178
|
-
params: {
|
|
179
|
-
fromDate,
|
|
180
|
-
toDate
|
|
181
|
-
},
|
|
182
|
-
pathParams: {
|
|
183
|
-
farmerId,
|
|
184
|
-
mechanizationId
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
const temperatureChanges = response.result.data.temperatureChanges;
|
|
189
|
-
return R2.Ok(
|
|
190
|
-
mappers2.getMechanizationTemperatureChanges(temperatureChanges)
|
|
191
|
-
);
|
|
192
|
-
} catch (error) {
|
|
193
|
-
return wrapError(error);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
169
|
|
|
198
170
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
199
171
|
var createMechanizationServices = (client) => ({
|
|
@@ -204,7 +176,7 @@ var createMechanizationServices = (client) => ({
|
|
|
204
176
|
const { data } = await client.get(
|
|
205
177
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
206
178
|
);
|
|
207
|
-
return
|
|
179
|
+
return R2.Ok(
|
|
208
180
|
mappers.getMechanizationVarietyList(
|
|
209
181
|
data.result.data.mechanizationVarieties
|
|
210
182
|
)
|
|
@@ -221,7 +193,7 @@ var createMechanizationServices = (client) => ({
|
|
|
221
193
|
const { data } = await client.get(
|
|
222
194
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
223
195
|
);
|
|
224
|
-
return
|
|
196
|
+
return R2.Ok(
|
|
225
197
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
226
198
|
);
|
|
227
199
|
} catch (error) {
|
|
@@ -244,7 +216,7 @@ var createMechanizationServices = (client) => ({
|
|
|
244
216
|
}
|
|
245
217
|
);
|
|
246
218
|
const mechanization = response.result.data.mechanization;
|
|
247
|
-
return
|
|
219
|
+
return R2.Ok(mappers.getMechanization(mechanization));
|
|
248
220
|
} catch (error) {
|
|
249
221
|
return wrapError(error);
|
|
250
222
|
}
|
|
@@ -267,7 +239,7 @@ var createMechanizationServices = (client) => ({
|
|
|
267
239
|
}
|
|
268
240
|
);
|
|
269
241
|
const mechanizations = response.result.data.mechanizations;
|
|
270
|
-
return
|
|
242
|
+
return R2.Ok(mappers.getMechanizations(mechanizations));
|
|
271
243
|
} catch (error) {
|
|
272
244
|
return wrapError(error);
|
|
273
245
|
}
|
|
@@ -288,7 +260,7 @@ var createMechanizationServices = (client) => ({
|
|
|
288
260
|
}
|
|
289
261
|
);
|
|
290
262
|
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
291
|
-
return
|
|
263
|
+
return R2.Ok(
|
|
292
264
|
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
293
265
|
);
|
|
294
266
|
} catch (error) {
|
|
@@ -305,7 +277,7 @@ var createMechanizationServices = (client) => ({
|
|
|
305
277
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
306
278
|
{ deviceCode }
|
|
307
279
|
);
|
|
308
|
-
return
|
|
280
|
+
return R2.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
309
281
|
} catch (error) {
|
|
310
282
|
return wrapError(error);
|
|
311
283
|
}
|
|
@@ -315,7 +287,7 @@ var createMechanizationServices = (client) => ({
|
|
|
315
287
|
const { data } = await client.get(
|
|
316
288
|
"/statics/mechanizations-seasons-process-kinds"
|
|
317
289
|
);
|
|
318
|
-
return
|
|
290
|
+
return R2.Ok(
|
|
319
291
|
mappers.getSeasonsProcessList(
|
|
320
292
|
data.result.data.mechanizationSeasonProcessKinds
|
|
321
293
|
)
|
|
@@ -335,7 +307,7 @@ var createMechanizationServices = (client) => ({
|
|
|
335
307
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
336
308
|
{ deviceCode, verificationToken }
|
|
337
309
|
);
|
|
338
|
-
return
|
|
310
|
+
return R2.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
339
311
|
} catch (error) {
|
|
340
312
|
return wrapError(error);
|
|
341
313
|
}
|
|
@@ -354,7 +326,7 @@ var createMechanizationServices = (client) => ({
|
|
|
354
326
|
}
|
|
355
327
|
);
|
|
356
328
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
357
|
-
return
|
|
329
|
+
return R2.Ok(mappers.getQuestions(questions));
|
|
358
330
|
} catch (error) {
|
|
359
331
|
return wrapError(error);
|
|
360
332
|
}
|
|
@@ -381,7 +353,7 @@ var createMechanizationServices = (client) => ({
|
|
|
381
353
|
}
|
|
382
354
|
);
|
|
383
355
|
const movementChanges = response.result.data.movementChanges;
|
|
384
|
-
return
|
|
356
|
+
return R2.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
385
357
|
} catch (error) {
|
|
386
358
|
return wrapError(error);
|
|
387
359
|
}
|
|
@@ -398,12 +370,69 @@ var createMechanizationServices = (client) => ({
|
|
|
398
370
|
data: { verificationToken }
|
|
399
371
|
}
|
|
400
372
|
);
|
|
401
|
-
return
|
|
373
|
+
return R2.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
374
|
+
} catch (error) {
|
|
375
|
+
return wrapError(error);
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
getMechanizationTemperatureChanges: async ({
|
|
379
|
+
farmerId,
|
|
380
|
+
mechanizationId,
|
|
381
|
+
fromDate,
|
|
382
|
+
toDate
|
|
383
|
+
}) => {
|
|
384
|
+
try {
|
|
385
|
+
const response = await client.typed(
|
|
386
|
+
"get",
|
|
387
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/temperature-changes",
|
|
388
|
+
{
|
|
389
|
+
params: {
|
|
390
|
+
fromDate,
|
|
391
|
+
toDate
|
|
392
|
+
},
|
|
393
|
+
pathParams: {
|
|
394
|
+
farmerId,
|
|
395
|
+
mechanizationId
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
);
|
|
399
|
+
const temperatureChanges = response.result.data.temperatureChanges;
|
|
400
|
+
return R2.Ok(
|
|
401
|
+
mappers.getMechanizationTemperatureChanges(temperatureChanges)
|
|
402
|
+
);
|
|
402
403
|
} catch (error) {
|
|
403
404
|
return wrapError(error);
|
|
404
405
|
}
|
|
405
406
|
},
|
|
406
|
-
|
|
407
|
+
getMechanizationFuelConsumptionChanges: async ({
|
|
408
|
+
farmerId,
|
|
409
|
+
mechanizationId,
|
|
410
|
+
fromDate,
|
|
411
|
+
toDate
|
|
412
|
+
}) => {
|
|
413
|
+
try {
|
|
414
|
+
const response = await client.typed(
|
|
415
|
+
"get",
|
|
416
|
+
"/farmers/{farmerId}/mechanizations/{mechanizationId}/sensors/fuel-consumption-changes",
|
|
417
|
+
{
|
|
418
|
+
params: {
|
|
419
|
+
fromDate,
|
|
420
|
+
toDate
|
|
421
|
+
},
|
|
422
|
+
pathParams: {
|
|
423
|
+
farmerId,
|
|
424
|
+
mechanizationId
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
const fuelConsumptionChanges = response.result.data.fuelConsumptionChanges;
|
|
429
|
+
return R2.Ok(
|
|
430
|
+
mappers.getMechanizationFuelConsumptionChanges(fuelConsumptionChanges)
|
|
431
|
+
);
|
|
432
|
+
} catch (error) {
|
|
433
|
+
return wrapError(error);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
407
436
|
});
|
|
408
437
|
|
|
409
438
|
// src/index.ts
|