Update primary key constraints in promotional gift models: Set giftId and traitId as primary keys in PromotionalGiftCharacterTrait and PromotionalGiftMood models to ensure data integrity. Enhance FalukantService to load character traits and user house data with separate queries, improving performance and preventing EagerLoadingError.

This commit is contained in:
Torsten Schulz (local)
2026-02-04 15:05:19 +01:00
parent db6ddb4af7
commit 4fa831d586
3 changed files with 41 additions and 22 deletions

View File

@@ -10,12 +10,14 @@ PromotionalGiftCharacterTrait.init(
giftId: {
type: DataTypes.INTEGER,
field: 'gift_id',
allowNull: false
allowNull: false,
primaryKey: true
},
traitId: {
type: DataTypes.INTEGER,
field: 'trait_id',
allowNull: false
allowNull: false,
primaryKey: true
},
suitability: {
type: DataTypes.INTEGER,

View File

@@ -10,12 +10,14 @@ PromotionalGiftMood.init(
giftId: {
type: DataTypes.INTEGER,
field: 'gift_id',
allowNull: false
allowNull: false,
primaryKey: true
},
moodId: {
type: DataTypes.INTEGER,
field: 'mood_id',
allowNull: false
allowNull: false,
primaryKey: true
},
suitability: {
type: DataTypes.INTEGER,