Login-/out problems solved, group model defined
This commit is contained in:
29
backend/models/Group.js
Normal file
29
backend/models/Group.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { DataTypes } from 'sequelize';
|
||||
import sequelize from '../database.js';
|
||||
import DiaryDate from './DiaryDates.js';
|
||||
|
||||
const Group = sequelize.define('Group', {
|
||||
diaryDate: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: DiaryDate,
|
||||
key: 'id',
|
||||
},
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
lead: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
}
|
||||
}, {
|
||||
tableName: 'group',
|
||||
underscored: true,
|
||||
timestamps: true,
|
||||
});
|
||||
|
||||
export default Group;
|
||||
@@ -48,7 +48,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
selectedClub: null,
|
||||
isMenuOpen: false, // Für das mobile Design zum Öffnen/Schließen des Menüs
|
||||
isMenuOpen: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { createStore } from 'vuex';
|
||||
import router from './router.js';
|
||||
import apiClient from './apiClient.js';
|
||||
|
||||
const store = createStore({
|
||||
state: {
|
||||
@@ -31,12 +33,12 @@ const store = createStore({
|
||||
},
|
||||
setClubsMutation(state, clubs) {
|
||||
state.clubs = clubs;
|
||||
localStorage.setItem('clubs', JSON.stringify(clubs));
|
||||
localStorage.setItem('clubs', JSON.stringify(clubs));
|
||||
},
|
||||
clearToken(state) {
|
||||
state.token = null;
|
||||
localStorage.removeItem('token');
|
||||
router.push("/");
|
||||
localStorage.removeItem('currentClub'); // Auch den aktuellen Club entfernen
|
||||
},
|
||||
clearUsername(state) {
|
||||
state.username = '';
|
||||
@@ -53,7 +55,8 @@ const store = createStore({
|
||||
logout({ commit }) {
|
||||
commit('clearToken');
|
||||
commit('clearUsername');
|
||||
router.push("/");
|
||||
router.push("/");
|
||||
window.location.reload();
|
||||
},
|
||||
setCurrentClub({ commit }, club) {
|
||||
commit('setClub', club);
|
||||
|
||||
@@ -246,7 +246,7 @@ export default {
|
||||
id: tag.id,
|
||||
name: tag.name
|
||||
}));
|
||||
this.previousActivityTags = [...this.selectedActivityTags]; // Hier setzen
|
||||
this.previousActivityTags = [...this.selectedActivityTags];
|
||||
|
||||
await this.loadMembers();
|
||||
await this.loadParticipants(dateId);
|
||||
@@ -277,12 +277,13 @@ export default {
|
||||
trainingStart: this.trainingStart || null,
|
||||
trainingEnd: this.trainingEnd || null,
|
||||
});
|
||||
console.log(response);
|
||||
this.dates.push({ id: response.data.id, date: response.data.date });
|
||||
this.date = { id: response.data.id, date: response.data.date };
|
||||
this.showForm = false;
|
||||
this.newDate = '';
|
||||
this.trainingStart = '';
|
||||
this.trainingEnd = '';
|
||||
this.trainingStart = response.data.trainingStart;
|
||||
this.trainingEnd = response.data.trainingEnd;
|
||||
} catch (error) {
|
||||
alert('Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.');
|
||||
}
|
||||
@@ -623,6 +624,7 @@ export default {
|
||||
await apiClient.put(`/diary-date-activities/${this.currentClub}/${movedItem.id}/order`, {
|
||||
orderId: evt.newIndex
|
||||
});
|
||||
this.recalculateTimes();
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Aktualisieren der Reihenfolge:', error);
|
||||
alert('Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.');
|
||||
@@ -673,6 +675,13 @@ export default {
|
||||
this.imageUrl = null;
|
||||
}
|
||||
},
|
||||
recalculateTimes() {
|
||||
let currentTime = this.trainingStart; // Die Startzeit des Trainings
|
||||
this.trainingPlan.forEach((item, index) => {
|
||||
item.startTime = currentTime;
|
||||
currentTime = this.addDurationToTime(currentTime, item.duration);
|
||||
});
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
await this.init();
|
||||
|
||||
Reference in New Issue
Block a user