Provides a fair rotation algorithm to decide the next person in the rota. It maintains count of the number of days an individual team member has been picked and uses that to decide the next person with least number of days. It also takes into account not to pick the same person without a gap of at least 2 other picks, irrespective of the number of days the person has accrued.
Makefile has a target setup
which should setup the project.
This project uses ginkgo/gomega for testing and make check
should run the testsuite.
-
GET -
/members
- Lists the details of the current team members in the rota along with the number of days accrued till date and the last date they were picked. -
POST -
/members/:name
- Adds team member into the rota. The last picked date will be initialised to31-12-2006
for no real reason other than a date in the past. It won't change any details if the member already exists in the database -
DELETE -
/members/:name
- Deletes the member from rota -
GET -
/rota/next
- Evaluates and prints the next person in the rota -
GET -
/rota/confirm/:name/:date
- If the person evaluated by/rota/next
is to be confirmed (if not on holiday et al), this endpoint confirms and updates the relevant tables in the database with the details. It's a GET method only to be able to achieve a click and execute functionality. Will print a message saying a person has already been assigned if invoked multiple times on the day. -
GET -
/rota/override/:name
- In order to override the person picked for the day (for whatever reason), this endpoint can be invoked and this will change the database details to the new person and adjusts the details of the person who was previously assigned for the day. Override is always for the current day. -
POST -
/outofoffice/:name/:from/:to
- Records the out of office dates for a person. The from and to should be in the formatDD-MM-YYYY
. The person out of office will be skipped from rota. The to date is one day before the return date. -
GET -
/outofoffice
- Gets the out of office schedule for the team -
GET -
/outofoffice/:name
- Gets the out of office schedule for the specific team member