Implement cooldown feature for nobility advancement

- Added logic in FalukantService to calculate the next available advancement date based on the user's last advancement.
- Updated the frontend to display a cooldown message indicating when the user can next advance in nobility.
- Enhanced the NobilityView component to handle and format the next advancement date appropriately.
This commit is contained in:
Torsten Schulz (local)
2025-11-26 17:23:54 +01:00
parent c1b69389c6
commit 608e62c2bd
4 changed files with 28 additions and 4 deletions

View File

@@ -2907,6 +2907,13 @@ class FalukantService extends BaseService {
],
attributes: ['labelTr', 'level']
});
let nextAdvanceAt = null;
if (falukantUser.lastNobilityAdvanceAt) {
const last = new Date(falukantUser.lastNobilityAdvanceAt);
const next = new Date(last.getTime());
next.setDate(next.getDate() + 7);
nextAdvanceAt = next.toISOString();
}
const currentTitleLevel = nobility.level;
const nextTitle = await TitleOfNobility.findOne({
where: {
@@ -2922,7 +2929,8 @@ class FalukantService extends BaseService {
});
return {
current: nobility,
next: nextTitle
next: nextTitle,
nextAdvanceAt
};
}