A Technical Test for a Senior Software Engineer role at JRNY.ai
This project requires you to have DotNetCore 2.2 SDK installed.
I used build 2.2.103 from https://dotnet.microsoft.com/download/dotnet-core/2.2
I spent a bit of time playing with the GraphQL explorer and looking at the documentation, however, it didn't seem to offer the number of contributions a collaborator had done, or give the raw commits to calculate that myself.
I could have done a mixed approach, and queried the repos for an organization with the GraphQL API, but then would have had to use the v3 API to get stats.
I decided that wasn't as clean as just using the Github v3 API for both
There are 3 ways to set your access token and which organization to query
You can mix and pass one in one way (like your access key in the appsettings.json and the organization in cli parameters)
NOTE: The examples contain an older access token of mine, I have revoked it, after I accidentally committed it.
In the root of the project is a appsettings.json file. This contains example settings, overridding defaults in the project The file should look like the following.
{
"GhAccessToken": "fca86dc1af657b53f42870262113db6224da7b47",
"Organization": "Github"
}
After this, the easiest way to run this is to go
dotnet run
in the project directory (the one with appsettings.json)
If you don't want to put your access token in a file You can instead pass as environment variables
An example of passing these in like this is:
GhAccessToken=fca86dc1af657b53f42870262113db6224da7b47 Organization=Apple dotnet run
The last way to pass in the config is by CLI Arguments
dotnet run --GhAccessToken fca86dc1af657b53f42870262113db6224da7b47 --Organization IBM
If you want to query multiple organizations, but don't want to pass your token over the CLI or in Environment Variables, you could do something like, storing your access token in the appsettings.json
appsettings.json:
{
"GhAccessToken": "fca86dc1af657b53f42870262113db6224da7b47"
}
Then running the following commands:
dotnet run --Organization Github
dotnet run --Organization Apple
dotnet run --Organization IBM
Using DependencyInjection, you are able to swap between the 3 stages of the TechnicalTest
In Startup.cs
you will see the following lines:
// setupMvp(services);
// setupPolling(services);
setupPollingAndFileDB(services);
If you uncomment setupMvp(services);
and then comment setupPollingAndFileDB(services);
You will then run the application as if it was only completed up until the MVP stage.
Only one of these can be left uncommented, otherwise the DependencyInjection engine, will have issue.