Giter VIP home page Giter VIP logo

tasks-scheduler-reactjs's Introduction

BigLab 2 - Class: 2021 WA1

Team name: Uzitaro

Team members:

  • Onica Alexandru Valentin
  • Rametta Francesco
  • Riggio Marco
  • Alimov Islom

Instructions

A general description of the BigLab 2 is avaible in the course-materials repository, under _ labs_. In the same repository, you can find the instructions for GitHub Classroom , covering this and the next BigLab.

Once cloned this repository, instead, write your names in the above section.

When committing on this repository, please, do NOT commit the node_modules directory, so that it is not pushed to GitHub. This should be already automatically excluded from the .gitignore file, but double-check.

When another member of the team pulls the updated project from the repository, remember to run npm install in the project directory to recreate all the Node.js dependencies locally, in the node_modules folder.

Finally, remember to add the final tag for the final submission, otherwise it will not be graded.

List of APIs offered by the server

Login

POST /api/sessions/

Authanticate in the application providing email and password for credentials

JSON Body
Field Type Description
username string The email of a registered account
password string The password of the account
Example request
// requesting /api/sessions
{
  'method':'POST',
  'headers': {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'username': '[email protected]'
    'password': 'password'
  })
}
Example response
{
    "id":1,
    "email":"[email protected]",
    "name":"John"
}
Example error
{
    "message":"Incorrect email/password combination."
}

Retrieve current session user

GET /api/sessions/current

Check whether the current session has an user logged in or not.

Example request
// requesting /api/sessions
{
  'method':'GET'
}
Example response
{
    "id":1,
    "email":"[email protected]",
    "name":"John"
}
Example error
{
    "error":"Unauthenticated user!"
}

Logout

DELETE /api/sessions/

Logout from the application

Example request
// requesting /api/sessions
{
  'method':'DELETE'
}

Insert Task

POST /api/inserttask

Insert a new task in the application and receive the db assigned id.

JSON Body
Field Type Description
description string The description of the task
important boolean Whether the task has to be marked as important
private boolean Whether the task has to be marked as private
deadline string | null The date when the task is due. It is displayed in the format YYYY-MM-DD HH:MM, or not in case no deadline is set. Transmitted in ISO format if exists or null otherwise.
completed boolean Wheter the task has been completed, always false
Example request
// requesting /api/inserttask
{
  'method':'POST',
  'headers': {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'description': 'A very important task',
    'important': true,
    'private': false,
    'deadline': '2021-06-10 17:33'
  })
}
Example response
    42
Example error
{
    "errors": [
        {
            "value":"",
            "msg":"The description must not be EMPTY!",
            "param":"description",
            "location":"body"
        }
    ]
}

Get Tasks

GET /api/tasks/{filter}/{id?}

Retrieve a list of filtered tasks from application or a specific one.

Parameters
Parameter Description
filter a filter to apply before retrieving tasks. It can be 'all','important','today','next7days','private','getid'
id? The id of the task in case the filter is getid
Example request
// requesting /api/next7days
{
  'method':'GET
}
Example response
[
    {
        "id":8,
        "description":"Prepare the slides for the exam",
        "important":1,
        "private":0,
        "deadline":"2021-06-09 00:00",
        "completed":1,
        "user":1
    },
]

Update Task

PUT /api/updatetask

Update an existing task in the application,

JSON Body
Field Type Description
id int The id of the edited task
description string The description of the task
important boolean Whether the task has to be marked as important
private boolean Whether the task has to be marked as private
deadline string | null The date when the task is due. It is displayed in the format YYYY-MM-DD HH:MM, or not in case no deadline is set. Transmitted in ISO format if exists or null otherwise.
completed boolean Wheter the task has been completed
user int The id of the user, unnecessary, the authenticated one will be used for check
Example request
// requesting /api/updatetask
{
  'method':'POST',
  'headers': {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'id': 42,
    'description': 'A very very very important and private task',
    'important': true,
    'private': true,
    'completed' : true,
    'deadline': '2021-06-10 17:33',
    'user': 1
  })
}

Complete Task

PATCH /api/completetask/{id}

Mark an existing task in the application as completed or vice versa. This relies completely on the server answer.
Ex. If the user is logged in twice, if he marks as completed a task on one front end, and the same on the other, while both showing as unmarked, the result on the database will be unmarked, as on the later updated front end.

Parameters
Parameter Description
id The id of the task to (un)check as completed
// requesting /api/completetask/42
{
  'method':'PATCH'
}
    0 | 1

Delete Task

DELETE /api/removetask/{id}

Remove an existing task from the application

Parameters
Parameter Description
id The id of the task to delete
// requesting /api/removetask/42
{
  'method':'DELETE'
}
Example error
    42

tasks-scheduler-reactjs's People

Contributors

im-not-alex avatar

Watchers

James Cloos avatar  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.