Skip to content
Snippets Groups Projects
Commit c04437bd authored by OZGCloud's avatar OZGCloud
Browse files

OZG-409 Play with Datafetchers

parent e3454a08
Branches
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment