Api/v2 #111

Merged
KevinMidboe merged 88 commits from api/v2 into master 2019-11-04 17:01:16 +00:00
KevinMidboe commented 2018-10-30 20:02:17 +00:00 (Migrated from github.com)

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.

  • /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

  • /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 token token: JWT_TOKEN and conditionally if admin user a boolean admin: true.

User cryptography

()[8a5ab204e1]
Changed node package for creating a hashed password from bcrypt-nodejs: v0.0.3 to bcrypt: 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
## 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 token `token: JWT_TOKEN` and conditionally if admin user a boolean `admin: true`. ### User cryptography ()[8a5ab204e1ea1e7abdcd74c9a75a503c79134d6d] Changed node package for creating a hashed password from `bcrypt-nodejs: v0.0.3` to `bcrypt: 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 - af7b1f2424eb5063196435f55ab8fca472219f13 ## Testing and documentation Added documentation package and yarn commands script commands for generating documentation. [6f9ca9e0673ef1ade8dc5464336b1721c3fd7908] - 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](https://github.com/KevinMidboe/seasonedShows/commit/4019d63f3b78dbf6c60d5ce78a7005050e88f3fb)
coveralls commented 2018-10-31 23:27:36 +00:00 (Migrated from github.com)

Pull Request Test Coverage Report for Build 387

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 148 unchanged lines in 11 files lost coverage.
  • Overall coverage decreased (-14.5%) to 43.957%

Files with Coverage Reduction New Missed Lines %
src/user/token.js 2 84.0%
src/user/userRepository.js 2 88.0%
src/media_classes/media.js 3 16.67%
src/webserver/controllers/plex/plexPlaying.js 3 57.14%
src/webserver/app.js 4 92.96%
src/webserver/controllers/plex/searchMedia.js 5 28.57%
src/pirate/pirateRepository.js 6 12.5%
src/plex/requestRepository.js 7 23.73%
src/webserver/controllers/plex/submitRequest.js 20 25.0%
src/plex/plexRepository.js 23 9.43%
Totals Coverage Status
Change from base Build 357: -14.5%
Covered Lines: 665
Relevant Lines: 1434

💛 - Coveralls
## Pull Request Test Coverage Report for [Build 387](https://coveralls.io/builds/26750485) * **0** of **0** changed or added relevant lines in **0** files are covered. * **148** unchanged lines in **11** files lost coverage. * Overall coverage decreased (**-14.5%**) to **43.957%** --- | Files with Coverage Reduction | New Missed Lines | % | | :-----|--------------|--: | | [src/user/token.js](https://coveralls.io/builds/26750485/source?filename=src%2Fuser%2Ftoken.js#L21) | 2 | 84.0% | | [src/user/userRepository.js](https://coveralls.io/builds/26750485/source?filename=src%2Fuser%2FuserRepository.js#L29) | 2 | 88.0% | | [src/media_classes/media.js](https://coveralls.io/builds/26750485/source?filename=src%2Fmedia_classes%2Fmedia.js#L4) | 3 | 16.67% | | [src/webserver/controllers/plex/plexPlaying.js](https://coveralls.io/builds/26750485/source?filename=src%2Fwebserver%2Fcontrollers%2Fplex%2FplexPlaying.js#L7) | 3 | 57.14% | | [src/webserver/app.js](https://coveralls.io/builds/26750485/source?filename=src%2Fwebserver%2Fapp.js#L33) | 4 | 92.96% | | [src/webserver/controllers/plex/searchMedia.js](https://coveralls.io/builds/26750485/source?filename=src%2Fwebserver%2Fcontrollers%2Fplex%2FsearchMedia.js#L14) | 5 | 28.57% | | [src/pirate/pirateRepository.js](https://coveralls.io/builds/26750485/source?filename=src%2Fpirate%2FpirateRepository.js#L54) | 6 | 12.5% | | [src/plex/requestRepository.js](https://coveralls.io/builds/26750485/source?filename=src%2Fplex%2FrequestRepository.js#L61) | 7 | 23.73% | | [src/webserver/controllers/plex/submitRequest.js](https://coveralls.io/builds/26750485/source?filename=src%2Fwebserver%2Fcontrollers%2Fplex%2FsubmitRequest.js#L11) | 20 | 25.0% | | [src/plex/plexRepository.js](https://coveralls.io/builds/26750485/source?filename=src%2Fplex%2FplexRepository.js#L15) | 23 | 9.43% | <!-- | **Total:** | **148** | | --> | Totals | [![Coverage Status](https://coveralls.io/builds/26750485/badge)](https://coveralls.io/builds/26750485) | | :-- | --: | | Change from base [Build 357](https://coveralls.io/builds/24826706): | -14.5% | | Covered Lines: | 665 | | Relevant Lines: | 1434 | --- ##### 💛 - [Coveralls](https://coveralls.io)
KevinMidboe commented 2019-11-04 17:02:12 +00:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KevinMidboe/seasonedShows#111
No description provided.