Compare commits

...

3 Commits

Author SHA1 Message Date
klaas aa5489a068 debug-Mode hinzugefügt für Log in file oder Console 2025-04-12 21:58:09 +02:00
klaas 1d3e426752 gitignore wieder hergestellt 2025-04-12 21:55:56 +02:00
klaas a662820f3f anpassungen 2025-04-12 21:51:40 +02:00
12 changed files with 754 additions and 68 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

14
.env Normal file
View File

@ -0,0 +1,14 @@
DATABASE_URL=postgres://klaas:Dimrb73611912@s002.boergmann.it:5432/
DBNAME=tkd_neu
SESSIONSECRET=ayfawsr23rw
JWT_SECRET=ayfawsr23rw
MAILHOST=ha01s001.org-dns.com
MAILUSER=admin@boergmann.it
MAILFROM=admin@boergmann.it
MAILPASS=October7-Obsessed-Gumdrop-Remote
PORT=2001
TELEBOT=
TELECHAT=
HOST=localhost
WEEKDAY=4
ABTEILUNG=KiTu

14
app.js
View File

@ -7,10 +7,21 @@ const path = require("path");
const moment = require("moment"); const moment = require("moment");
require("dotenv").config(); require("dotenv").config();
const log = require("node-file-logger"); const log = require("node-file-logger");
const debug = true;
const app = express(); const app = express();
const port = process.env.PORT; const port = process.env.PORT;
const cors = require("cors");
// Konfiguration: Erlaube Frontend-Port
app.use(
cors({
origin: "http://localhost:5173",
credentials: true, // Wenn du Cookies / Sessions brauchst (z.B. JWT in Cookies)
})
);
const options = { const options = {
timeZone: "europe/Berlin", timeZone: "europe/Berlin",
folderPath: "./logs/", folderPath: "./logs/",
@ -95,6 +106,9 @@ app.use(
); );
const server = app.listen(port, "0.0.0.0", () => { const server = app.listen(port, "0.0.0.0", () => {
if (debug) {
console.log(`Server is running on ${process.env.HOST}:${port}/`); console.log(`Server is running on ${process.env.HOST}:${port}/`);
} else {
log.Info(`Server is running on ${process.env.HOST}:${port}/`); log.Info(`Server is running on ${process.env.HOST}:${port}/`);
}
}); });

View File

@ -0,0 +1,17 @@
19:18:38 | Info | 'Server is running on undefined:undefined/' |
19:21:15 | Info | 'Server is running on localhost:2001/' |
19:22:43 | Info | 'Server is running on localhost:2001/' |
19:22:45 | Info | 'Server is running on localhost:2001/' |
19:23:04 | Info | 'Server is running on localhost:2001/' |
19:23:33 | Info | 'Server is running on localhost:2001/' |
19:23:37 | Info | 'Server is running on localhost:2001/' |
19:23:59 | Info | 'Server is running on localhost:2001/' |
19:25:59 | Info | 'Server is running on localhost:2001/' |
19:26:02 | Info | 'Server is running on localhost:2001/' |
19:26:06 | Info | 'Server is running on localhost:2001/' |
19:26:07 | Info | 'Server is running on localhost:2001/' |
19:33:40 | Info | 'Server is running on localhost:2001/' |
19:33:42 | Info | 'Server is running on localhost:2001/' |
19:33:44 | Info | 'Server is running on localhost:2001/' |
19:33:45 | Info | 'Server is running on localhost:2001/' |
19:34:47 | Info | 'Server is running on localhost:2001/' |

View File

@ -0,0 +1,69 @@
21:55:44 | Info | 'Server is running on localhost:2001/' |
21:57:38 | Info | 'Server is running on localhost:2001/' |
21:57:41 | Info | 'Server is running on localhost:2001/' |
21:57:43 | Info | 'Server is running on localhost:2001/' |
21:59:01 | Info | 'Server is running on localhost:2001/' |
22:01:58 | Info | 'Server is running on localhost:2001/' |
22:02:08 | Info | 'Server is running on localhost:2001/' |
22:02:31 | Info | 'Server is running on localhost:2001/' |
22:02:37 | Info | 'Server is running on localhost:2001/' |
22:02:46 | Info | 'Server is running on localhost:2001/' |
22:03:27 | Info | 'Server is running on localhost:2001/' |
22:03:31 | Info | 'Server is running on localhost:2001/' |
22:05:57 | Info | 'Server is running on localhost:2001/' |
22:05:59 | Info | 'Server is running on localhost:2001/' |
22:08:49 | Info | 'Server is running on localhost:2001/' |
22:14:43 | Info | 'Server is running on localhost:2001/' |
22:15:13 | Info | 'Server is running on localhost:2001/' |
22:16:58 | Info | 'Server is running on localhost:2001/' |
22:23:35 | Info | 'Server is running on localhost:2001/' |
22:23:36 | Info | 'Server is running on localhost:2001/' |
22:23:49 | Info | 'Server is running on localhost:2001/' |
22:23:55 | Info | 'Server is running on localhost:2001/' |
22:24:28 | Info | 'Server is running on localhost:2001/' |
22:25:22 | Info | 'Server is running on localhost:2001/' |
22:27:00 | Info | 'Server is running on localhost:2001/' |
22:38:21 | Info | 'Server is running on localhost:2001/' |
22:38:51 | Info | 'Server is running on localhost:2001/' |
22:38:57 | Info | 'Server is running on localhost:2001/' |
22:39:05 | Info | 'Server is running on localhost:2001/' |
22:39:08 | Info | 'Server is running on localhost:2001/' |
22:39:24 | Info | 'Server is running on localhost:2001/' |
22:39:26 | Info | 'Server is running on localhost:2001/' |
22:45:03 | Info | 'Server is running on localhost:2001/' |
22:45:04 | Info | 'Server is running on localhost:2001/' |
22:50:44 | Info | 'Server is running on localhost:2001/' |
22:50:46 | Info | 'Server is running on localhost:2001/' |
22:50:55 | Info | 'Server is running on localhost:2001/' |
22:51:23 | Info | 'Server is running on localhost:2001/' |
22:51:42 | Info | 'Server is running on localhost:2001/' |
22:52:33 | Info | 'Server is running on localhost:2001/' |
22:52:36 | Info | 'Server is running on localhost:2001/' |
22:54:56 | Info | 'Server is running on localhost:2001/' |
22:58:51 | Info | 'Server is running on localhost:2001/' |
22:58:53 | Info | 'Server is running on localhost:2001/' |
23:00:30 | Info | 'Server is running on localhost:2001/' |
23:00:31 | Info | 'Server is running on localhost:2001/' |
23:01:59 | Info | 'Server is running on localhost:2001/' |
23:02:04 | Info | 'Server is running on localhost:2001/' |
23:02:12 | Info | 'Server is running on localhost:2001/' |
23:02:16 | Info | 'Server is running on localhost:2001/' |
23:02:20 | Info | 'Server is running on localhost:2001/' |
23:02:28 | Info | 'Server is running on localhost:2001/' |
23:02:33 | Info | 'Server is running on localhost:2001/' |
23:02:39 | Info | 'Server is running on localhost:2001/' |
23:02:40 | Info | 'Server is running on localhost:2001/' |
23:02:54 | Info | 'Server is running on localhost:2001/' |
23:03:01 | Info | 'Server is running on localhost:2001/' |
23:03:11 | Info | 'Server is running on localhost:2001/' |
23:03:15 | Info | 'Server is running on localhost:2001/' |
23:03:17 | Info | 'Server is running on localhost:2001/' |
23:03:21 | Info | 'Server is running on localhost:2001/' |
23:03:22 | Info | 'Server is running on localhost:2001/' |
23:03:25 | Info | 'Server is running on localhost:2001/' |
23:44:12 | Info | 'Server is running on localhost:2001/' |
23:44:15 | Info | 'Server is running on localhost:2001/' |
23:44:25 | Info | 'Server is running on localhost:2001/' |
23:45:04 | Info | 'Server is running on localhost:2001/' |
23:45:11 | Info | 'Server is running on localhost:2001/' |
23:47:48 | Info | 'Server is running on localhost:2001/' |

View File

@ -0,0 +1,257 @@
13:45:12 | Info | 'Server is running on localhost:2001/' |
13:47:20 | Info | 'Server is running on localhost:2001/' |
13:47:35 | Info | 'Server is running on localhost:2001/' |
13:47:39 | Info | 'Server is running on localhost:2001/' |
13:48:53 | Info | 'Server is running on localhost:2001/' |
13:49:24 | Info | 'Server is running on localhost:2001/' |
13:49:27 | Info | 'Server is running on localhost:2001/' |
13:51:57 | Info | 'Server is running on localhost:2001/' |
13:52:01 | Info | 'Server is running on localhost:2001/' |
13:56:33 | Info | 'Server is running on localhost:2001/' |
14:00:01 | Info | 'Server is running on localhost:2001/' |
14:00:13 | Info | 'Server is running on localhost:2001/' |
14:00:26 | Info | 'Server is running on localhost:2001/' |
14:00:41 | Info | 'Server is running on localhost:2001/' |
14:00:51 | Info | 'Server is running on localhost:2001/' |
14:01:10 | Info | 'Server is running on localhost:2001/' |
14:01:26 | Info | 'Server is running on localhost:2001/' |
14:01:47 | Info | 'Server is running on localhost:2001/' |
14:01:56 | Info | 'Server is running on localhost:2001/' |
14:03:24 | Info | 'Server is running on localhost:2001/' |
14:03:29 | Info | 'Server is running on localhost:2001/' |
14:03:33 | Info | 'Server is running on localhost:2001/' |
14:03:36 | Info | 'Server is running on localhost:2001/' |
14:03:44 | Info | 'Server is running on localhost:2001/' |
14:03:54 | Info | 'Server is running on localhost:2001/' |
14:03:55 | Info | 'Server is running on localhost:2001/' |
14:03:56 | Info | 'Server is running on localhost:2001/' |
14:03:58 | Info | 'Server is running on localhost:2001/' |
14:04:46 | Info | 'Server is running on localhost:2001/' |
14:04:57 | Info | 'Server is running on localhost:2001/' |
14:04:59 | Info | 'Server is running on localhost:2001/' |
14:05:04 | Info | 'Server is running on localhost:2001/' |
14:05:09 | Info | 'Server is running on localhost:2001/' |
14:05:15 | Info | 'Server is running on localhost:2001/' |
14:05:24 | Info | 'Server is running on localhost:2001/' |
14:05:26 | Info | 'Server is running on localhost:2001/' |
14:09:43 | Info | 'Server is running on localhost:2001/' |
14:11:13 | Info | 'Server is running on localhost:2001/' |
14:11:25 | Info | 'Server is running on localhost:2001/' |
14:11:33 | Info | 'Server is running on localhost:2001/' |
14:13:03 | Info | 'Server is running on localhost:2001/' |
14:13:06 | Info | 'Server is running on localhost:2001/' |
14:13:09 | Info | 'Server is running on localhost:2001/' |
14:13:23 | Info | 'Server is running on localhost:2001/' |
14:13:28 | Info | 'Server is running on localhost:2001/' |
14:13:30 | Info | 'Server is running on localhost:2001/' |
14:13:31 | Info | 'Server is running on localhost:2001/' |
14:13:41 | Info | 'Server is running on localhost:2001/' |
14:14:07 | Info | 'Server is running on localhost:2001/' |
14:14:12 | Info | 'Server is running on localhost:2001/' |
14:14:20 | Info | 'Server is running on localhost:2001/' |
14:14:26 | Info | 'Server is running on localhost:2001/' |
14:15:55 | Info | 'Server is running on localhost:2001/' |
14:16:03 | Info | 'Server is running on localhost:2001/' |
14:18:28 | Info | 'Server is running on localhost:2001/' |
14:18:55 | Info | 'Server is running on localhost:2001/' |
14:19:02 | Info | 'Server is running on localhost:2001/' |
14:21:15 | Info | 'Server is running on localhost:2001/' |
14:26:34 | Info | 'Server is running on localhost:2001/' |
14:26:56 | Info | 'Server is running on localhost:2001/' |
14:27:02 | Info | 'Server is running on localhost:2001/' |
14:27:07 | Info | 'Server is running on localhost:2001/' |
14:27:11 | Info | 'Server is running on localhost:2001/' |
14:29:42 | Info | 'Server is running on localhost:2001/' |
14:29:52 | Info | 'Server is running on localhost:2001/' |
14:29:59 | Info | 'Server is running on localhost:2001/' |
14:30:50 | Info | 'Server is running on localhost:2001/' |
14:34:20 | Info | 'Server is running on localhost:2001/' |
14:34:25 | Info | 'Server is running on localhost:2001/' |
14:34:25 | Info | 'Server is running on localhost:2001/' |
14:34:29 | Info | 'Server is running on localhost:2001/' |
14:35:15 | Info | 'Server is running on localhost:2001/' |
14:39:34 | Info | 'Server is running on localhost:2001/' |
14:40:07 | Info | 'Server is running on localhost:2001/' |
14:40:11 | Info | 'Server is running on localhost:2001/' |
14:40:16 | Info | 'Server is running on localhost:2001/' |
14:40:19 | Info | 'Server is running on localhost:2001/' |
14:41:47 | Info | 'Server is running on localhost:2001/' |
14:41:54 | Info | 'Server is running on localhost:2001/' |
14:42:00 | Info | 'Server is running on localhost:2001/' |
14:42:04 | Info | 'Server is running on localhost:2001/' |
14:42:09 | Info | 'Server is running on localhost:2001/' |
14:48:07 | Info | 'Server is running on localhost:2001/' |
14:48:09 | Info | 'Server is running on localhost:2001/' |
14:48:13 | Info | 'Server is running on localhost:2001/' |
14:48:14 | Info | 'Server is running on localhost:2001/' |
14:48:16 | Info | 'Server is running on localhost:2001/' |
14:48:18 | Info | 'Server is running on localhost:2001/' |
14:48:20 | Info | 'Server is running on localhost:2001/' |
14:48:48 | Info | 'Server is running on localhost:2001/' |
14:49:34 | Info | 'Server is running on localhost:2001/' |
14:54:34 | Info | 'Server is running on localhost:2001/' |
14:54:39 | Info | 'Server is running on localhost:2001/' |
14:54:45 | Info | 'Server is running on localhost:2001/' |
14:54:50 | Info | 'Server is running on localhost:2001/' |
14:55:07 | Info | 'Server is running on localhost:2001/' |
14:55:11 | Info | 'Server is running on localhost:2001/' |
14:55:14 | Info | 'Server is running on localhost:2001/' |
14:55:34 | Info | 'Server is running on localhost:2001/' |
14:55:37 | Info | 'Server is running on localhost:2001/' |
14:55:42 | Info | 'Server is running on localhost:2001/' |
14:55:48 | Info | 'Server is running on localhost:2001/' |
14:56:01 | Info | 'Server is running on localhost:2001/' |
14:56:05 | Info | 'Server is running on localhost:2001/' |
16:02:52 | Info | 'Server is running on localhost:2001/' |
16:08:35 | Info | 'Server is running on localhost:2001/' |
16:08:37 | Info | 'Server is running on localhost:2001/' |
16:11:12 | Info | 'Server is running on localhost:2001/' |
16:11:15 | Info | 'Server is running on localhost:2001/' |
16:11:25 | Info | 'Server is running on localhost:2001/' |
16:11:30 | Info | 'Server is running on localhost:2001/' |
16:11:32 | Info | 'Server is running on localhost:2001/' |
16:11:44 | Info | 'Server is running on localhost:2001/' |
16:12:22 | Info | 'Server is running on localhost:2001/' |
16:13:31 | Info | 'Server is running on localhost:2001/' |
16:14:04 | Info | 'Server is running on localhost:2001/' |
16:14:27 | Info | 'Server is running on localhost:2001/' |
16:14:31 | Info | 'Server is running on localhost:2001/' |
16:14:35 | Info | 'Server is running on localhost:2001/' |
16:14:42 | Info | 'Server is running on localhost:2001/' |
16:14:55 | Info | 'Server is running on localhost:2001/' |
16:16:02 | Info | 'Server is running on localhost:2001/' |
16:16:05 | Info | 'Server is running on localhost:2001/' |
16:16:07 | Info | 'Server is running on localhost:2001/' |
16:16:14 | Info | 'Server is running on localhost:2001/' |
16:16:19 | Info | 'Server is running on localhost:2001/' |
16:16:21 | Info | 'Server is running on localhost:2001/' |
16:16:23 | Info | 'Server is running on localhost:2001/' |
16:17:42 | Info | 'Server is running on localhost:2001/' |
16:17:45 | Info | 'Server is running on localhost:2001/' |
16:18:11 | Info | 'Server is running on localhost:2001/' |
16:18:20 | Info | 'Server is running on localhost:2001/' |
16:18:24 | Info | 'Server is running on localhost:2001/' |
16:18:57 | Info | 'Server is running on localhost:2001/' |
16:19:00 | Info | 'Server is running on localhost:2001/' |
16:20:28 | Info | 'Server is running on localhost:2001/' |
16:20:34 | Info | 'Server is running on localhost:2001/' |
16:20:42 | Info | 'Server is running on localhost:2001/' |
16:20:47 | Info | 'Server is running on localhost:2001/' |
16:27:52 | Info | 'Server is running on localhost:2001/' |
16:27:59 | Info | 'Server is running on localhost:2001/' |
16:28:01 | Info | 'Server is running on localhost:2001/' |
16:28:15 | Info | 'Server is running on localhost:2001/' |
16:28:25 | Info | 'Server is running on localhost:2001/' |
16:28:29 | Info | 'Server is running on localhost:2001/' |
16:28:33 | Info | 'Server is running on localhost:2001/' |
16:28:36 | Info | 'Server is running on localhost:2001/' |
16:28:39 | Info | 'Server is running on localhost:2001/' |
16:28:43 | Info | 'Server is running on localhost:2001/' |
16:34:49 | Info | 'Server is running on localhost:2001/' |
16:36:11 | Info | 'Server is running on localhost:2001/' |
16:36:14 | Info | 'Server is running on localhost:2001/' |
16:37:33 | Info | 'Server is running on localhost:2001/' |
16:37:38 | Info | 'Server is running on localhost:2001/' |
16:38:04 | Info | 'Server is running on localhost:2001/' |
16:38:31 | Info | 'Server is running on localhost:2001/' |
16:38:35 | Info | 'Server is running on localhost:2001/' |
16:39:58 | Info | 'Server is running on localhost:2001/' |
16:40:00 | Info | 'Server is running on localhost:2001/' |
16:40:04 | Info | 'Server is running on localhost:2001/' |
16:40:06 | Info | 'Server is running on localhost:2001/' |
16:40:09 | Info | 'Server is running on localhost:2001/' |
16:41:00 | Info | 'Server is running on localhost:2001/' |
16:41:40 | Info | 'Server is running on localhost:2001/' |
16:41:47 | Info | 'Server is running on localhost:2001/' |
16:41:48 | Info | 'Server is running on localhost:2001/' |
16:47:04 | Info | 'Server is running on localhost:2001/' |
16:48:55 | Info | 'Server is running on localhost:2001/' |
16:48:56 | Info | 'Server is running on localhost:2001/' |
16:49:00 | Info | 'Server is running on localhost:2001/' |
16:49:02 | Info | 'Server is running on localhost:2001/' |
16:49:07 | Info | 'Server is running on localhost:2001/' |
16:49:08 | Info | 'Server is running on localhost:2001/' |
16:49:10 | Info | 'Server is running on localhost:2001/' |
16:49:12 | Info | 'Server is running on localhost:2001/' |
16:49:19 | Info | 'Server is running on localhost:2001/' |
16:49:23 | Info | 'Server is running on localhost:2001/' |
16:49:25 | Info | 'Server is running on localhost:2001/' |
16:49:28 | Info | 'Server is running on localhost:2001/' |
16:49:33 | Info | 'Server is running on localhost:2001/' |
16:49:36 | Info | 'Server is running on localhost:2001/' |
16:49:40 | Info | 'Server is running on localhost:2001/' |
16:49:44 | Info | 'Server is running on localhost:2001/' |
16:49:45 | Info | 'Server is running on localhost:2001/' |
16:50:49 | Info | 'Server is running on localhost:2001/' |
16:51:40 | Info | 'Server is running on localhost:2001/' |
16:51:45 | Info | 'Server is running on localhost:2001/' |
16:51:57 | Info | 'Server is running on localhost:2001/' |
16:52:03 | Info | 'Server is running on localhost:2001/' |
16:52:44 | Info | 'Server is running on localhost:2001/' |
16:53:04 | Info | 'Server is running on localhost:2001/' |
16:56:50 | Info | 'Server is running on localhost:2001/' |
16:57:05 | Info | 'Server is running on localhost:2001/' |
16:57:16 | Info | 'Server is running on localhost:2001/' |
16:58:17 | Info | 'Server is running on localhost:2001/' |
16:59:12 | Info | 'Server is running on localhost:2001/' |
17:01:05 | Info | 'Server is running on localhost:2001/' |
17:02:03 | Info | 'Server is running on localhost:2001/' |
17:02:08 | Info | 'Server is running on localhost:2001/' |
17:02:33 | Info | 'Server is running on localhost:2001/' |
17:02:44 | Info | 'Server is running on localhost:2001/' |
17:02:45 | Info | 'Server is running on localhost:2001/' |
17:53:18 | Info | 'Server is running on localhost:2001/' |
17:53:24 | Info | 'Server is running on localhost:2001/' |
17:53:28 | Info | 'Server is running on localhost:2001/' |
17:53:30 | Info | 'Server is running on localhost:2001/' |
17:53:35 | Info | 'Server is running on localhost:2001/' |
17:53:37 | Info | 'Server is running on localhost:2001/' |
17:53:42 | Info | 'Server is running on localhost:2001/' |
17:53:43 | Info | 'Server is running on localhost:2001/' |
17:53:48 | Info | 'Server is running on localhost:2001/' |
17:54:41 | Info | 'Server is running on localhost:2001/' |
17:54:43 | Info | 'Server is running on localhost:2001/' |
17:54:54 | Info | 'Server is running on localhost:2001/' |
17:55:43 | Info | 'Server is running on localhost:2001/' |
17:56:29 | Info | 'Server is running on localhost:2001/' |
18:02:33 | Info | 'Server is running on localhost:2001/' |
18:02:46 | Info | 'Server is running on localhost:2001/' |
18:10:36 | Info | 'Server is running on localhost:2001/' |
18:10:45 | Info | 'Server is running on localhost:2001/' |
18:27:14 | Info | 'Server is running on localhost:2001/' |
18:27:19 | Info | 'Server is running on localhost:2001/' |
18:27:19 | Info | 'Server is running on localhost:2001/' |
18:28:27 | Info | 'Server is running on localhost:2001/' |
18:28:47 | Info | 'Server is running on localhost:2001/' |
18:32:11 | Info | 'Server is running on localhost:2001/' |
18:32:18 | Info | 'Server is running on localhost:2001/' |
18:36:42 | Info | 'Server is running on localhost:2001/' |
18:36:46 | Info | 'Server is running on localhost:2001/' |
18:36:55 | Info | 'Server is running on localhost:2001/' |
18:40:37 | Info | 'Server is running on localhost:2001/' |
18:40:38 | Info | 'Server is running on localhost:2001/' |
18:45:52 | Info | 'Server is running on localhost:2001/' |
18:45:55 | Info | 'Server is running on localhost:2001/' |
18:51:11 | Info | 'Server is running on localhost:2001/' |
18:51:14 | Info | 'Server is running on localhost:2001/' |
18:53:46 | Info | 'Server is running on localhost:2001/' |
18:53:50 | Info | 'Server is running on localhost:2001/' |
18:53:54 | Info | 'Server is running on localhost:2001/' |
19:12:13 | Info | 'Server is running on localhost:2001/' |
19:12:18 | Info | 'Server is running on localhost:2001/' |
19:12:44 | Info | 'Server is running on localhost:2001/' |
19:13:01 | Info | 'Server is running on localhost:2001/' |
19:22:06 | Info | 'Server is running on localhost:2001/' |
19:23:01 | Info | 'Server is running on localhost:2001/' |
19:25:52 | Info | 'Server is running on localhost:2001/' |
23:17:12 | Info | 'Server is running on localhost:2001/' |
23:18:00 | Info | 'Server is running on localhost:2001/' |
23:18:08 | Info | 'Server is running on localhost:2001/' |
23:18:12 | Info | 'Server is running on localhost:2001/' |
23:18:39 | Info | 'Server is running on localhost:2001/' |
23:18:41 | Info | 'Server is running on localhost:2001/' |
23:18:46 | Info | 'Server is running on localhost:2001/' |
23:19:21 | Info | 'Server is running on localhost:2001/' |
23:19:51 | Info | 'Server is running on localhost:2001/' |
23:20:32 | Info | 'Server is running on localhost:2001/' |
23:20:40 | Info | 'Server is running on localhost:2001/' |

View File

@ -0,0 +1,69 @@
16:25:33 | Info | 'Server is running on localhost:2001/' |
16:25:49 | Info | 'Server is running on localhost:2001/' |
16:26:26 | Info | 'Server is running on localhost:2001/' |
16:26:50 | Info | 'Server is running on localhost:2001/' |
16:27:18 | Info | 'Server is running on localhost:2001/' |
16:27:34 | Info | 'Server is running on localhost:2001/' |
16:27:43 | Info | 'Server is running on localhost:2001/' |
16:27:50 | Info | 'Server is running on localhost:2001/' |
16:27:53 | Info | 'Server is running on localhost:2001/' |
16:27:59 | Info | 'Server is running on localhost:2001/' |
16:31:42 | Info | 'Server is running on localhost:2001/' |
16:31:43 | Info | 'Server is running on localhost:2001/' |
16:31:48 | Info | 'Server is running on localhost:2001/' |
16:31:49 | Info | 'Server is running on localhost:2001/' |
16:35:33 | Info | 'Server is running on localhost:2001/' |
16:35:40 | Info | 'Server is running on localhost:2001/' |
16:35:42 | Info | 'Server is running on localhost:2001/' |
16:37:13 | Info | 'Server is running on localhost:2001/' |
16:41:00 | Info | 'Server is running on localhost:2001/' |
16:41:03 | Info | 'Server is running on localhost:2001/' |
16:41:05 | Info | 'Server is running on localhost:2001/' |
16:41:13 | Info | 'Server is running on localhost:2001/' |
16:41:15 | Info | 'Server is running on localhost:2001/' |
16:41:37 | Info | 'Server is running on localhost:2001/' |
16:41:43 | Info | 'Server is running on localhost:2001/' |
16:41:45 | Info | 'Server is running on localhost:2001/' |
16:42:07 | Info | 'Server is running on localhost:2001/' |
16:42:14 | Info | 'Server is running on localhost:2001/' |
16:42:16 | Info | 'Server is running on localhost:2001/' |
16:42:45 | Info | 'Server is running on localhost:2001/' |
16:42:51 | Info | 'Server is running on localhost:2001/' |
16:42:54 | Info | 'Server is running on localhost:2001/' |
16:43:09 | Info | 'Server is running on localhost:2001/' |
16:43:12 | Info | 'Server is running on localhost:2001/' |
16:43:59 | Info | 'Server is running on localhost:2001/' |
16:44:02 | Info | 'Server is running on localhost:2001/' |
16:44:03 | Info | 'Server is running on localhost:2001/' |
16:44:16 | Info | 'Server is running on localhost:2001/' |
16:44:17 | Info | 'Server is running on localhost:2001/' |
16:44:34 | Info | 'Server is running on localhost:2001/' |
16:44:44 | Info | 'Server is running on localhost:2001/' |
16:44:49 | Info | 'Server is running on localhost:2001/' |
16:44:53 | Info | 'Server is running on localhost:2001/' |
16:44:54 | Info | 'Server is running on localhost:2001/' |
16:45:36 | Info | 'Server is running on localhost:2001/' |
16:53:24 | Info | 'Server is running on localhost:2001/' |
16:57:35 | Info | 'Server is running on localhost:2001/' |
16:59:05 | Info | 'Server is running on localhost:2001/' |
17:00:08 | Info | 'Server is running on localhost:2001/' |
17:00:49 | Info | 'Server is running on localhost:2001/' |
17:01:03 | Info | 'Server is running on localhost:2001/' |
17:01:13 | Info | 'Server is running on localhost:2001/' |
17:01:47 | Info | 'Server is running on localhost:2001/' |
17:02:16 | Info | 'Server is running on localhost:2001/' |
17:02:33 | Info | 'Server is running on localhost:2001/' |
17:02:41 | Info | 'Server is running on localhost:2001/' |
17:02:44 | Info | 'Server is running on localhost:2001/' |
17:02:45 | Info | 'Server is running on localhost:2001/' |
17:02:55 | Info | 'Server is running on localhost:2001/' |
17:03:07 | Info | 'Server is running on localhost:2001/' |
17:03:09 | Info | 'Server is running on localhost:2001/' |
17:03:17 | Info | 'Server is running on localhost:2001/' |
17:03:27 | Info | 'Server is running on localhost:2001/' |
17:03:33 | Info | 'Server is running on localhost:2001/' |
17:04:29 | Info | 'Server is running on localhost:2001/' |
17:04:52 | Info | 'Server is running on localhost:2001/' |
17:04:59 | Info | 'Server is running on localhost:2001/' |
17:08:54 | Info | 'Server is running on localhost:2001/' |
19:05:23 | Info | 'Server is running on localhost:2001/' |

View File

@ -0,0 +1,159 @@
16:23:51 | Info | 'Server is running on localhost:2001/' |
16:49:23 | Info | 'Server is running on localhost:2001/' |
20:22:32 | Info | 'Server is running on localhost:2001/' |
21:09:51 | Info | 'Server is running on localhost:2001/' |
21:14:47 | Info | 'Server is running on localhost:2001/' |
21:14:50 | Info | 'Server is running on localhost:2001/' |
21:14:58 | Info | 'Server is running on localhost:2001/' |
21:15:06 | Info | 'Server is running on localhost:2001/' |
21:15:08 | Info | 'Server is running on localhost:2001/' |
21:15:10 | Info | 'Server is running on localhost:2001/' |
21:15:15 | Info | 'Server is running on localhost:2001/' |
21:15:28 | Info | 'Server is running on localhost:2001/' |
21:15:30 | Info | 'Server is running on localhost:2001/' |
21:15:34 | Info | 'Server is running on localhost:2001/' |
21:15:34 | Info | 'Server is running on localhost:2001/' |
21:15:44 | Info | 'Server is running on localhost:2001/' |
21:15:47 | Info | 'Server is running on localhost:2001/' |
21:15:51 | Info | 'Server is running on localhost:2001/' |
21:15:55 | Info | 'Server is running on localhost:2001/' |
21:15:59 | Info | 'Server is running on localhost:2001/' |
21:18:18 | Info | 'Server is running on localhost:2001/' |
21:19:01 | Info | 'Server is running on localhost:2001/' |
21:19:24 | Info | 'Server is running on localhost:2001/' |
21:19:29 | Info | 'Server is running on localhost:2001/' |
21:19:32 | Info | 'Server is running on localhost:2001/' |
21:20:04 | Info | 'Server is running on localhost:2001/' |
21:21:05 | Info | 'Server is running on localhost:2001/' |
21:21:20 | Info | 'Server is running on localhost:2001/' |
21:21:21 | Info | 'Server is running on localhost:2001/' |
21:21:23 | Info | 'Server is running on localhost:2001/' |
21:21:28 | Info | 'Server is running on localhost:2001/' |
21:21:31 | Info | 'Server is running on localhost:2001/' |
21:21:33 | Info | 'Server is running on localhost:2001/' |
21:21:45 | Info | 'Server is running on localhost:2001/' |
21:21:48 | Info | 'Server is running on localhost:2001/' |
21:21:49 | Info | 'Server is running on localhost:2001/' |
21:21:53 | Info | 'Server is running on localhost:2001/' |
21:21:57 | Info | 'Server is running on localhost:2001/' |
21:22:00 | Info | 'Server is running on localhost:2001/' |
21:22:02 | Info | 'Server is running on localhost:2001/' |
21:22:06 | Info | 'Server is running on localhost:2001/' |
21:22:17 | Info | 'Server is running on localhost:2001/' |
21:22:53 | Info | 'Server is running on localhost:2001/' |
21:22:59 | Info | 'Server is running on localhost:2001/' |
21:23:03 | Info | 'Server is running on localhost:2001/' |
21:23:23 | Info | 'Server is running on localhost:2001/' |
21:23:25 | Info | 'Server is running on localhost:2001/' |
21:23:28 | Info | 'Server is running on localhost:2001/' |
21:23:29 | Info | 'Server is running on localhost:2001/' |
21:23:42 | Info | 'Server is running on localhost:2001/' |
21:23:43 | Info | 'Server is running on localhost:2001/' |
21:24:07 | Info | 'Server is running on localhost:2001/' |
21:24:08 | Info | 'Server is running on localhost:2001/' |
21:24:47 | Info | 'Server is running on localhost:2001/' |
21:25:00 | Info | 'Server is running on localhost:2001/' |
21:25:13 | Info | 'Server is running on localhost:2001/' |
21:32:22 | Info | 'Server is running on localhost:2001/' |
21:32:24 | Info | 'Server is running on localhost:2001/' |
21:32:27 | Info | 'Server is running on localhost:2001/' |
21:32:31 | Info | 'Server is running on localhost:2001/' |
21:32:32 | Info | 'Server is running on localhost:2001/' |
21:32:37 | Info | 'Server is running on localhost:2001/' |
22:42:25 | Info | 'Server is running on localhost:2001/' |
22:42:27 | Info | 'Server is running on localhost:2001/' |
22:42:28 | Info | 'Server is running on localhost:2001/' |
22:42:33 | Info | 'Server is running on localhost:2001/' |
22:42:38 | Info | 'Server is running on localhost:2001/' |
22:42:48 | Info | 'Server is running on localhost:2001/' |
22:42:59 | Info | 'Server is running on localhost:2001/' |
22:43:01 | Info | 'Server is running on localhost:2001/' |
22:43:05 | Info | 'Server is running on localhost:2001/' |
22:43:08 | Info | 'Server is running on localhost:2001/' |
22:43:09 | Info | 'Server is running on localhost:2001/' |
22:43:14 | Info | 'Server is running on localhost:2001/' |
22:43:19 | Info | 'Server is running on localhost:2001/' |
22:43:22 | Info | 'Server is running on localhost:2001/' |
22:43:29 | Info | 'Server is running on localhost:2001/' |
22:43:34 | Info | 'Server is running on localhost:2001/' |
22:43:39 | Info | 'Server is running on localhost:2001/' |
22:43:44 | Info | 'Server is running on localhost:2001/' |
22:43:49 | Info | 'Server is running on localhost:2001/' |
22:47:43 | Info | 'Server is running on localhost:2001/' |
22:48:42 | Info | 'Server is running on localhost:2001/' |
22:48:45 | Info | 'Server is running on localhost:2001/' |
22:49:13 | Info | 'Server is running on localhost:2001/' |
22:49:15 | Info | 'Server is running on localhost:2001/' |
22:49:18 | Info | 'Server is running on localhost:2001/' |
22:49:21 | Info | 'Server is running on localhost:2001/' |
22:49:24 | Info | 'Server is running on localhost:2001/' |
22:49:30 | Info | 'Server is running on localhost:2001/' |
22:49:32 | Info | 'Server is running on localhost:2001/' |
22:49:34 | Info | 'Server is running on localhost:2001/' |
22:51:18 | Info | 'Server is running on localhost:2001/' |
22:51:24 | Info | 'Server is running on localhost:2001/' |
22:51:25 | Info | 'Server is running on localhost:2001/' |
22:51:28 | Info | 'Server is running on localhost:2001/' |
22:51:31 | Info | 'Server is running on localhost:2001/' |
22:51:33 | Info | 'Server is running on localhost:2001/' |
22:52:15 | Info | 'Server is running on localhost:2001/' |
22:52:30 | Info | 'Server is running on localhost:2001/' |
22:54:16 | Info | 'Server is running on localhost:2001/' |
22:54:35 | Info | 'Server is running on localhost:2001/' |
22:54:38 | Info | 'Server is running on localhost:2001/' |
22:54:40 | Info | 'Server is running on localhost:2001/' |
22:55:03 | Info | 'Server is running on localhost:2001/' |
22:55:09 | Info | 'Server is running on localhost:2001/' |
22:55:10 | Info | 'Server is running on localhost:2001/' |
22:55:20 | Info | 'Server is running on localhost:2001/' |
22:55:24 | Info | 'Server is running on localhost:2001/' |
22:55:53 | Info | 'Server is running on localhost:2001/' |
22:55:55 | Info | 'Server is running on localhost:2001/' |
22:56:44 | Info | 'Server is running on localhost:2001/' |
22:58:31 | Info | 'Server is running on localhost:2001/' |
22:59:02 | Info | 'Server is running on localhost:2001/' |
22:59:13 | Info | 'Server is running on localhost:2001/' |
23:00:25 | Info | 'Server is running on localhost:2001/' |
23:02:45 | Info | 'Server is running on localhost:2001/' |
23:04:10 | Info | 'Server is running on localhost:2001/' |
23:04:17 | Info | 'Server is running on localhost:2001/' |
23:04:21 | Info | 'Server is running on localhost:2001/' |
23:14:44 | Info | 'Server is running on localhost:2001/' |
23:15:24 | Info | 'Server is running on localhost:2001/' |
23:15:30 | Info | 'Server is running on localhost:2001/' |
23:15:41 | Info | 'Server is running on localhost:2001/' |
23:15:44 | Info | 'Server is running on localhost:2001/' |
23:15:47 | Info | 'Server is running on localhost:2001/' |
23:15:52 | Info | 'Server is running on localhost:2001/' |
23:15:54 | Info | 'Server is running on localhost:2001/' |
23:16:04 | Info | 'Server is running on localhost:2001/' |
23:16:06 | Info | 'Server is running on localhost:2001/' |
23:16:07 | Info | 'Server is running on localhost:2001/' |
23:16:15 | Info | 'Server is running on localhost:2001/' |
23:16:19 | Info | 'Server is running on localhost:2001/' |
23:16:22 | Info | 'Server is running on localhost:2001/' |
23:16:25 | Info | 'Server is running on localhost:2001/' |
23:16:29 | Info | 'Server is running on localhost:2001/' |
23:16:31 | Info | 'Server is running on localhost:2001/' |
23:16:35 | Info | 'Server is running on localhost:2001/' |
23:16:38 | Info | 'Server is running on localhost:2001/' |
23:16:41 | Info | 'Server is running on localhost:2001/' |
23:16:43 | Info | 'Server is running on localhost:2001/' |
23:16:47 | Info | 'Server is running on localhost:2001/' |
23:16:51 | Info | 'Server is running on localhost:2001/' |
23:16:58 | Info | 'Server is running on localhost:2001/' |
23:17:00 | Info | 'Server is running on localhost:2001/' |
23:17:12 | Info | 'Server is running on localhost:2001/' |
23:17:17 | Info | 'Server is running on localhost:2001/' |
23:17:44 | Info | 'Server is running on localhost:2001/' |
23:18:43 | Info | 'Server is running on localhost:2001/' |
23:19:18 | Info | 'Server is running on localhost:2001/' |
23:19:21 | Info | 'Server is running on localhost:2001/' |
23:19:32 | Info | 'Server is running on localhost:2001/' |
23:19:36 | Info | 'Server is running on localhost:2001/' |
23:19:39 | Info | 'Server is running on localhost:2001/' |
23:19:41 | Info | 'Server is running on localhost:2001/' |
23:19:46 | Info | 'Server is running on localhost:2001/' |
23:19:47 | Info | 'Server is running on localhost:2001/' |
23:26:28 | Info | 'Server is running on localhost:2001/' |
23:26:36 | Info | 'Server is running on localhost:2001/' |

13
package-lock.json generated
View File

@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"bcryptjs": "^3.0.2", "bcryptjs": "^3.0.2",
"cors": "^2.8.5",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"ejs": "^3.1.10", "ejs": "^3.1.10",
@ -448,6 +449,18 @@
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/crypto": { "node_modules/crypto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",

View File

@ -13,6 +13,7 @@
"dependencies": { "dependencies": {
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"bcryptjs": "^3.0.2", "bcryptjs": "^3.0.2",
"cors": "^2.8.5",
"crypto": "^1.0.1", "crypto": "^1.0.1",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"ejs": "^3.1.10", "ejs": "^3.1.10",

View File

@ -5,15 +5,26 @@ const { requireAuth, requireRole } = require("../middleware/auth"); // Auth-Midd
const router = express.Router(); const router = express.Router();
// **Trainings abrufen (mit Geräten & Leitern)** // **Trainings abrufen (mit Geräten & Leitern)**
router.get("/:year?/:kw?", requireAuth, async (req, res) => { router.get(
const { year, kw } = req.params; "/:key1?/:value1?/:key2?/:value2?",
requireAuth,
async (req, res) => {
const { key1, value1, key2, value2 } = req.params;
let result;
try {
if (key1 === "year") {
const year = value1;
if (key2 && key2 === "kw") {
const kw = value2;
const abteilung = req.abteilung; // Abteilung aus Middleware const abteilung = req.abteilung; // Abteilung aus Middleware
if (!abteilung) { if (!abteilung) {
return res.status(400).json({ error: "Abteilung ist erforderlich" }); return res
.status(400)
.json({ error: "Abteilung ist erforderlich" });
} }
try {
let query; let query;
let values = [abteilung]; let values = [abteilung];
@ -41,19 +52,58 @@ router.get("/:year?/:kw?", requireAuth, async (req, res) => {
ORDER BY year DESC, kw DESC ORDER BY year DESC, kw DESC
`; `;
} }
result = await pool.query(query, values);
const result = await pool.query(query, values); }
if (result.rows.length === 0) { if (result.rows.length === 0) {
return res.status(404).json({ error: "Keine Trainings gefunden" }); return res.status(404).json({ error: "Keine Trainings gefunden" });
} }
return res.json(result.rows); return res.json(result.rows);
} else if (key1 === "geraete") {
id = value1;
if (value1) {
try {
const result = await pool.query(
`
SELECT
i AS riege_nr,
'Riege ' || i AS riege_name,
g.name AS geraet
FROM (
SELECT geraete[i] AS id, i
FROM geraeteplan, generate_subscripts(geraete, 1) AS i
WHERE fid_training = $1
) AS gp
JOIN Geraete g ON g.id = gp.id
ORDER BY i
`,
[id]
);
const geraeteArray = result.rows.map((row) => ({
riege: row.riege_name,
geraet: row.geraet,
nr: row.riege_nr,
}));
res.json(geraeteArray);
} catch (err) {
console.error("Fehler beim Abrufen des Geräteplans:", err);
res
.status(500)
.json({ error: "Fehler beim Abrufen des Geräteplans" });
}
} else {
res.status(400).json({ error: "TrainingsID muss übergeben werden" });
}
}
} catch (err) { } catch (err) {
console.error(err); console.error(err);
res.status(500).json({ error: "Interner Serverfehler" }); res.status(500).json({ error: "Interner Serverfehler" });
} }
}); }
);
router.post("/leiten/:id", requireAuth, requireRole(3), async (req, res) => { router.post("/leiten/:id", requireAuth, requireRole(3), async (req, res) => {
const { id } = req.params; // Trainings-ID const { id } = req.params; // Trainings-ID

View File

@ -54,22 +54,55 @@ router.post("/login", async (req, res) => {
"SELECT * FROM users WHERE username = $1", "SELECT * FROM users WHERE username = $1",
[username] [username]
); );
if (userResult.rows.length > 0) {
if (userResult.rows.length === 0) {
return res.status(401).json({ error: "Ungültige Anmeldedaten" });
}
const user = userResult.rows[0]; const user = userResult.rows[0];
console.log(user);
const match = await bcrypt.compare(password, user.password); const match = await bcrypt.compare(password, user.password);
if (match) { if (!match) {
if (user.is_active) { return res.status(401).json({ error: "Ungültige Anmeldedaten" });
}
if (!user.is_active) {
return res.status(401).json({ error: "Auf Freischaltung warten" });
}
const rightsResult = await pool.query( const rightsResult = await pool.query(
`SELECT fid_abteilung, fid_role FROM userrights WHERE fid_user = $1`, `SELECT fid_abteilung, fid_role FROM userrights WHERE fid_user = $1`,
[user.id] [user.id]
); );
// Rollen-Map erstellen: const abteilungsIds = rightsResult.rows.map((r) => r.fid_abteilung);
// Abfrage aller passenden Abteilungen in einem Query
let abteilungen = [];
if (abteilungsIds.length > 0) {
const abteilungenResult = await pool.query(
`SELECT id, name, trainingstag FROM abteilungen WHERE id = ANY($1::int[])`,
[abteilungsIds]
);
// Kombiniere Rechte + Abteilungsdetails
abteilungen = abteilungenResult.rows.map((abteilung) => {
const rechte = rightsResult.rows.find(
(r) => r.fid_abteilung === abteilung.id
)?.fid_role;
return {
id: abteilung.id,
name: abteilung.name,
trainingstag: abteilung.trainingstag,
rechte: rechte,
};
});
}
const roles = {}; const roles = {};
rightsResult.rows.forEach((row) => { rightsResult.rows.forEach((row) => {
roles[row.fid_abteilung] = row.fid_role; roles[row.fid_abteilung] = row.fid_role;
}); });
const token = jwt.sign( const token = jwt.sign(
{ id: user.id, username: user.username, roles }, { id: user.id, username: user.username, roles },
process.env.JWT_SECRET, process.env.JWT_SECRET,
@ -77,25 +110,15 @@ router.post("/login", async (req, res) => {
expiresIn: "24d", expiresIn: "24d",
} }
); );
res.json({ token, roles });
} else { res.json({ token, abteilungen });
return res.status(401).json({ error: "Auf Freischlatung warten" });
}
} else {
const message = "Falsches Passwort";
return res.status(401).json({ error: "Ungültige Anmeldedaten" });
}
} else {
const message = "Unbekannter Benutzer";
return res.status(401).json({ error: "Ungültige Anmeldedaten" });
}
} catch (error) { } catch (error) {
console.error("Error logging in:", error); console.error("Error logging in:", error);
const message = "Error logging in:" + error; return res.status(500).json({ error: "Fehler beim Login" });
return res.status(401).json({ error: "Ungültige Anmeldedaten" });
} }
}); });
// Reset initiieren // Reset initiieren
router.post("/reset-password", async (req, res) => { router.post("/reset-password", async (req, res) => {
const { email } = req.body; const { email } = req.body;