Giter Site home page Giter Site logo

likert-api's Introduction

MoodIO

MoodIO is a (set of) application(s) to get an insight in the mental and possibly phisical state of people. Primarily aimed at children to assist their doctor in evaluating their well being.

Installation

TODO

Environment

The application knows three environments, testing, development and production. Depending on the environment, some aspects may behave differently. You can set the environment by setting the NODE_ENV variable in the shell starting the application.

In addition, the database configuration can be created using environment variables as well. For this, you can use DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_HOST and DB_DIALECT. Keep in mind that the config generation only runs if the config/database.json does not exist yet.

Usage

Auth

Request Body Type
username String
password String
Request Body Type
Request Body Type
Request Body Type
username String
password String

Genres

GET /

Request Body Type

POST /

Request Body Type
genreName String

DELETE /

Request Body Type
genreName String
Request Body Type
genreName String

DELETE /dislike

Request Body Type
genreName String

POST /like

Request Body Type
genreName String

DELETE /like

Request Body Type
genreName String

Moods

GET /

Request Body Type

POST /

Request Body Type
mood String

PUT /

Request Body Type
newMood String

DELETE /

Request Body Type
mood String
Request Body Type

GET /my

Request the current user's current mood.

Request Body Type

POST /my

Changes the mood and puts the mood into history

Request Body Type
moodId Integer

First ten moods in history

Request Body Type

The x amount

Request Body Type

Users

GET /

Request Body Type

PUT /

Request Body Type
username String
password String
Request Body Type
Request Body Type
username String
password String

Likerts

GET /:id

Request Body Type
Request Body Type
Request Body Type

POST /

Request Body Type
name String
description String
scaleItems String (Comma Seperated Values)

POST /:id

Request Body Type
songId INT
moodId INT
scaleScore String

PUT /

Request Body Type
updateItems Array (id, name, description, scaleItems)

PATCH /

Request Body Type
removeItems Array (id)

Songs

Returns the previously listened to song of the current user.

Request Body Type

Returns a list of the previously listened to songs of the current user. The size of the list is dependant on :count.

Request Body Type

Contributing

Code style

  • Indent using tabs.
    • Alignment using spaces, if you want alignment at all.

License

TODO

likert-api's People

Contributors

blackchaosnl avatar ramkov avatar tyil avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

likert-api's Issues

Unable to create a mood

Description

POST Request to /moods returns with the message "The endpoint you requested was not found"

Situation

Header

Authorization - Bearer { token }

Body

genreName - { genreName }

/genres/like gives authentication error

Description

Whenever I try to like a genre I get a "Not logged in." message.

Situation

Header

Authentication - Bearer { token }

Body

genreName - { genreName }

[GET] moods/my - This mood does not exist

Description

When I do a get request to get my recent mood I get a response satying "This mood does not exist."

Cause

There is already an API endpoint for this specifc route (moods/:moodName).

Proposed Solution

It seems more logical if you use users/me/moods/current because it's user related.

Duplicate Usernames

Situation

Registering with a username that is already in the database results in duplicates.

Requested Fix

Implement a check to check if the username already exists in the database.

Unable to create a genre

Description

POST Request to /genres returns with the message "The endpoint you requested was not found"

Situation

Header

Authorization - Bearer { token }

Body

genreName - { genreName }

Register request

Behaviour:

When POSTing to /auth/register, it gives an object back with OK.

New feature:

POSTing a registration should yield an active authentication token in the response.

No parameter for sending the actual response of a user

For /likert/:id there is no parameter available to send the user response to the likert scale.

add_response(req.params.id, req.body.userId, req.body.songId, req.body.moodId).then(result => {
  return res.json(result);
});

Should be an available parameter for the value that the user has selected on the likert scale.
For example an index of the max_value attribute.

User id should be a user token.
req.body.userId should be changed to req.body.userToken

auth/logout => Internal Server Error ๐Ÿ˜ญ

When trying to log out a user, the API gives an internal server error.

Request

Method: POST
URL: http://mood-io.herokuapp.com/auth/logout
Headers: Authentication : Bearer <token>

Response

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Error</title>
    </head>
    <body>
        <pre>Internal Server Error</pre>
    </body>
</html>

Unable to delete a genre

Description

DELETE Request to /genres returns with the message "The endpoint you requested was not found"

Situation

Header

Authorization - Bearer { token }

Body

genreName - { genreName }

Unable to delete a mood

Description

DELETE Request to /moods returns with the message "The endpoint you requested was not found"

Situation

Header

Authorization - Bearer { token }

Body

genreName - { genreName }

Unable to refresh token

Description

Trying to refresh a token, but I receive the error "You must be authenticated." while I am authenticated.

Situation 1

Headers

Authorization - Bearer { token }

Body

Nothing.

Situation 2

Headers

Authorization - Bearer { token }

Body

token - { token }

POST moods/my - Application Error

Description

POSTing to moods/my with a body of moodId: 1 results in an application error.
Cannot read property &#39;then&#39; of undefined

/auth/logout request type

Description

I noticed that /auth/logout is a POST request.
As the login token is provided in the Authorization header, which will be invalidated upon logout, I see no good reason to use a POST request for this route.

Could you elaborate on this decision?

Task of adding a Likert template sends error

When trying to create a new Likert template the API sends the following response:

{
  "ok": false,
  "message": "I have encountered the following error: SequelizeDatabaseError: ER_NO_DEFAULT_FOR_FIELD: Field 'templateId' doesn't have a default value"
}

The Likert template is successfully added to the database. But the Likert steps aren't added to the database at all.

Request body on /likerts:

{
  "name":"MoodMusic track rating",
  "description":"A likert-scale to let the user rate the track he is currently listening to",
  "max_value":"5",
  "scaleItems":"['Worsened', 'Irritating', 'Neutral', 'Slightly better', 'Improved']"
}

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.