@agroyaar/sdk 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +74 -43
- package/dist/index.d.ts +17 -5
- package/dist/index.mjs +74 -43
- 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_belt3 = require("@mobily/ts-belt");
|
|
95
95
|
|
|
96
96
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
97
97
|
var mappers = {
|
|
@@ -110,18 +110,18 @@ var mappers = {
|
|
|
110
110
|
date: response.date
|
|
111
111
|
}),
|
|
112
112
|
getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
|
|
113
|
-
getMechanization: (
|
|
114
|
-
id:
|
|
115
|
-
commonName:
|
|
116
|
-
model:
|
|
117
|
-
avatarURL:
|
|
118
|
-
manufactureYear:
|
|
119
|
-
code:
|
|
120
|
-
kind:
|
|
121
|
-
kindName:
|
|
122
|
-
variety: mappers.getMechanizationVariety(
|
|
113
|
+
getMechanization: (res) => ({
|
|
114
|
+
id: res.id,
|
|
115
|
+
commonName: res.commonName,
|
|
116
|
+
model: res.model,
|
|
117
|
+
avatarURL: res.avatarURL,
|
|
118
|
+
manufactureYear: res.manufactureYear,
|
|
119
|
+
code: res.code,
|
|
120
|
+
kind: res.kind,
|
|
121
|
+
kindName: res.kindName,
|
|
122
|
+
variety: mappers.getMechanizationVariety(res.variety)
|
|
123
123
|
}),
|
|
124
|
-
|
|
124
|
+
getMechanizations: (response) => response.map(mappers.getMechanization),
|
|
125
125
|
getSeasonsProcess: (response) => ({
|
|
126
126
|
id: response.id,
|
|
127
127
|
label: response.label,
|
|
@@ -150,6 +150,9 @@ var mappers = {
|
|
|
150
150
|
UpdateTrackingDeviceData: (response) => ({
|
|
151
151
|
deviceCode: response.deviceCode
|
|
152
152
|
}),
|
|
153
|
+
DeleteTrackingDeviceData: (response) => ({
|
|
154
|
+
deviceCode: response.deviceCode
|
|
155
|
+
}),
|
|
153
156
|
getQuestion: (dto) => ({
|
|
154
157
|
id: dto.id,
|
|
155
158
|
name: dto.key,
|
|
@@ -174,10 +177,7 @@ var mappers = {
|
|
|
174
177
|
date,
|
|
175
178
|
heading
|
|
176
179
|
}),
|
|
177
|
-
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
178
|
-
DeleteTrackingDeviceData: (response) => ({
|
|
179
|
-
deviceCode: response.deviceCode
|
|
180
|
-
})
|
|
180
|
+
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
// src/utils/wrapError.ts
|
|
@@ -187,6 +187,35 @@ var wrapError = (error) => {
|
|
|
187
187
|
return import_ts_belt.R.Error(err);
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/v.service.ts
|
|
191
|
+
var import_ts_belt2 = require("@mobily/ts-belt");
|
|
192
|
+
|
|
193
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/mapper.ts
|
|
194
|
+
var mappers2 = {
|
|
195
|
+
verifyPhoneNumber: (dto) => ({
|
|
196
|
+
phoneNumber: dto.phoneNumber,
|
|
197
|
+
verificationToken: dto.verificationToken
|
|
198
|
+
})
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/v.service.ts
|
|
202
|
+
var vfn = (client) => ({
|
|
203
|
+
verifyPhoneNumber: async ({
|
|
204
|
+
phoneNumber,
|
|
205
|
+
otpCode
|
|
206
|
+
}) => {
|
|
207
|
+
try {
|
|
208
|
+
const { data } = await client.post(`/auth/verify-phone-number`, {
|
|
209
|
+
phoneNumber,
|
|
210
|
+
otpCode
|
|
211
|
+
});
|
|
212
|
+
return import_ts_belt2.R.Ok(mappers2.verifyPhoneNumber(data));
|
|
213
|
+
} catch (error) {
|
|
214
|
+
return wrapError(error);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
190
219
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
191
220
|
var createMechanizationServices = (client) => ({
|
|
192
221
|
getMechanizationVarieties: async ({
|
|
@@ -196,7 +225,7 @@ var createMechanizationServices = (client) => ({
|
|
|
196
225
|
const { data } = await client.get(
|
|
197
226
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
198
227
|
);
|
|
199
|
-
return
|
|
228
|
+
return import_ts_belt3.R.Ok(
|
|
200
229
|
mappers.getMechanizationVarietyList(
|
|
201
230
|
data.result.data.mechanizationVarieties
|
|
202
231
|
)
|
|
@@ -213,27 +242,29 @@ var createMechanizationServices = (client) => ({
|
|
|
213
242
|
const { data } = await client.get(
|
|
214
243
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
215
244
|
);
|
|
216
|
-
return
|
|
245
|
+
return import_ts_belt3.R.Ok(
|
|
217
246
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
218
247
|
);
|
|
219
248
|
} catch (error) {
|
|
220
249
|
return wrapError(error);
|
|
221
250
|
}
|
|
222
251
|
},
|
|
223
|
-
getMechanizations: async (
|
|
252
|
+
getMechanizations: async ({ farmerId, kindName }) => {
|
|
224
253
|
try {
|
|
225
254
|
const response = await client.typed(
|
|
226
255
|
"get",
|
|
227
256
|
"/farmers/{farmerId}/mechanizations",
|
|
228
257
|
{
|
|
229
258
|
params: {
|
|
230
|
-
kindName
|
|
259
|
+
kindName
|
|
260
|
+
},
|
|
261
|
+
pathParams: {
|
|
262
|
+
farmerId
|
|
231
263
|
}
|
|
232
264
|
}
|
|
233
265
|
);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
);
|
|
266
|
+
const mechanizations = response.result.data.mechanizations;
|
|
267
|
+
return import_ts_belt3.R.Ok(mappers.getMechanizations(mechanizations));
|
|
237
268
|
} catch (error) {
|
|
238
269
|
return wrapError(error);
|
|
239
270
|
}
|
|
@@ -253,10 +284,9 @@ var createMechanizationServices = (client) => ({
|
|
|
253
284
|
}
|
|
254
285
|
}
|
|
255
286
|
);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
)
|
|
287
|
+
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
288
|
+
return import_ts_belt3.R.Ok(
|
|
289
|
+
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
260
290
|
);
|
|
261
291
|
} catch (error) {
|
|
262
292
|
return wrapError(error);
|
|
@@ -272,7 +302,7 @@ var createMechanizationServices = (client) => ({
|
|
|
272
302
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
273
303
|
{ deviceCode }
|
|
274
304
|
);
|
|
275
|
-
return
|
|
305
|
+
return import_ts_belt3.R.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
276
306
|
} catch (error) {
|
|
277
307
|
return wrapError(error);
|
|
278
308
|
}
|
|
@@ -282,7 +312,7 @@ var createMechanizationServices = (client) => ({
|
|
|
282
312
|
const { data } = await client.get(
|
|
283
313
|
"/statics/mechanizations-seasons-process-kinds"
|
|
284
314
|
);
|
|
285
|
-
return
|
|
315
|
+
return import_ts_belt3.R.Ok(
|
|
286
316
|
mappers.getSeasonsProcessList(
|
|
287
317
|
data.result.data.mechanizationSeasonProcessKinds
|
|
288
318
|
)
|
|
@@ -302,7 +332,7 @@ var createMechanizationServices = (client) => ({
|
|
|
302
332
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
303
333
|
{ deviceCode, verificationToken }
|
|
304
334
|
);
|
|
305
|
-
return
|
|
335
|
+
return import_ts_belt3.R.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
306
336
|
} catch (error) {
|
|
307
337
|
return wrapError(error);
|
|
308
338
|
}
|
|
@@ -321,13 +351,14 @@ var createMechanizationServices = (client) => ({
|
|
|
321
351
|
}
|
|
322
352
|
);
|
|
323
353
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
324
|
-
|
|
325
|
-
return import_ts_belt2.R.Ok(mappers.getQuestions(questions));
|
|
354
|
+
return import_ts_belt3.R.Ok(mappers.getQuestions(questions));
|
|
326
355
|
} catch (error) {
|
|
327
356
|
return wrapError(error);
|
|
328
357
|
}
|
|
329
358
|
},
|
|
330
359
|
getMechanizationMovementChanges: async ({
|
|
360
|
+
farmerId,
|
|
361
|
+
mechanizationId,
|
|
331
362
|
fromDate,
|
|
332
363
|
toDate
|
|
333
364
|
}) => {
|
|
@@ -339,14 +370,15 @@ var createMechanizationServices = (client) => ({
|
|
|
339
370
|
params: {
|
|
340
371
|
fromDate,
|
|
341
372
|
toDate
|
|
373
|
+
},
|
|
374
|
+
pathParams: {
|
|
375
|
+
farmerId,
|
|
376
|
+
mechanizationId
|
|
342
377
|
}
|
|
343
378
|
}
|
|
344
379
|
);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
response.result.data.movementChanges
|
|
348
|
-
)
|
|
349
|
-
);
|
|
380
|
+
const movementChanges = response.result.data.movementChanges;
|
|
381
|
+
return import_ts_belt3.R.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
350
382
|
} catch (error) {
|
|
351
383
|
return wrapError(error);
|
|
352
384
|
}
|
|
@@ -360,16 +392,15 @@ var createMechanizationServices = (client) => ({
|
|
|
360
392
|
const { data } = await client.delete(
|
|
361
393
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
|
|
362
394
|
{
|
|
363
|
-
data: verificationToken
|
|
395
|
+
data: { verificationToken }
|
|
364
396
|
}
|
|
365
397
|
);
|
|
366
|
-
return
|
|
398
|
+
return import_ts_belt3.R.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
367
399
|
} catch (error) {
|
|
368
|
-
|
|
369
|
-
console.error("UpdateTrackingDevice API Error:", err);
|
|
370
|
-
return import_ts_belt2.R.Error(err);
|
|
400
|
+
return wrapError(error);
|
|
371
401
|
}
|
|
372
|
-
}
|
|
402
|
+
},
|
|
403
|
+
...vfn(client)
|
|
373
404
|
});
|
|
374
405
|
|
|
375
406
|
// src/index.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,11 @@ type UpdateTrackingDeviceVariables = {
|
|
|
119
119
|
deviceCode: string;
|
|
120
120
|
verificationToken: string;
|
|
121
121
|
};
|
|
122
|
+
type DeleteTrackingDeviceVariables = {
|
|
123
|
+
farmerId: string;
|
|
124
|
+
mechanizationId: string;
|
|
125
|
+
verificationToken: string;
|
|
126
|
+
};
|
|
122
127
|
type MechanizationQuestionModel = {
|
|
123
128
|
id: Identifiers.QuestionId;
|
|
124
129
|
name: string;
|
|
@@ -141,14 +146,20 @@ type MechanizationMovementChangesModel = {
|
|
|
141
146
|
date: string;
|
|
142
147
|
};
|
|
143
148
|
type MechanizationMovementChangesVariable = {
|
|
149
|
+
farmerId: string;
|
|
150
|
+
mechanizationId: string;
|
|
144
151
|
fromDate?: string | null | undefined;
|
|
145
152
|
toDate?: string | null | undefined;
|
|
146
153
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
|
|
155
|
+
type VerifyPhoneNumberModel = {
|
|
156
|
+
phoneNumber: string;
|
|
150
157
|
verificationToken: string;
|
|
151
158
|
};
|
|
159
|
+
type VerifyPhoneNumberVariables = {
|
|
160
|
+
phoneNumber: string;
|
|
161
|
+
otpCode: string;
|
|
162
|
+
};
|
|
152
163
|
|
|
153
164
|
/**
|
|
154
165
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -2961,15 +2972,16 @@ declare const createClient: (config: ClientConfig, middlewares?: ((_config: Inte
|
|
|
2961
2972
|
declare const createSDK: (config: ClientConfig, middlewares?: Parameters<typeof createClient>[1]) => {
|
|
2962
2973
|
dashboardServices: {
|
|
2963
2974
|
mechanization: {
|
|
2975
|
+
verifyPhoneNumber: ({ phoneNumber, otpCode, }: VerifyPhoneNumberVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<VerifyPhoneNumberModel>>;
|
|
2964
2976
|
getMechanizationVarieties: ({ kindName, }: MechanizationVarietyVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationVarietyModel[]>>;
|
|
2965
2977
|
getSpeedChangesChartData: ({ farmerId, mechanizationId, }: SpeedChangesChartVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SpeedChangesChartModel[]>>;
|
|
2966
|
-
getMechanizations: (
|
|
2978
|
+
getMechanizations: ({ farmerId, kindName }: MechanizationVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationModel[]>>;
|
|
2967
2979
|
getMotorizedMechanizationSensors: ({ farmerId, mechanizationId, }: MotorizedMechanizationSensorsVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MotorizedMechanizationSensorsModel>>;
|
|
2968
2980
|
SubmitTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, }: SubmitTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2969
2981
|
getSeasonsProcess: () => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<SeasonsProcessModel[]>>;
|
|
2970
2982
|
UpdateTrackingDeviceCode: ({ farmerId, mechanizationId, deviceCode, verificationToken, }: UpdateTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2971
2983
|
getMechanizationQuestionList: ({ varietyId, }: GetMechanizationQuestionVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationQuestionModel[]>>;
|
|
2972
|
-
getMechanizationMovementChanges: ({ fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
|
|
2984
|
+
getMechanizationMovementChanges: ({ farmerId, mechanizationId, fromDate, toDate, }: MechanizationMovementChangesVariable) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<MechanizationMovementChangesModel[]>>;
|
|
2973
2985
|
DeleteTrackingDeviceCode: ({ farmerId, mechanizationId, verificationToken, }: DeleteTrackingDeviceVariables) => Promise<_mobily_ts_belt.Error<Error> | _mobily_ts_belt.Ok<TrackingDeviceCodeModel>>;
|
|
2974
2986
|
};
|
|
2975
2987
|
};
|
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 R3 } from "@mobily/ts-belt";
|
|
59
59
|
|
|
60
60
|
// src/services/dashboard/mechanization/mechanization.mapper.ts
|
|
61
61
|
var mappers = {
|
|
@@ -74,18 +74,18 @@ var mappers = {
|
|
|
74
74
|
date: response.date
|
|
75
75
|
}),
|
|
76
76
|
getSpeedChangesChartPointsList: (response) => response.map(mappers.getSpeedChangesChart),
|
|
77
|
-
getMechanization: (
|
|
78
|
-
id:
|
|
79
|
-
commonName:
|
|
80
|
-
model:
|
|
81
|
-
avatarURL:
|
|
82
|
-
manufactureYear:
|
|
83
|
-
code:
|
|
84
|
-
kind:
|
|
85
|
-
kindName:
|
|
86
|
-
variety: mappers.getMechanizationVariety(
|
|
77
|
+
getMechanization: (res) => ({
|
|
78
|
+
id: res.id,
|
|
79
|
+
commonName: res.commonName,
|
|
80
|
+
model: res.model,
|
|
81
|
+
avatarURL: res.avatarURL,
|
|
82
|
+
manufactureYear: res.manufactureYear,
|
|
83
|
+
code: res.code,
|
|
84
|
+
kind: res.kind,
|
|
85
|
+
kindName: res.kindName,
|
|
86
|
+
variety: mappers.getMechanizationVariety(res.variety)
|
|
87
87
|
}),
|
|
88
|
-
|
|
88
|
+
getMechanizations: (response) => response.map(mappers.getMechanization),
|
|
89
89
|
getSeasonsProcess: (response) => ({
|
|
90
90
|
id: response.id,
|
|
91
91
|
label: response.label,
|
|
@@ -114,6 +114,9 @@ var mappers = {
|
|
|
114
114
|
UpdateTrackingDeviceData: (response) => ({
|
|
115
115
|
deviceCode: response.deviceCode
|
|
116
116
|
}),
|
|
117
|
+
DeleteTrackingDeviceData: (response) => ({
|
|
118
|
+
deviceCode: response.deviceCode
|
|
119
|
+
}),
|
|
117
120
|
getQuestion: (dto) => ({
|
|
118
121
|
id: dto.id,
|
|
119
122
|
name: dto.key,
|
|
@@ -138,10 +141,7 @@ var mappers = {
|
|
|
138
141
|
date,
|
|
139
142
|
heading
|
|
140
143
|
}),
|
|
141
|
-
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
142
|
-
DeleteTrackingDeviceData: (response) => ({
|
|
143
|
-
deviceCode: response.deviceCode
|
|
144
|
-
})
|
|
144
|
+
getMechanizationMovementChanges: (response) => response.map(mappers.getMechanizationMovementChange)
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
// src/utils/wrapError.ts
|
|
@@ -151,6 +151,35 @@ var wrapError = (error) => {
|
|
|
151
151
|
return R.Error(err);
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/v.service.ts
|
|
155
|
+
import { R as R2 } from "@mobily/ts-belt";
|
|
156
|
+
|
|
157
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/mapper.ts
|
|
158
|
+
var mappers2 = {
|
|
159
|
+
verifyPhoneNumber: (dto) => ({
|
|
160
|
+
phoneNumber: dto.phoneNumber,
|
|
161
|
+
verificationToken: dto.verificationToken
|
|
162
|
+
})
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// src/services/dashboard/mechanization/verifyPhoneNumber/v.service.ts
|
|
166
|
+
var vfn = (client) => ({
|
|
167
|
+
verifyPhoneNumber: async ({
|
|
168
|
+
phoneNumber,
|
|
169
|
+
otpCode
|
|
170
|
+
}) => {
|
|
171
|
+
try {
|
|
172
|
+
const { data } = await client.post(`/auth/verify-phone-number`, {
|
|
173
|
+
phoneNumber,
|
|
174
|
+
otpCode
|
|
175
|
+
});
|
|
176
|
+
return R2.Ok(mappers2.verifyPhoneNumber(data));
|
|
177
|
+
} catch (error) {
|
|
178
|
+
return wrapError(error);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
154
183
|
// src/services/dashboard/mechanization/mechanization.service.ts
|
|
155
184
|
var createMechanizationServices = (client) => ({
|
|
156
185
|
getMechanizationVarieties: async ({
|
|
@@ -160,7 +189,7 @@ var createMechanizationServices = (client) => ({
|
|
|
160
189
|
const { data } = await client.get(
|
|
161
190
|
`/statics/mechanizations-varieties?kindName=${kindName}`
|
|
162
191
|
);
|
|
163
|
-
return
|
|
192
|
+
return R3.Ok(
|
|
164
193
|
mappers.getMechanizationVarietyList(
|
|
165
194
|
data.result.data.mechanizationVarieties
|
|
166
195
|
)
|
|
@@ -177,27 +206,29 @@ var createMechanizationServices = (client) => ({
|
|
|
177
206
|
const { data } = await client.get(
|
|
178
207
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/sensors/speed-changes`
|
|
179
208
|
);
|
|
180
|
-
return
|
|
209
|
+
return R3.Ok(
|
|
181
210
|
mappers.getSpeedChangesChartPointsList(data.result.data.speedChanges)
|
|
182
211
|
);
|
|
183
212
|
} catch (error) {
|
|
184
213
|
return wrapError(error);
|
|
185
214
|
}
|
|
186
215
|
},
|
|
187
|
-
getMechanizations: async (
|
|
216
|
+
getMechanizations: async ({ farmerId, kindName }) => {
|
|
188
217
|
try {
|
|
189
218
|
const response = await client.typed(
|
|
190
219
|
"get",
|
|
191
220
|
"/farmers/{farmerId}/mechanizations",
|
|
192
221
|
{
|
|
193
222
|
params: {
|
|
194
|
-
kindName
|
|
223
|
+
kindName
|
|
224
|
+
},
|
|
225
|
+
pathParams: {
|
|
226
|
+
farmerId
|
|
195
227
|
}
|
|
196
228
|
}
|
|
197
229
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
);
|
|
230
|
+
const mechanizations = response.result.data.mechanizations;
|
|
231
|
+
return R3.Ok(mappers.getMechanizations(mechanizations));
|
|
201
232
|
} catch (error) {
|
|
202
233
|
return wrapError(error);
|
|
203
234
|
}
|
|
@@ -217,10 +248,9 @@ var createMechanizationServices = (client) => ({
|
|
|
217
248
|
}
|
|
218
249
|
}
|
|
219
250
|
);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
)
|
|
251
|
+
const motorizedMechanizationSensors = response.result.data.motorizedMechanizationSensors;
|
|
252
|
+
return R3.Ok(
|
|
253
|
+
mappers.getMotorizedMechanizationSensors(motorizedMechanizationSensors)
|
|
224
254
|
);
|
|
225
255
|
} catch (error) {
|
|
226
256
|
return wrapError(error);
|
|
@@ -236,7 +266,7 @@ var createMechanizationServices = (client) => ({
|
|
|
236
266
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/submit-device-code`,
|
|
237
267
|
{ deviceCode }
|
|
238
268
|
);
|
|
239
|
-
return
|
|
269
|
+
return R3.Ok(mappers.SubmitTrackingDeviceData(data));
|
|
240
270
|
} catch (error) {
|
|
241
271
|
return wrapError(error);
|
|
242
272
|
}
|
|
@@ -246,7 +276,7 @@ var createMechanizationServices = (client) => ({
|
|
|
246
276
|
const { data } = await client.get(
|
|
247
277
|
"/statics/mechanizations-seasons-process-kinds"
|
|
248
278
|
);
|
|
249
|
-
return
|
|
279
|
+
return R3.Ok(
|
|
250
280
|
mappers.getSeasonsProcessList(
|
|
251
281
|
data.result.data.mechanizationSeasonProcessKinds
|
|
252
282
|
)
|
|
@@ -266,7 +296,7 @@ var createMechanizationServices = (client) => ({
|
|
|
266
296
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/update-device-code`,
|
|
267
297
|
{ deviceCode, verificationToken }
|
|
268
298
|
);
|
|
269
|
-
return
|
|
299
|
+
return R3.Ok(mappers.UpdateTrackingDeviceData(data));
|
|
270
300
|
} catch (error) {
|
|
271
301
|
return wrapError(error);
|
|
272
302
|
}
|
|
@@ -285,13 +315,14 @@ var createMechanizationServices = (client) => ({
|
|
|
285
315
|
}
|
|
286
316
|
);
|
|
287
317
|
const questions = data?.result?.data.mechanizationsQuestions;
|
|
288
|
-
|
|
289
|
-
return R2.Ok(mappers.getQuestions(questions));
|
|
318
|
+
return R3.Ok(mappers.getQuestions(questions));
|
|
290
319
|
} catch (error) {
|
|
291
320
|
return wrapError(error);
|
|
292
321
|
}
|
|
293
322
|
},
|
|
294
323
|
getMechanizationMovementChanges: async ({
|
|
324
|
+
farmerId,
|
|
325
|
+
mechanizationId,
|
|
295
326
|
fromDate,
|
|
296
327
|
toDate
|
|
297
328
|
}) => {
|
|
@@ -303,14 +334,15 @@ var createMechanizationServices = (client) => ({
|
|
|
303
334
|
params: {
|
|
304
335
|
fromDate,
|
|
305
336
|
toDate
|
|
337
|
+
},
|
|
338
|
+
pathParams: {
|
|
339
|
+
farmerId,
|
|
340
|
+
mechanizationId
|
|
306
341
|
}
|
|
307
342
|
}
|
|
308
343
|
);
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
response.result.data.movementChanges
|
|
312
|
-
)
|
|
313
|
-
);
|
|
344
|
+
const movementChanges = response.result.data.movementChanges;
|
|
345
|
+
return R3.Ok(mappers.getMechanizationMovementChanges(movementChanges));
|
|
314
346
|
} catch (error) {
|
|
315
347
|
return wrapError(error);
|
|
316
348
|
}
|
|
@@ -324,16 +356,15 @@ var createMechanizationServices = (client) => ({
|
|
|
324
356
|
const { data } = await client.delete(
|
|
325
357
|
`/farmers/${farmerId}/mechanizations/${mechanizationId}/delete-device-code`,
|
|
326
358
|
{
|
|
327
|
-
data: verificationToken
|
|
359
|
+
data: { verificationToken }
|
|
328
360
|
}
|
|
329
361
|
);
|
|
330
|
-
return
|
|
362
|
+
return R3.Ok(mappers.DeleteTrackingDeviceData(data));
|
|
331
363
|
} catch (error) {
|
|
332
|
-
|
|
333
|
-
console.error("UpdateTrackingDevice API Error:", err);
|
|
334
|
-
return R2.Error(err);
|
|
364
|
+
return wrapError(error);
|
|
335
365
|
}
|
|
336
|
-
}
|
|
366
|
+
},
|
|
367
|
+
...vfn(client)
|
|
337
368
|
});
|
|
338
369
|
|
|
339
370
|
// src/index.ts
|