Skip to content

fabienmifsud/spring-boot-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Crud with Postgres & DGS GraphQL

This project is aimed to quickly test the stack :

Clone & build

  • Tests are executed on an h2 database
  • Simply mvn clean install it

Run it

You can run the app with a local postgres database by

  • running docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
  • Launch the SpringBootCrudApplication.class
  • Two users are available with Basic Auth :
    • standardUser (read only)
    • adminUser (create & read)

GraphQl queries

# Sample Queries available for users : standardUser, adminUser : 
query readClients {
  clients{
    id,
    name,
    email,
    dateOfBirth
  }
}

query readProducts {
  products{
    name,
    price
  }
}

query readBookings {
  bookings{
    product {
      name
    },
    client {
      name
    },
    bookingDate
  }
}

query readBookingsByClient {
  bookingsByClient (clientId: 1){
    product {
      name
    }
    bookingDate
  }
}

# Sample Mutations available for users : adminUser : 
mutation createClient {
    createClient(name: "toto3", email: "my.email@toto.com", dateOfBirth: "1986-01-17 00:12:12.000")
}

mutation createProduct {
    createProduct(name: "produit2", price: 10.45)
}

mutation createBooking {
    createBooking(productId: 2, clientId: 2)
}

Same app with other stacks :

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages