beautifyed

This commit is contained in:
Klaas 2024-06-02 12:39:00 +02:00
parent ef495986a7
commit 264dcebf6c
1 changed files with 210 additions and 206 deletions

10
app.js
View File

@ -312,7 +312,9 @@ app.post('/userrights', requireAuth, requireAdmin, async (req, res) => {
const message = 'Error sending Mail:' + error; const message = 'Error sending Mail:' + error;
res.render('error', { session: req.session, message }); res.render('error', { session: req.session, message });
} }
})}} })
}
}
} else if (type === 'admin') { } else if (type === 'admin') {
await pool.query('UPDATE users SET role = $1 WHERE id = $2', ['admin', userId]); await pool.query('UPDATE users SET role = $1 WHERE id = $2', ['admin', userId]);
} }
@ -831,14 +833,16 @@ try {
const resultAnw = await pool.query('Select * FROM anwesend WHERE fid_teilnehmer = $1 AND fid_training = $2', [teilnehmer, trainingId]); const resultAnw = await pool.query('Select * FROM anwesend WHERE fid_teilnehmer = $1 AND fid_training = $2', [teilnehmer, trainingId]);
if (resultAnw.rows.length == 0) { if (resultAnw.rows.length == 0) {
await pool.query('INSERT INTO anwesend (fid_teilnehmer, fid_training) VALUES ($1, $2)', [teilnehmer, trainingId]); await pool.query('INSERT INTO anwesend (fid_teilnehmer, fid_training) VALUES ($1, $2)', [teilnehmer, trainingId]);
}} }
}
req.session.activeRiege = riege; req.session.activeRiege = riege;
res.redirect('/training'); res.redirect('/training');
} catch (error) { } catch (error) {
console.error('Error:', error); console.error('Error:', error);
req.session.message = ['Error', error, 'error']; req.session.message = ['Error', error, 'error'];
res.redirect('/training'); res.redirect('/training');
}}) }
})
const server = app.listen(port, '0.0.0.0', () => { const server = app.listen(port, '0.0.0.0', () => {
log.Info(`Server is running on ${process.env.HOST}:${port}/`); log.Info(`Server is running on ${process.env.HOST}:${port}/`);