Giter Site home page Giter Site logo

dataminr_task's Introduction

serverless API Task management

We need to develop a feature for users to create tasks and task lists. Tasks can then be added to different task lists.

  1. Design a db schema for the relevant entities.
  2. Develop a Rest API with CRUD endpoints for tasks and task lists as well as endpoints to add/remove a task to/from a task list.


Requirements:

  • Use Postgres or MySQL.
  • For simplicity, a file with DDL scripts is enough to create the db schema.
  • Tasks and task lists must have at least “title” and “updatedAt” columns.
  • The same task can be added to multiple task lists.
  • Implement the app with TypeScript.
  • Write tests for at least 2 endpoints using Jest or Mocha.
  • Add instructions to run the application.
  • Docker config to start up DB.
  • Preferably do not use any ORM framework.
  • API implemented as Lambda functions using Serverless framework.

Project setup


  • Run yarn and install all the necessary dependencies.

  • open package.json and update migrate:up command with USERNAME, PASSWORD and DB_NAME values with your local postgres credentials.

"migrate:up": "DATABASE_URL=postgres://[UsErNaMe]:[PaSsWoRd]@localhost:5432/[Db_NaMe] node-pg-migrate up"
  • Run yarn migrate:up to create the db schema.

  • rename example.env to .env and update the values with your local postgres credentials.

  • Run yarn dev to start the offline server.



Task API


create a task:

POST http://localhost:8080/tasks
{
  "title": "task title",
  "description": "task description"
}

get all tasks:

GET http://localhost:8080/tasks

update a task:

PUT http://localhost:8080/tasks
{
  "id": "taskId",
  "title": "task title",
  "description": "task description"
}

delete a task:

DELETE http://localhost:8080/tasks
{
  "id": "taskId"
}

add a task to a list:

POST http://localhost:8080/tasks/add-task-to-list
{
  "taskId": "taskId",
  "listId": "taskListId"
}

remove a task from a list:

POST http://localhost:8080/tasks/remove-task-from-list
{
  "taskId": "taskId",
  "listId": "taskListId"
}

Task List API


create a list:

POST http://localhost:8080/lists
{
  "title": "list title",
}

get all lists:

GET http://localhost:8080/lists

update a list:

PUT http://localhost:8080/lists
{
  "id": "listId",
  "title": "task title",
}

delete a task:

DELETE http://localhost:8080/tasks
{
  "id": "listId"
}

dataminr_task's People

Contributors

miladr0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.