From c04437bd6b6e29638ba31769b21688853bfe1c77 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 27 Jul 2021 18:04:37 +0200 Subject: [PATCH] OZG-409 Play with Datafetchers --- .../itvsh/goofy/kommentar/GraphQLDataFetchers.java | 7 ++++--- goofy-server/src/main/resources/schema.graphqls | 14 ++++++++++++-- .../goofy/kommentar/KommentarCommandITCase.java | 13 ------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/goofy-server/src/main/java/de/itvsh/goofy/kommentar/GraphQLDataFetchers.java b/goofy-server/src/main/java/de/itvsh/goofy/kommentar/GraphQLDataFetchers.java index f86a7997e0..576ed558cf 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/kommentar/GraphQLDataFetchers.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/kommentar/GraphQLDataFetchers.java @@ -75,14 +75,15 @@ public class GraphQLDataFetchers { public DataFetcher getKommentarDataFetcher() { return dataFetchingEnvironment -> { - System.out.println("inside fetcher"); Kommentar kommentar = kommentarService.getById(dataFetchingEnvironment.getArgument("id")); - Map<String, String> kommentarAsMap = Map.of( + return kommentar; + /*Map<String, String> kommentarAsMap = Map.of( "id", kommentar.getId(), "createdBy", kommentar.getCreatedBy(), "createdByName", kommentar.getCreatedByName(), "text", kommentar.getText()); - return kommentarAsMap; + return kommentarAsMap;*/ }; } + } \ No newline at end of file diff --git a/goofy-server/src/main/resources/schema.graphqls b/goofy-server/src/main/resources/schema.graphqls index f2d7a3e3e3..9b27c6212e 100644 --- a/goofy-server/src/main/resources/schema.graphqls +++ b/goofy-server/src/main/resources/schema.graphqls @@ -2,6 +2,7 @@ type Query { bookById(id: ID): Book greeting: String kommentar(id: ID): Kommentar + something: String } type Book { @@ -18,8 +19,17 @@ type Author { } type Kommentar { - id: ID + id: ID! createdBy: String createdByName: String - text: String + text: String! + createdAt: ZonedDateTime +} + +type ZonedDateTime { + year: Int + month: String + dayOfWeek: String + hour: Int + blurb: String } \ No newline at end of file diff --git a/goofy-server/src/test/java/de/itvsh/goofy/kommentar/KommentarCommandITCase.java b/goofy-server/src/test/java/de/itvsh/goofy/kommentar/KommentarCommandITCase.java index f715918f92..dc15253933 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/kommentar/KommentarCommandITCase.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/kommentar/KommentarCommandITCase.java @@ -53,19 +53,6 @@ class KommentarCommandITCase { verify(remoteService).sendKommentarCommand(eq(KommentarTestFactory.ID), any()); } - @WithMockUser - @Nested - class TestEndpoint { - - @Test - void createCommandWithInvalidText() throws Exception { - ResultActions resultActions = mockMvc.perform(get(new URI("/api/kommentars/636fbb1b-3f77-4aac-8480-fdf0e2d52d9e"))) - .andExpect(status().is2xxSuccessful()); - System.out.println(resultActions.andReturn().getResponse().getStatus()); - } - - } - @WithMockUser @DisplayName("should return validation error") @Nested -- GitLab