fix(FalukantService): update userHouse query attributes and transaction handling
All checks were successful
Deploy to production / deploy (push) Successful in 1m52s

- Modified the userHouse query to include 'id' in the attributes, improving data retrieval.
- Enhanced transaction handling in state and userHouse updates to ensure atomic operations, preventing potential data inconsistencies.
This commit is contained in:
Torsten Schulz (local)
2026-04-17 16:58:41 +02:00
parent d2eebf1f94
commit 1dd4d18927

View File

@@ -3902,7 +3902,7 @@ class FalukantService extends BaseService {
const userHouse = await UserHouse.findOne({
where: { userId: user.id },
attributes: ['householdOrder']
attributes: ['id', 'householdOrder']
});
const marriage = await Relationship.findOne({
@@ -3988,7 +3988,7 @@ class FalukantService extends BaseService {
const userHouse = await UserHouse.findOne({
where: { userId: user.id },
attributes: ['householdOrder']
attributes: ['id', 'householdOrder']
});
const productionDelayMinutes = 15;
const runningProductions = await Production.findAll({
@@ -4011,14 +4011,18 @@ class FalukantService extends BaseService {
let delayedProductions = 0;
await sequelize.transaction(async (t) => {
await state.update({
marriageSatisfaction: nextSatisfaction,
marriagePublicStability: nextPublicStability
});
await state.update(
{
marriageSatisfaction: nextSatisfaction,
marriagePublicStability: nextPublicStability
},
{ transaction: t }
);
if (userHouse && nextHouseholdOrder != null) {
await userHouse.update({
householdOrder: nextHouseholdOrder
});
await userHouse.update(
{ householdOrder: nextHouseholdOrder },
{ transaction: t }
);
}
for (const production of runningProductions) {
const startAt = new Date(production.startTimestamp);