diff --git a/backend/models/falukant/data/weather.js b/backend/models/falukant/data/weather.js index 105f7d4..c38cdcf 100644 --- a/backend/models/falukant/data/weather.js +++ b/backend/models/falukant/data/weather.js @@ -9,13 +9,13 @@ Weather.init( { regionId: { type: DataTypes.INTEGER, + primaryKey: true, allowNull: false, references: { model: RegionData, key: 'id', schema: 'falukant_data' - }, - unique: true // Jede Stadt hat nur ein Wetter + } }, weatherTypeId: { type: DataTypes.INTEGER, diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index ed7421f..cc1dccd 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -493,6 +493,7 @@ class FalukantService extends BaseService { { model: Weather, as: 'weather', + attributes: ['regionId', 'weatherTypeId'], include: [ { model: WeatherType, as: 'weatherType', attributes: ['tr'] } ], @@ -3146,13 +3147,18 @@ class FalukantService extends BaseService { throw new Error('no money'); } user.character.health -= activityObject.cost; + const healthChange = await this[activityObject.method](user); await HealthActivity.create({ characterId: user.character.id, activityTr: activity, - successPercentage: await this[activityObject.method](user), + successPercentage: healthChange, cost: activityObject.cost }); updateFalukantUserMoney(user.id, -activityObject.cost, 'health.' + activity); + + // Status-Update Notification senden + notifyUser(user.user.hashedId, 'falukantUpdateStatus', {}); + return { success: true }; } diff --git a/frontend/src/views/falukant/MoneyHistoryView.vue b/frontend/src/views/falukant/MoneyHistoryView.vue index fc43292..2e7f6e9 100644 --- a/frontend/src/views/falukant/MoneyHistoryView.vue +++ b/frontend/src/views/falukant/MoneyHistoryView.vue @@ -21,7 +21,7 @@