refactor a ton of the admin room code (50% done)

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-20 19:13:18 -04:00 committed by June
parent 6b28bd5ae7
commit 0cf368a327
20 changed files with 1002 additions and 935 deletions

View file

@ -32,7 +32,7 @@ pub(crate) enum AccountData {
}
/// All the getters and iterators from src/database/key_value/account_data.rs
pub(crate) async fn account_data(subcommand: AccountData) -> Result<RoomMessageEventContent> {
pub(super) async fn account_data(subcommand: AccountData) -> Result<RoomMessageEventContent> {
match subcommand {
AccountData::ChangesSince {
user_id,

View file

@ -15,7 +15,7 @@ pub(crate) enum Appservice {
}
/// All the getters and iterators from src/database/key_value/appservice.rs
pub(crate) async fn appservice(subcommand: Appservice) -> Result<RoomMessageEventContent> {
pub(super) async fn appservice(subcommand: Appservice) -> Result<RoomMessageEventContent> {
match subcommand {
Appservice::GetRegistration {
appservice_id,

View file

@ -23,7 +23,7 @@ pub(crate) enum Globals {
}
/// All the getters and iterators from src/database/key_value/globals.rs
pub(crate) async fn globals(subcommand: Globals) -> Result<RoomMessageEventContent> {
pub(super) async fn globals(subcommand: Globals) -> Result<RoomMessageEventContent> {
match subcommand {
Globals::DatabaseVersion => {
let timer = tokio::time::Instant::now();

View file

@ -44,11 +44,11 @@ pub(crate) enum QueryCommand {
/// Processes admin query commands
#[allow(non_snake_case)]
pub(crate) async fn process(command: QueryCommand, _body: Vec<&str>) -> Result<RoomMessageEventContent> {
match command {
QueryCommand::AccountData(AccountData) => account_data(AccountData).await,
QueryCommand::Appservice(Appservice) => appservice(Appservice).await,
QueryCommand::Presence(Presence) => presence(Presence).await,
QueryCommand::RoomAlias(RoomAlias) => room_alias(RoomAlias).await,
QueryCommand::Globals(Globals) => globals(Globals).await,
}
Ok(match command {
QueryCommand::AccountData(AccountData) => account_data(AccountData).await?,
QueryCommand::Appservice(Appservice) => appservice(Appservice).await?,
QueryCommand::Presence(Presence) => presence(Presence).await?,
QueryCommand::RoomAlias(RoomAlias) => room_alias(RoomAlias).await?,
QueryCommand::Globals(Globals) => globals(Globals).await?,
})
}

View file

@ -22,7 +22,7 @@ pub(crate) enum Presence {
}
/// All the getters and iterators in key_value/presence.rs
pub(crate) async fn presence(subcommand: Presence) -> Result<RoomMessageEventContent> {
pub(super) async fn presence(subcommand: Presence) -> Result<RoomMessageEventContent> {
match subcommand {
Presence::GetPresence {
user_id,

View file

@ -23,7 +23,7 @@ pub(crate) enum RoomAlias {
}
/// All the getters and iterators in src/database/key_value/rooms/alias.rs
pub(crate) async fn room_alias(subcommand: RoomAlias) -> Result<RoomMessageEventContent> {
pub(super) async fn room_alias(subcommand: RoomAlias) -> Result<RoomMessageEventContent> {
match subcommand {
RoomAlias::ResolveLocalAlias {
alias,