From fbf49e4cd95e06acfef63b667b221e35a305e4c5 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 29 Jul 2017 13:21:25 +0200 Subject: [PATCH] Updated to use sqlite3 instead of sqlite in api --- client/app/components/MovieObject.jsx | 37 +++++++++++++------------ client/app/components/SearchRequest.jsx | 8 +++--- conf/development.json | 11 -------- package.json | 4 +-- src/database/sqliteDatabase.js | 6 ++-- 5 files changed, 28 insertions(+), 38 deletions(-) delete mode 100644 conf/development.json diff --git a/client/app/components/MovieObject.jsx b/client/app/components/MovieObject.jsx index b3e48af..e12f725 100644 --- a/client/app/components/MovieObject.jsx +++ b/client/app/components/MovieObject.jsx @@ -1,5 +1,7 @@ import React from 'react'; +import '../app.css'; + class MovieObject { constructor(object) { this.id = object.id; @@ -12,36 +14,35 @@ class MovieObject { } requestExisting(movie) { - console.log('Exists', movie) + console.log('Exists', movie); } requestMovie(id) { fetch('http://localhost:31459/api/v1/plex/request/' + id, { method: 'POST' - }) + }); } getElement() { - var returnList = [] - - returnList.push(

{this.title} ({this.year})

) - - var posterPath, buttonState; - if (this.poster != undefined) { - posterPath = 'https://image.tmdb.org/t/p/w150' + this.poster; - } - returnList.push(); - + var posterPath = 'https://image.tmdb.org/t/p/w154' + this.poster; + var buttonState; if (this.matchedInPlex) { - returnList.push() + buttonState = ; } else { - returnList.push() + buttonState = ; } - returnList.push({this.overview}); - - returnList.push(

); - return returnList; + return ( +
+ +
+ {this.title} ({this.year}) +

+ {buttonState} +

+ {this.overview} +
+
) } } diff --git a/client/app/components/SearchRequest.jsx b/client/app/components/SearchRequest.jsx index 1e30183..3200ee9 100644 --- a/client/app/components/SearchRequest.jsx +++ b/client/app/components/SearchRequest.jsx @@ -83,7 +83,7 @@ class SearchRequest extends React.Component { render(){ return( -
+
this._handleQueryKeyPress(event)} @@ -94,9 +94,9 @@ class SearchRequest extends React.Component {



- - {this.state.responseMovieList} - +
+ {this.state.responseMovieList} +
) } diff --git a/conf/development.json b/conf/development.json deleted file mode 100644 index 8b7cf6f..0000000 --- a/conf/development.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "database": { - "host": "shows.db" - }, - "webserver": { - "port": 31459 - }, - "tmdb": { - "apiKey": "9fa154f5355c37a1b9b57ac06e7d6712" - } -} \ No newline at end of file diff --git a/package.json b/package.json index 6d7198c..85ee1e8 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,13 @@ "body-parser": "~1.0.1", "cross-env": "^3.1.3", "express": "~4.0.0", - "mongoose": "~3.6.13", + "mongoose": "^3.6.13", "moviedb": "^0.2.7", "node-cache": "^4.1.1", "nodemailer": "^4.0.1", "python-shell": "^0.4.0", "request": "^2.81.0", "request-promise": "^4.2", - "sqlite": "^2.5.0" + "sqlite3": "^2.5.0" } } diff --git a/src/database/sqliteDatabase.js b/src/database/sqliteDatabase.js index ff03f1b..0da7b07 100644 --- a/src/database/sqliteDatabase.js +++ b/src/database/sqliteDatabase.js @@ -1,19 +1,19 @@ const fs = require('fs'); const path = require('path'); -const sqlite = require('sqlite'); +const sqlite3 = require('sqlite3'); class SqliteDatabase { constructor(host) { this.host = host; - this.connection = sqlite; + this.connection = sqlite3; // this.schemaDirectory = path.join(__dirname, 'schemas'); } connect() { return Promise.resolve() - .then(() => sqlite.open(this.host)) + .then(() => new sqlite3.Database(this.host)) } all(sql, parameters) {