diff --git a/src/data/data-sources/sqlite/sqlite-instrument_model-data-source.ts b/src/data/data-sources/sqlite/sqlite-instrument_model-data-source.ts index 4b76e54..452cf88 100644 --- a/src/data/data-sources/sqlite/sqlite-instrument_model-data-source.ts +++ b/src/data/data-sources/sqlite/sqlite-instrument_model-data-source.ts @@ -37,7 +37,7 @@ export class SQLiteInstrumentModelDataSource implements InstrumentModelDataSourc async create(instrument_model: InstrumentModelRequestCreationModel): Promise { const params = [instrument_model.instrument_model_name, instrument_model.bodc_url]; const placeholders = params.map(() => '(?)').join(','); // TODO create tool funct - const sql = `INSERT INTO instrument_model (instrument_model, bodc_url) VALUES (` + placeholders + `);`; + const sql = `INSERT INTO instrument_model (instrument_model_name, bodc_url) VALUES (` + placeholders + `);`; return await new Promise((resolve, reject) => { this.db.run(sql, params, function (err) { @@ -79,7 +79,7 @@ export class SQLiteInstrumentModelDataSource implements InstrumentModelDataSourc filtering_sql += filter.field + ` = 0`; } // If value is undefined, null or empty, and operator =, set to is null - else if (filter.value == undefined || filter.value == null || filter.value == "") { + else if (filter.value == "null") { if (filter.operator == "=") { filtering_sql += filter.field + ` IS NULL`; } else if (filter.operator == "!=") { diff --git a/src/data/data-sources/sqlite/sqlite-privilege-data-source.ts b/src/data/data-sources/sqlite/sqlite-privilege-data-source.ts index fb499cf..4988c69 100644 --- a/src/data/data-sources/sqlite/sqlite-privilege-data-source.ts +++ b/src/data/data-sources/sqlite/sqlite-privilege-data-source.ts @@ -130,7 +130,7 @@ export class SQLitePrivilegeDataSource implements PrivilegeDataSource { filtering_sql += "privilege." + filter.field + ` = 0`; } // If value is undefined, null or empty, and operator =, set to is null - else if (filter.value == undefined || filter.value == null || filter.value == "") { + else if (filter.value == "null") { if (filter.operator == "=") { filtering_sql += "privilege." + filter.field + ` IS NULL`; } else if (filter.operator == "!=") { @@ -216,7 +216,7 @@ export class SQLitePrivilegeDataSource implements PrivilegeDataSource { // remove last AND placeholders = placeholders.slice(0, -4); // form final sql - const sql = `SELECT privilege.*, user.first_name, user.last_name, user.email, FROM privilege LEFT JOIN user ON privilege.user_id = user.user_id WHERE ` + placeholders + `LIMIT 1;`; + const sql = `SELECT privilege.*, user.first_name, user.last_name, user.email FROM privilege LEFT JOIN user ON privilege.user_id = user.user_id WHERE ` + placeholders + `LIMIT 1;`; return await new Promise((resolve, reject) => { this.db.get(sql, params, (err, row) => { if (err) { diff --git a/src/data/data-sources/sqlite/sqlite-project-data-source.ts b/src/data/data-sources/sqlite/sqlite-project-data-source.ts index e62dcfb..326cfe3 100644 --- a/src/data/data-sources/sqlite/sqlite-project-data-source.ts +++ b/src/data/data-sources/sqlite/sqlite-project-data-source.ts @@ -166,7 +166,7 @@ export class SQLiteProjectDataSource implements ProjectDataSource { filtering_sql += filter.field + ` = 0`; } // If value is undefined, null or empty, and operator =, set to is null - else if (filter.value == undefined || filter.value == null || filter.value == "") { + else if (filter.value == "null") { if (filter.operator == "=") { filtering_sql += filter.field + ` IS NULL`; } else if (filter.operator == "!=") { diff --git a/src/data/data-sources/sqlite/sqlite-user-data-source.ts b/src/data/data-sources/sqlite/sqlite-user-data-source.ts index a38354a..14fe5c5 100644 --- a/src/data/data-sources/sqlite/sqlite-user-data-source.ts +++ b/src/data/data-sources/sqlite/sqlite-user-data-source.ts @@ -82,7 +82,7 @@ export class SQLiteUserDataSource implements UserDataSource { filtering_sql += filter.field + ` = 0`; } // If value is undefined, null or empty, and operator =, set to is null - else if (filter.value == undefined || filter.value == null || filter.value == "") { + else if (filter.value == "null") { if (filter.operator == "=") { filtering_sql += filter.field + ` IS NULL`; } else if (filter.operator == "!=") {