/moodiverse-legacy-back

Former back-end application for moodiverse project.

Primary LanguagePythonMIT LicenseMIT

Table of contents

API documentation

User/Register

Register a new user account.

Method: POST

Endpoint: user/register

Request Body:

{
    "username": "string",
    "email": "user@example.com",
    "birthdate": "20.12.2000",
    "password": "string",
}

Response: None


User/Login

Authenticate a user and return a token.

Method: POST

Endpoint: user/login

Request Body:

{
    "username": "string",
    "password": "string"
}

Response:

{
    "token": "string"
}

User/Get user personal data

Method: GET

Endpoint: user/getPersonalData

Request header:

{
  "token": "string"
}

Request Body: None

Response:

{
  "Username": "string",
  "FirstName": "string",
  "LastName": "string",
  "Birthdate": "20.12.2000",
  "Sex": "string"
}

User/Update user personal data

Method: PUT

Endpoint: user/updateUserPersonalDataRequest

Request header:

{
  "token": "string"
}

Request Body:

{
  "newUsername": "string",
  "newFirstName": "string",
  "newLastName": "string",
  "newBirthdate": "20.12.2000",
  "newSex": "string"
}

Response: None


User/Update user password

Method: PUT

Endpoint: user/updateUserPasswordRequest

Request header:

{
  "token": "string"
}

Request Body:

{
  "oldPassword": "string",
  "newPassword": "string",
}

Response: None


User/Update user email

Method: PUT

Endpoint: user/updateUserEmailRequest

Request header:

{
  "token": "string"
}

Request Body:

{
  "newEmail": "string",
}

Response: None


User deletion

Method: DELETE

Endpoint: /settings

Request header:

{
  "token": "string"
}

Request Body:

{
  "password": "string",
}

Response: None

Avatars/Get Avatar

Get user's avatar and username.

Method: GET

Endpoint: user/header

Request Header:

{
    "token": "string"
}

Response:

{
  avatar: "https://i.imgur.com/dWtx5mc.jpeg"
  username: "some Tom"
}

Avatars/Get random Avatar and save

Get user's avatar.

Method: GET

Endpoint: /avatar

Request Header:

{
    "token": "string"
}

Response:

{
  avatar: "https://i.imgur.com/dWtx5mc.jpeg"
}

Moods/GetMoods

Get available moods.

Method: GET

Endpoint: /moods

Response:

{
    "moods": [
        {
            "mood_id": "1",
            "image": "https://i.imgur.com/aidyse5.png"
        },
        {
            "mood_id": "2",
            "image": "https://i.imgur.com/whXdVTH.png"
        },
        ...
    ]
}

Records/Get a record

Get a mood record.

Method: GET

Endpoint: /record

Request Header:

{
    "token": "string"
}

Request Body:

{
    "date": "20.09.2023",
}

Response:

{
    "emoji": "https://i.imgur.com/1.jpeg",
    "text": "string".
    "date": "12.16.2023"
}

Records/Create a record

Add a new mood record.

Method: POST

Endpoint: /record

Request Header:

{
    "token": "string"
}

Request Body:

{
    "mood_id": "int",
    "text": "string",
    "date": "29.04.2023"
}

Response: None


Records/Update a record

Update an existing mood record.

Method: PUT

Endpoint: /record

Request Header:

{
    "token": "string"
}

Request Body:

{
    "newMood_id": "int",
    "newText": "string",
    "date": "21.01.2023"
}

Response: None


Records/Round statistics

Method: GET

Endpoint: /statistics/round

Request header:

{
  "token": "string"
}

Request body:

{
  "month": "4",
  "year": "2023"
}

Response:

{
  "statistics": [
    {
      "Image": "https://i.imgur.com/1.jpeg",
      "count": "12"
    },
    {
      "Image": "https://i.imgur.com/2.jpeg",
      "count": "2"
    },
    {
      "Image": "https://i.imgur.com/3.jpeg",
      "count": "3"
    },
    {
      "Image": "https://i.imgur.com/4.jpeg",
      "count": "10"
    },
    {
      "Image": "https://i.imgur.com/5.jpeg",
      "count": "4"
    }
  ]
}

Records/Tabular statistics

Method: GET

Endpoint: /statistics/table

Request header:

{
  "token": "string"
}

Request body:

{
  "month": "4",
  "year": "2023"
} 

Response:

{
 "statistics": [    
         {
           "date": "01.04.2023",
           "points": "1"
         },
         {
           "date": "02.04.2023",
           "points": "5"
         },         
      ],
}

Records/Data all records

Method: DELETE

Endpoint: records/delete

Request header:

{
  "token": "string"
}

Request Body:

{
  "password": "string",
}

Response: None