Skip to main content

Admin

Type Alias Admin 

Source
pub type Admin = Player;
Expand description

Represents an admin user.

Aliased Type§

pub struct Admin {
Show 24 fields pub id: String, pub name: String, pub surname: String, pub bio: String, pub pronouns: String, pub alias: String, pub niu: String, pub email: String, pub phone: String, pub faculty: String, pub isuab: bool, pub how_did_you_hear_about_us: String, pub social_media: Option<String>, pub password: String, pub player_number: i32, pub state: PlayerState, pub role: PlayerRole, pub birth_date: NaiveDate, pub accept_info_other_editions: bool, pub next_feeding: Option<CustomDateTime>, pub last_login: Option<NaiveDateTime>, pub checkpoint: Option<NaiveDateTime>, pub wants_to_be_zombie: i32, pub register_date: Option<NaiveDateTime>,
}

Fields§

§id: String§name: String§surname: String§bio: String§pronouns: String§alias: String§niu: String§email: String§phone: String§faculty: String§isuab: bool§how_did_you_hear_about_us: String§social_media: Option<String>§password: String§player_number: i32§state: PlayerState§role: PlayerRole§birth_date: NaiveDate§accept_info_other_editions: bool§next_feeding: Option<CustomDateTime>§last_login: Option<NaiveDateTime>§checkpoint: Option<NaiveDateTime>§wants_to_be_zombie: i32§register_date: Option<NaiveDateTime>

Implementations§

Source§

impl Admin

Source

pub async fn recover_password( &self, username: String, password: String, ) -> Result<(), String>

Allows an admin to recover a player’s password.

§Arguments
  • username - The username of the player to recover the password for.
  • password - The new password to set for the player.
§Returns
  • Ok(()) if the password was successfully recovered.
  • Err(String) if an error occurred.
Source

pub async fn count_player(&self) -> Result<String, String>

Returns the number of players of each possible player state.

§Returns
  • Ok(String) if the count was successfully retrieved.
  • Err(String) if an error occurred.
Source

pub async fn admin_get_players(&self) -> Result<Vec<Player>, String>

Get all players for admins

§Returns
  • Ok(Vec<Player>) if the players were successfully retrieved.
  • Err(String) if an error occurred.
Source

pub async fn feed_players(&self, n: i32) -> Result<String, String>

Feeds a certain amount of players

§Arguments
  • n - The amount of players to feed.
§Returns
  • Ok(String) if the players were successfully fed.
  • Err(String) if an error occurred.
Source

pub async fn admin_feed(&self, id: String) -> Result<String, String>

Feeds a single player.

§Arguments
  • id - The ID of the player to feed.
§Returns
  • Ok(String) if the player was successfully fed.
  • Err(String) if an error occurred.
Source

pub async fn feed_zombies_day(&self) -> Result<String, String>

Adds a day to the zombies’ feeding time.

§Returns
  • Ok(String) if the zombies were successfully fed.
  • Err(String) if an error occurred.
Source

pub async fn cure(&self, id: String) -> Result<String, String>

Cures a player.

§Arguments
  • id - The ID of the player to cure.
§Returns
  • Ok(String) if the player was successfully cured.
  • Err(String) if an error occurred.
Source

pub async fn transform( &self, alias: String, state: PlayerState, ) -> Result<String, String>

Transforms a player into a certain state.

§Arguments
  • alias - The alias of the player to transform.
  • state - The state to transform the player into.
§Returns
  • Ok(String) if the player was successfully transformed.
  • Err(String) if an error occurred.
Source

pub async fn set_checkpoint( &self, x: String, y: String, ) -> Result<String, String>

Sets the checkpoint coordinates.

§Arguments
  • coordinates - The coordinates to set as the checkpoint.
§Returns
  • Ok(String) if the checkpoint was successfully set.
  • Err(String) if an error occurred.
Source

pub async fn player_at_checkpoint( &self, player_id: String, ) -> Result<String, String>

Sets a player passing through the checkpoint

§Arguments
  • player_id (player that is at checkpoint)
§Returns
  • Ok(String) if the player was registered at the checkpoint successfully.
  • Err(String) if an error occurred.
Source

pub async fn kill_all_not_at_checkpoint(&self) -> Result<String, String>

Kills all players did not go through the checkpoint.

§Returns
  • Ok(String) if the players were killed successfully.
  • Err(String) if an error occurred.
Source

pub async fn inject_sql(&self, sql_command: String) -> Result<String, String>

Allows an admin to inject SQL commands.

§Arguments
  • sql_command - The SQL command to execute.
§Returns
  • Ok(String) if the SQL command was successfully executed.
  • Err(String) if an error occurred.
Source

pub async fn get_logs(&self) -> Result<String, String>

Retrieves the logs from the application.

§Returns
  • Ok(String) if the logs were successfully retrieved.
  • Err(String) if an error occurred.