add db reset to init

This commit is contained in:
2023-10-07 14:44:39 +02:00
parent 6a60c3c93b
commit 97c68d9b17
2 changed files with 14 additions and 0 deletions

View File

@@ -36,6 +36,19 @@ module.exports.initDB = () => {
} )();
};
module.exports.reset = () => {
console.log( '[ DB ] Resetting...' );
this.writeJSONData( 'booked', '{}' );
this.writeJSONData( 'eventDrafts', '{}' );
this.writeJSONData( 'events', '{}' );
this.writeJSONData( 'locations', '{}' );
this.writeJSONData( 'events', '{}' );
this.writeJSONData( 'rootAccount', '{}' );
this.writeJSONData( 'seatplan', '{}' );
this.writeJSONData( 'tickets', '{}' );
console.log( '[ DB ] Reset complete!' );
};
module.exports.getDataSimple = ( db, column, searchQuery ) => {
return new Promise( ( resolve, reject ) => {
dbh.query( { 'command': 'getFilteredData', 'property': column, 'searchQuery': searchQuery }, dbRef[ db ] ).then( data => {