- Install Golang
- Clone repo
git clone https://github.com/sandyleo26/getsubordinates
- build & run
make start
-
Run unit tests
make test
-
Run interactive tests (needs curl or postman) For example, here's the curl command
# set roles
curl -X POST http://localhost:8080/roles -d "[
{
\"Id\": 1,
\"Name\": \"System Administrator\",
\"Parent\": 0
},
{
\"Id\": 2,
\"Name\": \"Location Manager\",
\"Parent\": 1
},
{
\"Id\": 3,
\"Name\": \"Supervisor\",
\"Parent\": 2
},
{
\"Id\": 4,
\"Name\": \"Employee\",
\"Parent\": 3
},
{
\"Id\": 5,
\"Name\": \"Trainer\",
\"Parent\": 3
}
]"
# set users
curl -X POST http://localhost:8080/users -d "[
{
\"Id\": 1,
\"Name\": \"Adam Admin\",
\"Role\": 1
},
{
\"Id\": 2,
\"Name\": \"Emily Employee\",
\"Role\": 4
},
{
\"Id\": 3,
\"Name\": \"Sam Supervisor\",
\"Role\": 3
},
{
\"Id\": 4,
\"Name\": \"Mary Manager\",
\"Role\": 2
},
{
\"Id\": 5,
\"Name\": \"Steve Trainer\",
\"Role\": 5
}
]"
# query
curl http://localhost:8080/subordinates/3