Skip to content

Instantly share code, notes, and snippets.

@MichaelrMentele
Last active February 19, 2022 16:40
Show Gist options
  • Select an option

  • Save MichaelrMentele/8be425bd6eacfe1f9c59d526933277ea to your computer and use it in GitHub Desktop.

Select an option

Save MichaelrMentele/8be425bd6eacfe1f9c59d526933277ea to your computer and use it in GitHub Desktop.

You'll have an hour to work on your own feel free to ask questions or look things up.

The goal is to provide an API to manage tasks.

Requirements

The api should be able to return the following

  • overdue tasks
  • completed tasks
  • incomplete tasks
  • change the dueDate of tasks
  • return tasks grouped by assignee.

We will pretend that we have a database (stored as a local file CSV for simplicity) and that we want to provide a JSON / command line API that let's us do the above.

Bonus points:

  • unit tests
  • this is an actual web API
  • extensions

API Documentation

Please provide an API, queryable on localhost, testcases in your program is also fine, or via commandline (if you want to do this as a script) that supports the following:

GET /tasks?status="overdue"

returns {
    taskAId: {
        name
        assignee
        createdAt
        dueDate
        completed
    },
    taskBId: {
        ...
    }, 
    taskCId: {
        ...
    }
    # etc.
}

GET /tasks?completed={true/false} returns all tasks completed or not completed

POST /tasks/:id?<field>=<new_value> updates the specified task field with the new value

GET /employees/:id/tasks returns all tasks assigned to the employee with overdue property

returns {
    taskAId: {
        ...
        overdue
    }
    ...
}

POST /tasks?id=<int>,dueDate="+1d" increments the dueDate

Tools

You can run this as a webserver if that is easy for you, or as a command line app. Keep this as simple as possible.

Id Name Assignee CreatedAt DueDate Complete
1 First customer outreach Adam 01/01/2021 2/10/2021 False
2 First customer outreach Bob 01/02/2021 2/11/2021 False
3 First customer outreach Chris 01/03/2021 2/12/2021 False
4 First customer outreach Derek 01/04/2021 2/13/2021 False
5 First customer outreach Eve 01/05/2021 2/14/2021 False
6 Post sale followup Fred 01/06/2021 2/15/2021 False
7 Post sale followup Gili 01/07/2021 2/9/2021 True
8 Post sale followup Hilda 01/08/2021 2/17/2021 False
9 Post sale followup Jasper 01/09/2021 2/18/2021 False
10 Post sale followup Kelvin 01/10/2021 2/8/2021 False
11 Schedule appointment Linda 01/11/2021 2/20/2021 True
12 Schedule appointment Meloney 01/12/2021 2/21/2021 False
13 Schedule appointment Nancy 01/13/2021 2/22/2021 False
14 Schedule appointment Oscar 01/14/2021 2/23/2021 False
15 Schedule appointment Prissy 01/15/2021 2/24/2021 False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment