In this challenge, you are part of a team building a git event tracking platform. One requirement is for a REST API service to provide events information using the Nodejs Express framework. You will need to add functionality to add and delete information as well as to perform some queries. You'll be dealing with typical information for git event data like repository, actor, event type, etc. The team has come up with a set of requirements including filtering and ordering requirements, response codes and error messages for the queries you must implement.
The definitions and a detail list follow. You will be graded on whether your application performs data retrieval and manipulation based on given use cases exactly as described in the requirements.
Each event data is a JSON entry with the following keys:
id
: This is the event unique ID.
type
: This is the event type.
actor
: The actor responsible for the event. The actor itself is a JSON entry consisting of the following fields
id
: This is the actor unique ID.
login
: This is the actor unique login ID.
avatar_url
: This is the actor avatar URL.
repo
: The repository to which the event is associated. The repo itself is a JSON entry consisting of the following fields:
id
: This is the repo unique ID.
name
: This is the repo name.
url
: This is the repo URL.
created_at
: This is the timestamp for the event creation given in the format yyyy-MM-dd HH:mm:ss
. The timezone is UTC +0
.
The REST service should implement the following functionalities:
/erase
. The HTTP response code should be 200./events
. The event JSON is sent in the request body. If an event with the same id already exists then the HTTP response code should be 400, otherwise, the response code shoule be 201./events
. The HTTP response code should be 200. The JSON array should be sorted in ascending order by event ID./events/actors/{actorID}
. If the requested actor does not exist then HTTP response code should be 404, otherwise, the response code should be 200.The JSON array should be sorted in ascending order by event ID./actors
. The actor JSON is sent in the request body. If the actor with the ID does not exist then the response code should be 404, or if there are other fields being updated for the actor then the HTTP response code should be 400, otherwise, the response code should be 200./actors
. If there are more than one actors with the same number of events, then order them by the timestamp of the latest event in the descending order. If more than one actors have the same timestamp for the latest event, then order them by the alphabetical order of login. The HTTP response code should be 200./actors/streak
. If there are more than one actors with the maximum streak, then order them by the timestamp of the latest event in descending order. If more than one actors have the same timestamp for the latest event, then order them by the alphabetical order of login. The HTTP response code should be 200.You should complete the given incomplete project so that it passes all the test cases when running the provided unit tests. The project by default supports the use of SQLite3 database.