From f6cd7c0a4de5655bee7188e84fb9ff1a3dd709b3 Mon Sep 17 00:00:00 2001 From: Joao-Moura Date: Fri, 23 Apr 2021 11:01:40 +0000 Subject: [PATCH 1/2] =?UTF-8?q?#38=20Alterando=20rota=20para=20announcemen?= =?UTF-8?q?t/retrieve=20e=20alterando=20os=20dados=20que=20s=C3=A3o=20rece?= =?UTF-8?q?bidos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hortum_mobile/lib/data/prod_log_data_backend.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hortum_mobile/lib/data/prod_log_data_backend.dart b/hortum_mobile/lib/data/prod_log_data_backend.dart index ba328936..53410037 100644 --- a/hortum_mobile/lib/data/prod_log_data_backend.dart +++ b/hortum_mobile/lib/data/prod_log_data_backend.dart @@ -16,7 +16,7 @@ class ProdLoggedAnnounDataApi { Future getAnnounProd() async { String encodedEmail = encodeString(actualUser.email); - String url = 'http://$ip:8000/productor/retrieve/${encodedEmail}'; + String url = 'http://$ip:8000/announcement/retrieve/${encodedEmail}'; var header = { "Content-Type": "application/json", @@ -26,7 +26,7 @@ class ProdLoggedAnnounDataApi { Response response = await this.dio.get(url, options: Options(headers: header)); - this.announcements = response.data['announcements']; + this.announcements = response.data; manipulateData(); } From 19def04eb0b51d792f36e0a3e226a9585580835b Mon Sep 17 00:00:00 2001 From: Joao-Moura Date: Fri, 23 Apr 2021 19:54:42 +0000 Subject: [PATCH 2/2] #38 Corrigindo teste da rota alterada --- .../test/home_productor_page_test.dart | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/hortum_mobile/test/home_productor_page_test.dart b/hortum_mobile/test/home_productor_page_test.dart index df0f3e6c..18dc23c1 100644 --- a/hortum_mobile/test/home_productor_page_test.dart +++ b/hortum_mobile/test/home_productor_page_test.dart @@ -12,22 +12,19 @@ main() { TestWidgetsFlutterBinding.ensureInitialized(); final dioMock = DioMock(); - dynamic response = { - "username": "Usuário Teste", - "email": "usuário@gmail.com", - "idPicture": null, - "announcements": [ - { - "username": "Usuário Teste", - "idPictureProductor": null, - "name": "Folha Verde", - "type_of_product": "Alface", - "description": "Alface plantado na fazenda", - "price": 5.0, - "idPicture": null - } - ] - }; + List response = [ + { + "email": "usuário@gmail.com", + "username": "Usuário Teste", + "idPictureProductor": null, + "name": "Folha Verde", + "type_of_product": "Alface", + "description": "Alface plantado na fazenda", + "price": 5.0, + "idPicture": null, + "likes": 0 + }, + ]; Widget makeTestable() { return MaterialApp(