Skip to content

Latest commit

 

History

History
123 lines (101 loc) · 1.91 KB

README.md

File metadata and controls

123 lines (101 loc) · 1.91 KB

Dev instructions

CRUD & Quarkus

Postgres – docker container

docker compose up
# docker run -d --rm --name my_reative_db \
#       -e POSTGRES_USER=user \
#       -e POSTGRES_PASSWORD=password 
#       -e POSTGRES_DB=my_db 
#       -p 5432:5432 postgres:11.5

# clean
docker rm $(docker ps -a -q) -f
docker volume prune

Run / Build

# live coding
./mvnw compile quarkus:dev

# native image
./mvnw package -Pnative -Dquarkus.native.container-build=true

GraphQL UI http://localhost:8080/q/graphql-ui/

GraphQL examples

query allOrganisations {
  allOrganisations {
    title
    createdDate
    zipCode
    id
    products {
      name
    }
  }
}

query getOrganisation {
  organisation(organisationId: 1) {
    title
    zipCode
    createdDate
  }
}

query getOrganisationAndProductName {
  organisation(organisationId: 1) {
    title
    zipCode
    createdDate
    products {
      name
    }
  }
}

mutation addOrganisation {
  createOrganisation(
    organisation: {title: "The Mask", createdDate: "1994-12-25", zipCode: "99098"}
  ) {
    title
    createdDate
    zipCode
  }
}

mutation updateOrganisation {
  updateOrganisation(organisationId: 1, organisation: {title: "The One"}) {
    title
  }
}

mutation deleteOrganisation {
  deleteOrganisation(organisationId: 1)
}

query allProducts {
  allProducts {
    name
    organisations {
      title
      zipCode
    }
  }
}

mutation addProductToOrganisation {
  addProductToOrganisation(organisationId: 1, productId: 4) {
    title
    createdDate
    zipCode
    products {
      name
    }
  }
}

mutation addOrganisationToProduct {
  addOrganisationToProduct(organisationId: 2, productId: 4) {
    name
    id
    organisations {
      title
      products {
        name
      }
    }
  }
}