- add: ability to refresh the current session

- add: delete type to delete character request
- add: ability to update key in redis
- add: handle alive packet to refresh the session
- fix: delete now actually returns the time remaining correctly
- fix: character list now has the correct time until character deletion
This commit is contained in:
2025-01-08 02:03:27 -05:00
parent 584892ab97
commit 6d35d15ac3
16 changed files with 158 additions and 25 deletions

View File

@@ -38,7 +38,7 @@ impl CharacterService for MyCharacterService {
character_id: character.id.to_string(),
name: character.name,
last_played: 0,
delete_time: 0,
delete_time: character.deleted_at.parse().unwrap_or_default(),
stats: serde_json::from_str(&character.stats).unwrap(),
looks: serde_json::from_str(&character.looks).unwrap(),
items: serde_json::from_str(&character.inventory).unwrap(),
@@ -66,7 +66,7 @@ impl CharacterService for MyCharacterService {
let req = request.into_inner();
debug!("{:?}", req);
let delete_character_response = self.character_db_client.as_ref().clone().delete_character(&req.user_id, &req.char_id).await.map_err(|_| Status::not_found("Character not found"))?;
let delete_character_response = self.character_db_client.as_ref().clone().delete_character(&req.user_id, &req.char_id, req.delete_type).await.map_err(|_| Status::not_found("Character not found"))?;
let response = DeleteCharacterResponse { remaining_time: delete_character_response.remaining_time, name: delete_character_response.name };
Ok(Response::new(response))
}