Add product price history model and database schema: Implement associations for ProductPriceHistory with ProductType and RegionData. Update FalukantService to utilize active character for user-related operations. Ensure product price history table exists in the database with appropriate structure and indexing.

This commit is contained in:
Torsten Schulz (local)
2026-02-04 09:02:51 +01:00
parent ce34bae16a
commit 14775eb556
5 changed files with 80 additions and 8 deletions

View File

@@ -2901,9 +2901,9 @@ class FalukantService extends BaseService {
}
async getGifts(hashedUserId) {
// 1) Mein User & Character
// 1) Mein aktiver Falukant-User & dessen aktueller Charakter
const user = await this.getFalukantUserByHashedId(hashedUserId);
const myChar = await FalukantCharacter.findOne({ where: { userId: user.id } });
const myChar = user.character;
if (!myChar) throw new Error('Character not found');
// 2) Beziehung finden und „anderen“ Character bestimmen
@@ -3520,12 +3520,10 @@ class FalukantService extends BaseService {
async baptise(hashedUserId, childId, firstName) {
try {
const falukantUser = await getFalukantUserOrFail(hashedUserId);
const parentCharacter = await FalukantCharacter.findOne({
where: {
userId: falukantUser.id,
},
});
// Nutze den aktuell aktiven Charakter (wie in getFalukantUserByHashedId definiert),
// statt „irgendeinen“ Charakter des Users per userId zu suchen.
const falukantUser = await this.getFalukantUserByHashedId(hashedUserId);
const parentCharacter = falukantUser.character;
if (!parentCharacter) {
throw new Error('Parent character not found');
}