Browse Source

update api get crop detail

master
daivph 5 years ago
parent
commit
78aba2427a
3 changed files with 5 additions and 6 deletions
  1. +3
    -4
      lib/custom_model/CropPlot.dart
  2. +1
    -1
      lib/data/api/rest_client.dart
  3. +1
    -1
      lib/data/api/rest_client.g.dart

+ 3
- 4
lib/custom_model/CropPlot.dart View File

@@ -22,9 +22,9 @@ class CropPlot {
tbCropDTO = json['tbCropDTO'] != null
? new TbCropDTO.fromJson(json['tbCropDTO'])
: null;
if (json['activityTimeline'] != null) {
if (json['activities'] != null) {
activities = new List<Activities>();
json['activityTimeline'].forEach((v) {
json['activities'].forEach((v) {
activities.add(new Activities.fromJson(v));
});
}
@@ -42,8 +42,7 @@ class CropPlot {
data['tbCropDTO'] = this.tbCropDTO.toJson();
}
if (this.activities != null) {
data['activityTimeline'] =
this.activities.map((v) => v.toJson()).toList();
data['activities'] = this.activities.map((v) => v.toJson()).toList();
}
data['sowingDate'] = this.sowingDate;
data['soakSeedsTime'] = this.soakSeedsTime;

+ 1
- 1
lib/data/api/rest_client.dart View File

@@ -49,7 +49,7 @@ abstract class RestClient {

//Crop
@GET(
"/api/tb-crops-detail/{cropId}?page={page}&size={size}&sort=executeDate,DESC")
"/api/tb-crops-detail-for-app/{cropId}?page={page}&size={size}&sort=executeDate,DESC")
Future<CropPlot> getCropDetail(@Path() int cropId,
{@Path() int page = 0, @Path() int size = 20});


+ 1
- 1
lib/data/api/rest_client.g.dart View File

@@ -214,7 +214,7 @@ class _RestClient implements RestClient {
queryParameters.removeWhere((k, v) => v == null);
final _data = <String, dynamic>{};
final Response<Map<String, dynamic>> _result = await _dio.request(
'/api/tb-crops-detail/$cropId?page=$page&size=$size&sort=executeDate,DESC',
'/api/tb-crops-detail-for-app/$cropId?page=$page&size=$size&sort=executeDate,DESC',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',

Loading…
Cancel
Save