Enhance weather model and service logic; improve money history translation handling
- Added primary key to the Weather model for better data integrity. - Updated FalukantService to include specific weather attributes in queries, enhancing data retrieval. - Refactored money history view to utilize a dedicated translation method for improved localization handling.
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user