This commit is contained in:
Mario Peters
2023-06-04 12:16:36 +02:00
parent 95e1debfb2
commit 7918ad07c8
3 changed files with 13 additions and 37 deletions

15
.vscode/settings.json vendored
View File

@@ -1,23 +1,23 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#fa1b49",
"activityBar.activeBorder": "#155e02",
"activityBar.activeBackground": "#fa1b49",
"activityBar.background": "#fa1b49",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#155e02",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#fa1b49",
"statusBar.background": "#dd0531",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#fa1b49",
"statusBarItem.remoteBackground": "#dd0531",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#dd0531",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#dd053199",
"titleBar.inactiveForeground": "#e7e7e799",
"sash.hoverBorder": "#fa1b49",
"statusBarItem.remoteBackground": "#dd0531",
"statusBarItem.remoteForeground": "#e7e7e7",
"commandCenter.border": "#e7e7e799"
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.remoteColor": "#dd0531",
"editor.defaultFormatter": "esbenp.prettier-vscode",
@@ -27,5 +27,6 @@
"eslint.validate": ["javascript", "typescript"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"peacock.color": "#dd0531"
}

28
db.js
View File

@@ -2,34 +2,6 @@
// db.js
const mysql = require('mysql')
// exports.db = () => {
// const dbConnection = mysql.createConnection({
// host: process.env.DB_HOST,
// port: process.env.DB_PORT,
// user: process.env.DB_USER,
// password: process.env.DB_PASS,
// database: process.env.DB_DB
// });
// return dbConnection;
// };
// var con = mysql.createConnection({
// host: process.env.DB_HOST,
// port: process.env.DB_PORT,
// user: process.env.DB_USER,
// password: process.env.DB_PASS,
// database: process.env.DB_DB
// });
// con.connect(function(err){
// if(err){
// console.log('Error connecting to Db');
// return;
// }
// console.log('Connection established');
// });
// module.exports = con
// TODO: gucken, ob das gebraucht wird und dann überall verwenden
var pool
module.exports = function db() {

View File

@@ -200,7 +200,7 @@ exports.configureGroupRoutes = (server) => {
method: 'PUT',
path: '/final/create',
handler: async (request, h) => {
// TODO: Verhindern, dass die funktion mehrfach wiederholtz werden kann.
// TODO: Verhindern, dass die funktion mehrfach wiederholt werden kann.
const p = new Promise((resolve, reject) => {
const token = request.query.token
const tid = request.payload.tid
@@ -434,7 +434,10 @@ exports.configureGroupRoutes = (server) => {
const sql = `INSERT INTO turniergruppen (turnier_id, gid, geschlecht, gurtVon, gurtBis, disziplin, altervon, alterbis, pool) VALUES (${turnier_id}, ${gid}, '${geschlecht}', '${gurtVon}', '${gurtBis}', '${disziplin}', ${altervon}, ${alterbis}, '${pool}');`
console.log(sql)
request.app.db.query(sql, (err, results) => {
if (err) console.error(err)
if (err) {
console.error(err)
reject(err) //TODO überall hinzufügen
}
console.log('result', results)
return resolve(results)
})