almost functional user login (mail still missing)

This commit is contained in:
2023-07-16 11:45:48 +02:00
parent a8cf4ec9a4
commit afdaf13048
11 changed files with 225 additions and 14 deletions

View File

@@ -19,9 +19,11 @@ let dbh;
if ( settings.db === 'mysql' ) {
const dbsoft = require( './mysqldb.js' );
dbh = new dbsoft();
dbh.connect();
} else {
const dbsoft = require( './jsondb.js' );
const dbsoft = require( './nedbDB.js' );
dbh = new dbsoft();
dbh.connect();
}
module.exports.getDataSimple = function getData ( db, column, searchQuery ) {

View File

View File

@@ -0,0 +1,20 @@
/*
* libreevent - jsonDataHelper.js
*
* Created by Janis Hutz 07/16/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
// IMPORTANT: Do not use this helper in any other context than in the jsondb.js file!
// It is specifically designed for that thing and therefore doesn't use any unnecessary resources!
class DataHelper {
constructor () {
}
}
module.exports = DataHelper;

View File

@@ -15,21 +15,22 @@ const path = require( 'path' );
// to the whitelist of the database
class SQLDB {
constructor () {
constructor ( ) {
this.sqlConnection = mysql.createConnection( JSON.parse( fs.readFileSync( path.join( __dirname + '/../../config/db.config.secret.json' ) ) ) );
}
connect () {
connect ( ) {
this.sqlConnection.connect( function( err ) {
if ( err ) {
console.error( 'error connecting: ' + err.stack );
return;
}
console.log( 'connected' );
return 'connection';
} );
}
disconnect () {
disconnect ( ) {
this.sqlConnection.end();
}
@@ -144,7 +145,6 @@ class SQLDB {
}
this.sqlConnection.query( command, ( error, results ) => {
if ( error ) reject( error );
console.log( results );
resolve( results );
} );
} );

View File