Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0-M3</version>
<version>3.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down Expand Up @@ -77,6 +77,10 @@
<artifactId>spring-boot-docker-compose</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-graphql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gt/app/config/security/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class SecurityConfig {
"/swagger-ui/**",
"/swagger-ui.html/**",
"/signup/**",
"/graphiql/**",
"/graphql/**",
"/" //landing page is allowed for all
};

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gt/app/modules/note/NoteRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.graphql.data.GraphQlRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

@GraphQlRepository
interface NoteRepository extends JpaRepository<Note, Long> {

@EntityGraph(attributePaths = {"createdByUser"})
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spring:
mvc:
static-path-pattern: /static/**
jpa:
show-sql: false
show-sql: true
datasource:
url: jdbc:h2:mem:testdb
h2: #dev uses H2 and 'emailhog' docker container from docker-compose
Expand All @@ -25,3 +25,6 @@ spring:
compose:
profiles:
active: mailHog
graphql:
graphiql:
enabled: true
43 changes: 43 additions & 0 deletions src/main/resources/graphql/schema.graphqls
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
type Note {
id: ID!
title: String!
createdByUser: User!
content: String!
}

type User {
id: ID!
uniqueId: String!
}


input NoteInput {
title: String!
author: String
}

type Query {
notes(note: NoteInput): [Note]!
noteById(id: ID!): Note
}

#Test1:
#query MyQuery {
# noteById(id: "1") {
# id
# title
# content
# createdByUser {
# id
# uniqueId
# }
# }
#}

#Test2
#query Q2 {
# notes(note: {title: "Admin's First Note"}) {
# id
# content
# }
#}
Loading