-
Clone the Project
git clone [email protected]:jameshueston/Railhead-TechnicalAssessment.git
-
Start Services
docker compose up
- For expected output, see docs/expected_output/docker_compose_up.
-
Execute Queries (see below)
-
When finished, clean up:
docker compose rm --force
docker volume rm technicalassessment_db
This was tested on docker v20.10.21.
The service outputs JSON.
Examples below use the small command-line utility jq
to pretty print -- highly recommend! You may Install jq or remove | jq
from queries before executing.
curl --silent
removes download status and is provided on examples for clean output when piping to jq
.
Per requirements, each successful query needs the Header TrailHead-token: pa$$word
. Examples below use curl
and escape the dollar signs with backslashes.
Two queries were required:
Query 5: Search by a phone number to look up employees
Query 6: Search by a task name to get all employees working on it.
In order to discover searchable terms for those queries, additional queries are provided below showing data available.
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employees | jq
[
{
"ID": 1,
"Email": "[email protected]",
"Phone": "6303236630",
"Role": "supervisor"
},
{
"ID": 2,
"Email": "[email protected]",
"Phone": "1009071984",
"Role": "supervisor"
},
{
"ID": 3,
"Email": "[email protected]",
"Phone": "2963921353",
"Role": "supervisor"
},
{
"ID": 4,
"Email": "[email protected]",
"Phone": "1671321971",
"Role": "supervisor"
},
{
"ID": 5,
"Email": "[email protected]",
"Phone": "5454966148",
"Role": "supervisor"
},
{
"ID": 6,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 7,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 8,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 9,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 10,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
}
]
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employee/1 | jq
{
"ID": 1,
"Email": "[email protected]",
"Phone": "6303236630",
"Role": "supervisor"
}
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/tasks | jq
[
{
"ID": 1,
"Name": "Find the Right People"
},
{
"ID": 2,
"Name": "Tailor Jobs to Fit New Hires"
},
{
"ID": 3,
"Name": "Make Fleetwide Trackers Better"
},
{
"ID": 4,
"Name": "Create Back Office and Web Apps Customers Need"
},
{
"ID": 5,
"Name": "Tailor New Product to Small Customers Efficiently"
}
]
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/task/1 | jq
{
"ID": 1,
"Name": "Find the Right People"
}
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employees/searchByPhone/5454966148 | jq
[
{
"ID": 5,
"Email": "[email protected]",
"Phone": "5454966148",
"Role": "supervisor"
}
]
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employees/searchByPhone/7088445500 | jq
[
{
"ID": 6,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 7,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 8,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 9,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
},
{
"ID": 10,
"Email": "[email protected]",
"Phone": "7088445500",
"Role": "worker"
}
]
A case-insensitive search on Task.Name for {searchterm}
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employees/searchByTaskName/{searchterm} | jq
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employees/searchByTaskName/to | jq
[
{
"EmployeeEmail": "[email protected]",
"TaskName": "Tailor Jobs to Fit New Hires"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Create Back Office and Web Apps Customers Need"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Tailor New Product to Small Customers Efficiently"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Create Back Office and Web Apps Customers Need"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Tailor New Product to Small Customers Efficiently"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Tailor New Product to Small Customers Efficiently"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Create Back Office and Web Apps Customers Need"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Create Back Office and Web Apps Customers Need"
}
]
curl --silent --header "TrailHead-token:pa\$\$word" localhost:8080/employees/searchByTaskName/the | jq
[
{
"EmployeeEmail": "[email protected]",
"TaskName": "Find the Right People"
},
{
"EmployeeEmail": "[email protected]",
"TaskName": "Find the Right People"
}
]