Skip to content

Latest commit

 

History

History
124 lines (92 loc) · 4.07 KB

README.md

File metadata and controls

124 lines (92 loc) · 4.07 KB

To-Do List App (Backend) for MAvha test

Note: Click here to see the app hosted and running

Backend made in Nodejs in order to implement a To-Do list app

Click here to go to Angular Frontend repository

API URL

https://mavha-main-api.herokuapp.com

Task Interface

A task has the following properties:

Param type Description
id String Task id
creator String user id of task creator. Null if task created when user is logged out
title String Task Title
description String Task Description
dueDate Number Due Date
priority Number 1 = Low, 2 = Medium, 3 = High
files Array[TaskFile] Task File info

TaskFile follows the following interface:

Param type Description
name String File name (Ex: test.jpg
url String File url (Ex: https://domain.com/test.jpg
path String File path on Database

Functionalities

  • Add Task: Add a task to the to-do list Method: POST route: /tasks returns: Task id Request Body Params:
Param type Required Default value Description
creator String No Null user id of logged in user
title String No " " Task Title
description String No " " Task Description
dueDate Number No Null Due Date
priority Number No Null 1 = Low, 2 = Medium, 3 = High
files Array[TaskFile] No [] Task File info

TaskFile follows the following interface:

Param type Required Default value Description
name String Yes - File name (Ex: test.jpg
url String Yes - File url (Ex: https://domain.com/test.jpg
path String Yes (can be Null) - File path on Database
  • Edit Task: Edit an already created task Method: PUT route: /tasks/:id returns: Null Request Body Params:
Param type Required Default value Description
title String No " " Task Title
dueDate Number No Null Due Date
priority Number No Null 1 = Low, 2 = Medium, 3 = High
description String No " " Task Description
files Array[TaskFile] No [] Task File info Explained above
  • Delete Task: Delete an already created tasks Method: DELETE route: /tasks/:id returns: Null

  • List Tasks: Lists all the tasks in the app. it also has the following functionalities:

  • Method: GET route: /tasks returns: Array(Task) Request Query Params:

Param type Required Default value Description
limit Number No 10 Total tasks to return
startAfter String No Null Task id of last task returned. This is only used for pagination
creator String No Null User id of tasks to return
priority Number No Null Task priority to return. 1 = Low, 2 = Medium, 3 = High
completed Boolean No Null Task status to return
sortBy String No Null Order of tasks to return. (Ex: priority, dueDate)
direction String Only if sortBy set Null Order direction of tasks to return. (Ex: asc, desc)

Request example: https://mavha-main-api.herokuapp.com/tasks?limit=5&completed=false&sortBy=dueDate&direction=desc

  • Get Task: Get an already created tasks Method: GET route: /tasks/:id returns: Task

  • Update Task Status: Mark tas as completed/incomplete Method: POST route: /tasks/:id/updateTaskStatus returns: Null

Param type Required Default value Description
completed Boolean Yes - Task Status to update

Environment

This project was generated with Nodejs version 12.13.0.

Development server

Run npm install in order to install required dependencies.

Run npm start for a dev server running on http://localhost:8080/. The frontend must be running so the interface can work.

Author

Lesther Caballero