diff --git a/backend/models/falukant/data/character.js b/backend/models/falukant/data/character.js index c4327f6..74f36e2 100644 --- a/backend/models/falukant/data/character.js +++ b/backend/models/falukant/data/character.js @@ -61,7 +61,12 @@ FalukantCharacter.init( tableName: 'character', schema: 'falukant_data', timestamps: true, - underscored: true} + underscored: true, + // Spalten erst nach Migration 20260330000000; ohne Exclude würde SELECT/INSERT auf alten DBs fehlschlagen + defaultScope: { + attributes: { exclude: ['pregnancyDueAt', 'pregnancyFatherCharacterId'] }, + }, + } ); export default FalukantCharacter; diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index 62347ac..ecfde99 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -3320,11 +3320,31 @@ class FalukantService extends BaseService { return { result: 'ok' }; } + /** Liest Schwangerschaft nur wenn DB-Spalten existieren (nach Migration). */ + async _getCharacterPregnancyOptional(characterId) { + try { + const rows = await sequelize.query( + `SELECT pregnancy_due_at, pregnancy_father_character_id + FROM falukant_data."character" WHERE id = :id`, + { replacements: { id: characterId }, type: Sequelize.QueryTypes.SELECT } + ); + const row = rows[0]; + if (!row?.pregnancy_due_at) return null; + return { + dueAt: row.pregnancy_due_at, + fatherCharacterId: row.pregnancy_father_character_id, + }; + } catch { + return null; + } + } + async getFamily(hashedUserId) { const user = await this.getFalukantUserByHashedId(hashedUserId); if (!user) throw new Error('User not found'); const character = await FalukantCharacter.findOne({ where: { userId: user.id } }); if (!character) throw new Error('Character not found for this user'); + const pregnancy = await this._getCharacterPregnancyOptional(character.id); // Load relationships without includes to avoid EagerLoadingError const relRows = await Relationship.findAll({ where: { character1Id: character.id }, @@ -3519,12 +3539,7 @@ class FalukantService extends BaseService { children: children.map(({ _createdAt, ...rest }) => rest), possiblePartners: [], possibleLovers: [], - pregnancy: character.pregnancyDueAt - ? { - dueAt: character.pregnancyDueAt, - fatherCharacterId: character.pregnancyFatherCharacterId, - } - : null, + pregnancy, }; const ownAge = calcAge(character.birthdate); if (ownAge >= 12) { diff --git a/frontend/src/i18n/locales/de/falukant.json b/frontend/src/i18n/locales/de/falukant.json index 7c34260..a603a13 100644 --- a/frontend/src/i18n/locales/de/falukant.json +++ b/frontend/src/i18n/locales/de/falukant.json @@ -536,6 +536,20 @@ }, "family": { "title": "Familie", + "heroIntro": "Beziehungen, Kinder und Entwicklung — unten nach Bereichen geordnet.", + "summary": { + "partnerChip": "Partner", + "childrenChip": "Kinder", + "loversChip": "Liebschaften", + "proposalsAvailable": "Verlobung möglich", + "noPartner": "Kein Partner" + }, + "tabs": { + "partner": "Partner & Ehe", + "children": "Kinder", + "lovers": "Liebschaften" + }, + "tabsAria": "Familienbereiche", "debtorsPrison": { "familyWarning": "Anhaltender Kreditverzug belastet Ehe, Haushalt und Liebschaften.", "familyImpact": "Der Schuldturm schadet Ehe, Hausfrieden und der Stabilität von Liebschaften." @@ -546,6 +560,7 @@ }, "spouse": { "title": "Beziehung", + "traitsToggle": "Charaktereigenschaften", "name": "Name", "age": "Alter", "status": "Status", diff --git a/frontend/src/i18n/locales/en/falukant.json b/frontend/src/i18n/locales/en/falukant.json index 86a88b2..0425433 100644 --- a/frontend/src/i18n/locales/en/falukant.json +++ b/frontend/src/i18n/locales/en/falukant.json @@ -607,6 +607,21 @@ } }, "family": { + "title": "Family", + "heroIntro": "Relationships, children and development — organized by section below.", + "summary": { + "partnerChip": "Partner", + "childrenChip": "Children", + "loversChip": "Affairs", + "proposalsAvailable": "Betrothal available", + "noPartner": "No partner" + }, + "tabs": { + "partner": "Partner & marriage", + "children": "Children", + "lovers": "Affairs" + }, + "tabsAria": "Family sections", "debtorsPrison": { "familyWarning": "Ongoing debt delinquency puts strain on marriage, household and affairs.", "familyImpact": "Debtors' prison damages marriage, household peace and the stability of affairs." @@ -653,6 +668,7 @@ } }, "spouse": { + "traitsToggle": "Character traits", "marriageSatisfaction": "Marriage Satisfaction", "marriageState": "Marriage State", "wooing": { diff --git a/frontend/src/i18n/locales/es/falukant.json b/frontend/src/i18n/locales/es/falukant.json index 0618596..f4c8e4a 100644 --- a/frontend/src/i18n/locales/es/falukant.json +++ b/frontend/src/i18n/locales/es/falukant.json @@ -517,6 +517,20 @@ }, "family": { "title": "Familia", + "heroIntro": "Relaciones, hijos y desarrollo — ordenado por secciones abajo.", + "summary": { + "partnerChip": "Pareja", + "childrenChip": "Hijos", + "loversChip": "Relaciones", + "proposalsAvailable": "Compromiso posible", + "noPartner": "Sin pareja" + }, + "tabs": { + "partner": "Pareja y matrimonio", + "children": "Hijos", + "lovers": "Relaciones" + }, + "tabsAria": "Secciones de familia", "debtorsPrison": { "familyWarning": "La mora continuada perjudica el matrimonio, el hogar y las relaciones.", "familyImpact": "La prisión por deudas daña el matrimonio, la paz del hogar y la estabilidad de las relaciones." @@ -527,6 +541,7 @@ }, "spouse": { "title": "Relación", + "traitsToggle": "Rasgos de carácter", "name": "Nombre", "age": "Edad", "status": "Estado", diff --git a/frontend/src/views/falukant/FamilyView.vue b/frontend/src/views/falukant/FamilyView.vue index 5975aed..91d2725 100644 --- a/frontend/src/views/falukant/FamilyView.vue +++ b/frontend/src/views/falukant/FamilyView.vue @@ -7,7 +7,7 @@
Beziehungen, Kinder und familiäre Entwicklung in einer eigenen Spielweltansicht.
+{{ $t('falukant.family.heroIntro') }}
| {{ $t('falukant.family.relationships.name') }} | -
+
+ |
-
| {{ $t('falukant.family.spouse.age') }} | -{{ relationships[0].character2.age }} | -
| {{ $t('falukant.family.spouse.mood') }} | -{{ relationships[0].character2.mood?.tr ? $t(`falukant.mood.${relationships[0].character2.mood.tr}`) : '—' }} | -
| {{ $t('falukant.family.spouse.status') }} | -{{ $t('falukant.family.statuses.' + relationships[0].relationshipType) }} | -
| {{ $t('falukant.family.spouse.marriageSatisfaction') }} | -
+
+
+
+
+
+
+
+
+
+ |
-
| {{ $t('falukant.family.spouse.progress') }} | -
+
+
+
+ |
-
{{ $t('falukant.family.children.none') }}
{{ $t('falukant.family.lovers.candidates.none') }}