From f50e0b2a5946751aac54ba88c6481d146a70db95 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 3 Oct 2017 16:10:27 +0200 Subject: [PATCH] Added user_agent to be passed to and saved in db when a request is made. --- seasoned_api/src/plex/requestRepository.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seasoned_api/src/plex/requestRepository.js b/seasoned_api/src/plex/requestRepository.js index 45f1a53..111e5ea 100644 --- a/seasoned_api/src/plex/requestRepository.js +++ b/seasoned_api/src/plex/requestRepository.js @@ -20,7 +20,7 @@ class RequestRepository { constructor(database) { this.database = database || establishedDatabase; this.queries = { - 'insertRequest': "INSERT INTO requests VALUES (?, ?, ?, ?, ?, ?, CURRENT_DATE, 'requested')", + 'insertRequest': "INSERT INTO requests VALUES (?, ?, ?, ?, ?, ?, ?, CURRENT_DATE, 'requested')", 'fetchRequstedItems': "SELECT * FROM requests", } } @@ -109,14 +109,14 @@ class RequestRepository { * @param {identifier, type} the id of the media object and type of media must be defined * @returns {Promise} If nothing has gone wrong. */ - sendRequest(identifier, type, ip) { + sendRequest(identifier, type, ip, user_agent) { // TODO add to DB so can have a admin page // TODO try a cache hit on the movie item tmdb.lookup(identifier, type).then(movie => { // Add request to database - this.database.run(this.queries.insertRequest, [movie.id, movie.title, movie.year, movie.poster, 'NULL', ip]) + this.database.run(this.queries.insertRequest, [movie.id, movie.title, movie.year, movie.poster, 'NULL', ip, user_agent]) //