feat(AdminController, AdminService, AdminRouter, localization): add character death cleanup feature
All checks were successful
Deploy to production / deploy (push) Successful in 1m52s
All checks were successful
Deploy to production / deploy (push) Successful in 1m52s
- Implemented `adminCleanupCharacterDeathArtifacts` method in AdminService to remove stale character-bound data after death/inheritance, including knowledge, debtors prism, and political offices. - Added corresponding route in AdminRouter for triggering the cleanup process via an API endpoint. - Enhanced AdminController to handle requests for the new cleanup feature, ensuring proper error handling and response formatting. - Updated frontend components to include a user interface for initiating the cleanup, with localization support in both English and German for improved user experience.
This commit is contained in:
@@ -244,6 +244,14 @@
|
||||
"force": "Geburt auslösen",
|
||||
"success": "Kind wurde angelegt (Taufe ausstehend).",
|
||||
"error": "Geburt konnte nicht ausgelöst werden."
|
||||
},
|
||||
"deathCleanup": {
|
||||
"title": "Tod/Erbe-Aufräumen (Admin)",
|
||||
"hint": "Entfernt veraltete charaktergebundene Daten nach Tod/Erbe (Wissen, Schuldnerkartei, politische Ämter inkl. Archiv, Wahlkandidatur).",
|
||||
"action": "Cleanup ausführen",
|
||||
"confirm": "Diesen Cleanup für den aktuellen Charakter jetzt ausführen?",
|
||||
"success": "Cleanup erfolgreich ausgeführt.",
|
||||
"error": "Cleanup konnte nicht ausgeführt werden."
|
||||
}
|
||||
},
|
||||
"map": {
|
||||
|
||||
@@ -299,6 +299,14 @@
|
||||
"force": "Trigger birth",
|
||||
"success": "Child created (baptism pending).",
|
||||
"error": "Could not trigger birth."
|
||||
},
|
||||
"deathCleanup": {
|
||||
"title": "Death/inheritance cleanup (admin)",
|
||||
"hint": "Removes stale character-bound data after death/inheritance (knowledge, debtors prism, political offices incl. archive, election candidacy).",
|
||||
"action": "Run cleanup",
|
||||
"confirm": "Run this cleanup for the current character now?",
|
||||
"success": "Cleanup completed successfully.",
|
||||
"error": "Cleanup failed."
|
||||
}
|
||||
},
|
||||
"createNPC": {
|
||||
|
||||
@@ -128,6 +128,14 @@
|
||||
<div class="action-buttons">
|
||||
<button type="button" @click="adminForceBirth">{{ $t('admin.falukant.edituser.birth.force') }}</button>
|
||||
</div>
|
||||
|
||||
<h4>{{ $t('admin.falukant.edituser.deathCleanup.title') }}</h4>
|
||||
<p class="admin-family-tools__hint">{{ $t('admin.falukant.edituser.deathCleanup.hint') }}</p>
|
||||
<div class="action-buttons">
|
||||
<button type="button" class="button-secondary" @click="adminCleanupDeathArtifacts">
|
||||
{{ $t('admin.falukant.edituser.deathCleanup.action') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action-buttons">
|
||||
@@ -567,6 +575,22 @@ export default {
|
||||
} catch (error) {
|
||||
showApiError(this, error, 'tr:admin.falukant.edituser.birth.error');
|
||||
}
|
||||
},
|
||||
async adminCleanupDeathArtifacts() {
|
||||
const characterId = this.editableUser?.falukantData?.[0]?.character?.id;
|
||||
if (!characterId) {
|
||||
return;
|
||||
}
|
||||
if (!window.confirm(this.$t('admin.falukant.edituser.deathCleanup.confirm'))) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await apiClient.post(`/api/admin/falukant/character/${characterId}/death-cleanup`);
|
||||
showSuccess(this, 'tr:admin.falukant.edituser.deathCleanup.success');
|
||||
await this.refreshEditableUser();
|
||||
} catch (error) {
|
||||
showApiError(this, error, 'tr:admin.falukant.edituser.deathCleanup.error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user