Refactor association keys in setupAssociations: Update foreign key naming conventions in Party and TitleOfNobility associations for consistency and clarity. Enhance error handling in FalukantService to ensure party ID is present before adding invited nobilities.

This commit is contained in:
Torsten Schulz (local)
2026-01-29 09:05:38 +01:00
parent be3ed4af5d
commit c570fd6ae3
2 changed files with 8 additions and 4 deletions

View File

@@ -3225,6 +3225,10 @@ class FalukantService extends BaseService {
cost: cost
});
if (nobilities.length > 0) {
// Stelle sicher, dass die Party eine ID hat
if (!party.id) {
throw new Error('Party wurde erstellt, hat aber keine ID');
}
// Verwende die bereits geladenen Objekte
await party.addInvitedNobilities(nobilities);
}