From d0b215f022dd0c470e6d82106131d3a57cc4789b Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Wed, 26 Jul 2023 08:18:20 +0200 Subject: [PATCH] add another db table (sql dbs) --- src/server/app.js | 2 +- src/server/backend/db/mysqldb.js | 10 ++++++++-- src/webapp/main/src/views/purchasing/PurchaseView.vue | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/server/app.js b/src/server/app.js index 96a73a1..8707696 100644 --- a/src/server/app.js +++ b/src/server/app.js @@ -89,7 +89,7 @@ if ( settings.init ) { } console.log( '[ Server ] loading plugins' ); -pluginManager.load( app, settings ); +// pluginManager.load( app, settings ); app.use( ( request, response ) => { response.sendFile( file ); diff --git a/src/server/backend/db/mysqldb.js b/src/server/backend/db/mysqldb.js index 3535f30..44a1d7d 100644 --- a/src/server/backend/db/mysqldb.js +++ b/src/server/backend/db/mysqldb.js @@ -41,7 +41,10 @@ class SQLDB { if ( error ) if ( error.code !== 'ER_BAD_TABLE_ERROR' ) throw error; this.sqlConnection.query( 'DROP TABLE libreevent_admin;', ( error ) => { if ( error ) if ( error.code !== 'ER_BAD_TABLE_ERROR' ) throw error; - return 'done'; + this.sqlConnection.query( 'DROP TABLE libreevent_temp;', ( error ) => { + if ( error ) if ( error.code !== 'ER_BAD_TABLE_ERROR' ) throw error; + return 'done'; + } ); } ); } ); } ); @@ -54,10 +57,13 @@ class SQLDB { } ); this.sqlConnection.query( 'CREATE TABLE libreevent_users ( account_id INT ( 10 ) NOT NULL AUTO_INCREMENT, email TINYTEXT NOT NULL, pass TEXT, street TEXT, house_number TINYTEXT, country TEXT, phone TEXT, name TEXT, first_name TEXT, data VARCHAR( 10000 ), PRIMARY KEY ( account_id ) ) ENGINE=INNODB;', ( error ) => { if ( error ) if ( error.code !== 'ER_TABLE_EXISTS_ERROR' ) throw error; - this.sqlConnection.query( 'CREATE TABLE libreevent_orders ( order_id INT ( 10 ) NOT NULL AUTO_INCREMENT, account_id INT ( 10 ) NOT NULL, seats VARCHAR( 30000 ), PRIMARY KEY ( order_id ), FOREIGN KEY ( account_id ) REFERENCES libreevent_users( account_id ) ) ENGINE=INNODB;', ( error ) => { + this.sqlConnection.query( 'CREATE TABLE libreevent_orders ( order_id INT ( 10 ) NOT NULL AUTO_INCREMENT, account_id INT ( 10 ) NOT NULL, seats VARCHAR( 60000 ), PRIMARY KEY ( order_id ), FOREIGN KEY ( account_id ) REFERENCES libreevent_users( account_id ) ) ENGINE=INNODB;', ( error ) => { if ( error ) if ( error.code !== 'ER_TABLE_EXISTS_ERROR' ) throw error; this.sqlConnection.query( 'CREATE TABLE libreevent_admin ( account_id INT NOT NULL AUTO_INCREMENT, email TINYTEXT, pass TEXT, permissions VARCHAR( 1000 ), PRIMARY KEY ( account_id ) );', ( error ) => { if ( error ) if ( error.code !== 'ER_TABLE_EXISTS_ERROR' ) throw error; + this.sqlConnection.query( 'CREATE TABLE libreevent_temp ( entry_id INT NOT NULL AUTO_INCREMENT, user_id TINYTEXT, pass TEXT, data VARCHAR( 60000 ), PRIMARY KEY ( entry_id ) );', ( error ) => { + if ( error ) if ( error.code !== 'ER_TABLE_EXISTS_ERROR' ) throw error; + } ); } ); } ); } ); diff --git a/src/webapp/main/src/views/purchasing/PurchaseView.vue b/src/webapp/main/src/views/purchasing/PurchaseView.vue index a4e928b..ea52ef0 100644 --- a/src/webapp/main/src/views/purchasing/PurchaseView.vue +++ b/src/webapp/main/src/views/purchasing/PurchaseView.vue @@ -255,6 +255,7 @@ export default { user a link to download the ticket. A mail has been sent to user automatically. */ let prep = this.$refs.notification.createNotification( 'Preparing payment...', 20, 'progress', 'high' ); + setTimeout( () => { this.$refs.notification.cancelNotification( prep ); this.$refs.notification.createNotification( 'Payment prepared, redirecting...', 5, 'progress', 'high' );