-
api/v2 upgrade Stable
released this
2019-11-04 17:01:15 +00:00 | 129 commits to master since this releaseMost everything has been refactored or it's structure updated or changed. We have tons of new endpoints and resolved some long-standing issues. Responses and test have also been worked on to be covering more of the codebase.
FROM PR #111 Api/v2
Too much to comment. Everything has been refactored and there might be some bugs or formatting/structure inconsistencies still.
Closing PR even though everything should have been commented and documented, but I want to get on with my life 🌝 Complete refactor will come later.
TMDB
endpoint: Info
- /v2/movie/:id
- /v2/show/:id
- /v2/person/:id
Info for the movie, show & person has been rewritten to each having their own [movie|show|person]Info controller, converter from tmdb and functions that each create class object of class movie, show or person and returns them as json.
endpoint: Search
- /v2/multi?query
- /v2/movie?query
- /v2/show?query
- /v2/person?query
Each search operation has their own endpoint with query params. When searching under multisearch the response is mapped to create movie, show or person class objects.
endpoint: List
- /v2/movie/:listname
- /v2/show/:listname
Listnames available for movies are: now playing, popular, top rated and upcoming; & for shows: now playing, popular and top rated.
class: Types (movie, show & person)
Types movie, show and person added to Types folder in tmdb (src/tmdb/types/)
Plex
endpoint: Plex Search
- /v2/plex/search?query
Searches local plex library defined by plex: ip in conf/development. In the response we are interested in media of type movie, show or episode. If they are found the media responses are converted to class functions of type; movie, show or episode, before returned as json objects.
function: existsInPlex(tmdb)
Based on a tmdb input and searches based on tmdb.title and checks if the response title and type match. If they do a existsInPlex=true object variable is added to the tmdb object.
Request
endpoint: Request
- GET /v2/request : handles query params for sort, filter and query
- POST /v2/request : required body params = {id, type}
Handling of sort, filter and querying has been improved to neatly be handled with modular promise returning functions for (checking if valid) sort, filter and query.
User data transfer handling and JWT
While authenticated before we would return a json object with the
asdf
sdf
asd
now we send the authorization JWT token with body including the tokentoken: JWT_TOKENand conditionally if admin user a booleanadmin: true.User cryptography
()[
8a5ab204e1]
Changed node package for creating a hashed password frombcrypt-nodejs: v0.0.3tobcrypt: v3.0.6.
Altered response message for invalid credentials.
When hashing we use 10 saltRounds ()[salt rounds]Updating request status by searching for existence in plex
Testing and documentation
Added documentation package and yarn commands script commands for generating documentation. [
6f9ca9e067]- Upgrade mocha
Tests
Cleaned up formatting and better about how and when we cache or create requests.
Example config file
- Example config create to be copied to development.config and filled out. 4019d63
Downloads