Web service implemented using .Net. Asp.Net Core was used as a web framework. Neo4j was used as a persistent storage due to access patterns described by task. It's hard to think about better option that graph database for this particular scenario. There are two types of objects used in database:
- Vertex of type
Person
with attributesid
andtopics
- Directed Edge of type
Trust
with attributelevel
# Go into the folder with Solution.sln and run
docker-compose up
Service will be available on port 8080. When docker runs open http://localhost:8080/swagger on your browser to see swagger docs and try api.
Requirements to run tests
# Go into the folder with Solution.sln and run
dotnet test Solution.sln
Solution covered with component tests which spins up Neo4j db in container and Asp.Net Core Web Api in memory.
GraphBuilder
was created to simplify graph creation during on component test which also make it visual event in code. Checkout BroadcastMessageEndpointTests.cs
Example of one of the graphs generated by one of the component tests:
- Rewrite
GetBroadcastReceiversAsync
method ofPeopleRepository
to use Neo4j native implementation of BFS as a result redundant allocation will be avoided and method will be simplified - Fix open api for
/api/people/{personId}/trust_connections
endpoint - Add unit tests