Merge branch 'master' of github.com:kevinmidboe/seasonedShows

This commit is contained in:
2018-01-09 22:51:26 +01:00
10 changed files with 64 additions and 13 deletions

View File

@@ -27,6 +27,11 @@ class Config {
const field = new Field(this.fields[section][option])
if (field.value === '') {
const envField = process.env[[section.toUpperCase(), option.toUpperCase()].join('_')]
if (envField !== undefined && envField.length !== 0) { return envField }
}
if (field.value === undefined) {
throw new Error(`${section} => ${option} is empty.`);
}

View File

@@ -4,7 +4,7 @@ const EnvironmentVariables = require('./environmentVariables.js');
class Field {
constructor(rawValue, environmentVariables) {
this.rawValue, rawValue;
this.rawValue = rawValue;
this.filters = new Filters(rawValue);
this.valueWithoutFilters = this.filters.removeFiltersFromValue();
this.environmentVariables = new EnvironmentVariables(environmentVariables);

View File

@@ -10,7 +10,7 @@ class Filters {
}
isEmpty() {
return !this.hasValidType() || this.filters.length === 0;
return !this.hasValidType() || this.value.length === 0;
}
has(filter) {

View File

@@ -0,0 +1,3 @@
DROP TABLE IF EXISTS user;
DROP TABLE IF EXISTS search_history;
DROP TABLE IF EXISTS requests;

View File

@@ -69,6 +69,15 @@ class SqliteDatabase {
return this.execute(setupSchema);
}
/**
* Tears down the database by running tearDown.sql file in schemas/.
* @returns {Promise}
*/
tearDown() {
const tearDownSchema = this.readSqlFile('tearDown.sql');
return this.execute(tearDownSchema);
}
/**
* Returns the file contents of a SQL file in schemas/.
* @returns {String}