cleanup at death
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 4m44s

This commit is contained in:
Torsten Schulz (local)
2026-11-04 15:14:08 +01:00
parent 30f5c22974
commit da2b32e877
5 changed files with 124 additions and 9 deletions

View File

@@ -420,12 +420,14 @@ impl CharacterCreationWorker {
let tr = death_ctx.as_ref().map(|c| {
death_log::wrap_death_notification(c, "director_death", user_id)
});
Self::notify_user(
if let Err(e) = Self::notify_user(
pool,
broker,
user_id,
tr.as_deref().unwrap_or("director_death"),
)?;
) {
eprintln!("[CharacterCreationWorker] Todesbenachrichtigung: {e}");
}
}
// 2) Relationships löschen und betroffene User benachrichtigen
@@ -439,12 +441,14 @@ impl CharacterCreationWorker {
let tr = death_ctx.as_ref().map(|c| {
death_log::wrap_death_notification(c, "relationship_death", related_user_id)
});
Self::notify_user(
if let Err(e) = Self::notify_user(
pool,
broker,
related_user_id,
tr.as_deref().unwrap_or("relationship_death"),
)?;
) {
eprintln!("[CharacterCreationWorker] Todesbenachrichtigung: {e}");
}
}
}
@@ -461,12 +465,14 @@ impl CharacterCreationWorker {
let tr = death_ctx.as_ref().map(|c| {
death_log::wrap_death_notification(c, "child_death", father_user_id)
});
Self::notify_user(
if let Err(e) = Self::notify_user(
pool,
broker,
father_user_id,
tr.as_deref().unwrap_or("child_death"),
)?;
) {
eprintln!("[CharacterCreationWorker] Todesbenachrichtigung: {e}");
}
}
if let Some(mother_user_id) = row
.get("mother_user_id")
@@ -475,12 +481,14 @@ impl CharacterCreationWorker {
let tr = death_ctx.as_ref().map(|c| {
death_log::wrap_death_notification(c, "child_death", mother_user_id)
});
Self::notify_user(
if let Err(e) = Self::notify_user(
pool,
broker,
mother_user_id,
tr.as_deref().unwrap_or("child_death"),
)?;
) {
eprintln!("[CharacterCreationWorker] Todesbenachrichtigung: {e}");
}
}
}

View File

@@ -983,7 +983,7 @@ pub const QUERY_DELETE_CHILD_RELATION: &str = r#"
WITH deleted AS (
DELETE FROM falukant_data.child_relation WHERE child_character_id = $1 RETURNING father_character_id, mother_character_id
)
SELECT cf.user_id AS father_user_id, cm.user_id AS mother_user_id FROM deleted d JOIN falukant_data.character cf ON cf.id = d.father_character_id JOIN falukant_data.character cm ON cm.id = d.mother_character_id;
SELECT cf.user_id AS father_user_id, cm.user_id AS mother_user_id FROM deleted d LEFT JOIN falukant_data.character cf ON cf.id = d.father_character_id LEFT JOIN falukant_data.character cm ON cm.id = d.mother_character_id;
"#;
/// Entfernt alle child_relation-Zeilen, in denen der Charakter Vater oder Mutter ist (nötig vor Charakter-Löschung).