Umfangreiche Änderungen für Trainingslogging
This commit is contained in:
@@ -2,17 +2,20 @@ import express from 'express';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import sequelize from './database.js';
|
||||
import { User, Log, Club, UserClub } from './models/index.js';
|
||||
import {
|
||||
User, Log, Club, UserClub, Member, DiaryDate, Participant, Activity, MemberNote,
|
||||
DiaryNote, DiaryTag, MemberDiaryTag, DiaryDateTag, DiaryMemberNote, DiaryMemberTag
|
||||
} from './models/index.js';
|
||||
import authRoutes from './routes/authRoutes.js';
|
||||
import clubRoutes from './routes/clubRoutes.js';
|
||||
import diaryRoutes from './routes/diaryRoutes.js';
|
||||
import memberRoutes from './routes/memberRoutes.js';
|
||||
import participantRoutes from './routes/participantRoutes.js';
|
||||
import activityRoutes from './routes/activityRoutes.js';
|
||||
import Member from './models/Member.js';
|
||||
import DiaryDate from './models/DiaryDates.js';
|
||||
import Participant from './models/Participant.js';
|
||||
import Activity from './models/Activity.js';
|
||||
import participantRoutes from './routes/participantRoutes.js';
|
||||
import activityRoutes from './routes/activityRoutes.js';
|
||||
import memberNoteRoutes from './routes/memberNoteRoutes.js';
|
||||
import diaryTagRoutes from './routes/diaryTagRoutes.js';
|
||||
import diaryNoteRoutes from './routes/diaryNoteRoutes.js';
|
||||
import diaryMemberRoutes from './routes/diaryMemberRoutes.js'; // Neue Route
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
@@ -21,12 +24,17 @@ const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
app.use('/api/auth', authRoutes);
|
||||
app.use('/api/clubs', clubRoutes);
|
||||
app.use('/api/clubmembers', memberRoutes);
|
||||
app.use('/api/diary', diaryRoutes);
|
||||
app.use('/api/participants', participantRoutes);
|
||||
app.use('/api/activities', activityRoutes);
|
||||
app.use('/api/participants', participantRoutes);
|
||||
app.use('/api/activities', activityRoutes);
|
||||
app.use('/api/membernotes', memberNoteRoutes);
|
||||
app.use('/api/diarynotes', diaryNoteRoutes);
|
||||
app.use('/api/tags', diaryTagRoutes);
|
||||
app.use('/api/diarymember', diaryMemberRoutes); // Neue Route für Diary-Member-Funktionalität
|
||||
|
||||
app.use(express.static(path.join(__dirname, '../frontend/dist')));
|
||||
|
||||
@@ -37,6 +45,7 @@ app.get('*', (req, res) => {
|
||||
(async () => {
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
|
||||
await User.sync({ alter: true });
|
||||
await Club.sync({ alter: true });
|
||||
await UserClub.sync({ alter: true });
|
||||
@@ -45,6 +54,14 @@ app.get('*', (req, res) => {
|
||||
await DiaryDate.sync({ alter: true });
|
||||
await Participant.sync({ alter: true });
|
||||
await Activity.sync({ alter: true });
|
||||
await MemberNote.sync({ alter: true });
|
||||
await DiaryNote.sync({ alter: true });
|
||||
await DiaryTag.sync({ alter: true });
|
||||
await MemberDiaryTag.sync({ alter: true });
|
||||
await DiaryDateTag.sync({ alter: true });
|
||||
await DiaryMemberTag.sync({ alter: true });
|
||||
await DiaryMemberNote.sync({ alter: true });
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Server is running on http://localhost:${port}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user