Ensure that the player uuid and character id both match in a character deletion query.

This commit is contained in:
Shane Handley 2020-05-31 04:31:31 +10:00
parent 8667d5a815
commit 84d0332c6d

View File

@ -144,7 +144,12 @@ pub fn create_character(
pub fn delete_character(uuid: &str, character_id: i32, db_dir: &str) -> CharacterListResult {
use schema::character::dsl::*;
diesel::delete(character.filter(id.eq(character_id))).execute(&establish_connection(db_dir))?;
diesel::delete(
character
.filter(id.eq(character_id))
.filter(player_uuid.eq(uuid)),
)
.execute(&establish_connection(db_dir))?;
load_character_list(uuid, db_dir)
}