When posting a request, the type is also added to the database.

This commit is contained in:
2017-10-06 15:38:22 +02:00
parent 307a8352a3
commit d9a22f506e

View File

@@ -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",
'updateRequestedById': "UPDATE requests SET status = ? WHERE id is ? AND type is ?",
}
@@ -117,7 +117,7 @@ class RequestRepository {
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, user_agent])
this.database.run(this.queries.insertRequest, [movie.id, movie.title, movie.year, movie.poster, 'NULL', ip, user_agent, movie.type])
//