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 b11301689c
commit 9a0211a8d6
2 changed files with 8 additions and 4 deletions

View File

@@ -569,14 +569,14 @@ export default function setupAssociations() {
Party.belongsToMany(TitleOfNobility, {
through: PartyInvitedNobility,
foreignKey: 'party_id',
otherKey: 'title_of_nobility_id',
foreignKey: 'partyId',
otherKey: 'titleOfNobilityId',
as: 'invitedNobilities',
});
TitleOfNobility.belongsToMany(Party, {
through: PartyInvitedNobility,
foreignKey: 'title_of_nobility_id',
otherKey: 'party_id',
foreignKey: 'titleOfNobilityId',
otherKey: 'partyId',
as: 'partiesInvitedTo',
});