Commit 9200cc5f authored by Dennis Willers's avatar Dennis Willers 🏀

Change Table Name

parent b589c929
Pipeline #287 passed with stages
in 2 minutes and 7 seconds
...@@ -4,10 +4,11 @@ function createRouter(db) { ...@@ -4,10 +4,11 @@ function createRouter(db) {
const router = express.Router(); const router = express.Router();
// the routes are defined here // the routes are defined here
router.post('/addSpielSession', (req, res) => { router.post('/addSession', (req, res) => {
var spielname = req.body.spielname;
if (spielname.match(/^[0-9a-zA-Z]+$/) != null) { if (spielname.match(/^[0-9a-zA-Z]+$/) != null) {
db.query( db.query(
'INSERT INTO Spielsession (SessionName) VALUES (\"'+spielname+'\");', 'INSERT INTO Session (SessionName) VALUES (\"'+spielname+'\");',
(error) => { (error) => {
if (error) { if (error) {
console.error(error); console.error(error);
...@@ -22,11 +23,11 @@ function createRouter(db) { ...@@ -22,11 +23,11 @@ function createRouter(db) {
} }
}); });
router.post('/isSpielSession', (req, res) => { router.post('/isSession', (req, res) => {
var spielname = req.body.spielname; var spielname = req.body.spielname;
if (spielname.match(/^[0-9a-zA-Z]+$/) != null) { if (spielname.match(/^[0-9a-zA-Z]+$/) != null) {
db.query( db.query(
'SELECT SessionName FROM Spielsession WHERE SessionName = \''+spielname+'\';', 'SELECT SessionName FROM Session WHERE SessionName = \''+spielname+'\';',
(error, results) => { (error, results) => {
if (error) { if (error) {
console.log(error); console.log(error);
...@@ -45,9 +46,9 @@ function createRouter(db) { ...@@ -45,9 +46,9 @@ function createRouter(db) {
} }
}); });
router.get('/SpielSession', function (req, res) { router.get('/Session', function (req, res) {
db.query( db.query(
'SELECT * FROM Spielsession', 'SELECT * FROM Session',
(error, results) => { (error, results) => {
if (error) { if (error) {
console.log(error); console.log(error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment