You can view a demo of some features here.
-
Clone the project.
-
Run
docker build -t order-management-system .
to buildDocker
image. -
Run
docker run -p 8080:8080 order-management-system
to run server.
All the GraphQL API endpoints are exposed in /graphql
.
Some endpoints require JWT
token and a particular role for authorization.
- Create a user with the following example graphQL body:
mutation {
createUser(input:{
name: "admin"
email:"[email protected]"
password:"admin"
role: ADMIN
}){
email
role
name
}
}
- Login using the following example graphQL body:
query {
loginUser(input: {password: "admin",
email: "[email protected]"})
}
-
After retrieving the token, refer to the schema to determine how to make certain queries and mutations.
-
For authenticated requests, send request with header:
Authorization: Bearer {TOKEN}
-
Visit this link for a beautiful interface to make queries and mutations.
For clarity when reading the schema:
-
Endpoints annotated with
#[ADMIN_AUTH_REQUIRED]
can only be accessed by logged in users withADMIN
role. -
Endpoints annotated with
#[NO_AUTH_REQUIRED]
can be accessed without logging in. -
Endpoints annotated with
#[ANY_AUTH_REQUIRED]
can only be accessed by logged in users with eitherADMIN
orNORMAL
role.