style: cargo fmt after Phase A
Whitespace + import-grouping fixups in the 9 SDK modules touched by F-Q-002. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,12 +42,12 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::bridge::block_on;
|
||||
use picloud_shared::{
|
||||
AppUser, AppUserId, CreateUserInput, EmailTemplateOpts, GeneratedAccept, GeneratedSession,
|
||||
InviteOpts, SdkCallCx, Services, UpdateUserInput, UsersListOpts, UsersListPage, UsersService,
|
||||
};
|
||||
use rhai::{Array, Dynamic, Engine as RhaiEngine, EvalAltResult, Map, Module};
|
||||
use super::bridge::block_on;
|
||||
|
||||
pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc<SdkCallCx>) {
|
||||
let svc = services.users.clone();
|
||||
@@ -198,8 +198,9 @@ fn bind_list(module: &mut Module, svc: &Arc<dyn UsersService>, cx: &Arc<SdkCallC
|
||||
};
|
||||
let svc = svc.clone();
|
||||
let cx = cx.clone();
|
||||
let page: UsersListPage =
|
||||
block_on("users", async move { svc.list(&cx, UsersListOpts { cursor, limit }).await })?;
|
||||
let page: UsersListPage = block_on("users", async move {
|
||||
svc.list(&cx, UsersListOpts { cursor, limit }).await
|
||||
})?;
|
||||
Ok(list_page_to_map(&page))
|
||||
},
|
||||
);
|
||||
@@ -220,7 +221,10 @@ fn bind_login(module: &mut Module, svc: &Arc<dyn UsersService>, cx: &Arc<SdkCall
|
||||
let svc = svc.clone();
|
||||
let cx = cx.clone();
|
||||
let session_opt: Option<GeneratedSession> =
|
||||
block_on("users", async move { svc.login(&cx, &email, &password).await })?;
|
||||
block_on(
|
||||
"users",
|
||||
async move { svc.login(&cx, &email, &password).await },
|
||||
)?;
|
||||
Ok(session_opt.map_or(Dynamic::UNIT, |s| Dynamic::from(s.token)))
|
||||
},
|
||||
);
|
||||
@@ -273,7 +277,9 @@ fn bind_send_verification_email(
|
||||
let opts = parse_email_template(&opts, "users::send_verification_email")?;
|
||||
let svc = svc.clone();
|
||||
let cx = cx.clone();
|
||||
block_on("users", async move { svc.send_verification_email(&cx, id, opts).await })
|
||||
block_on("users", async move {
|
||||
svc.send_verification_email(&cx, id, opts).await
|
||||
})
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -307,7 +313,9 @@ fn bind_request_password_reset(
|
||||
let opts = parse_email_template(&opts, "users::request_password_reset")?;
|
||||
let svc = svc.clone();
|
||||
let cx = cx.clone();
|
||||
block_on("users", async move { svc.request_password_reset(&cx, &email, opts).await })
|
||||
block_on("users", async move {
|
||||
svc.request_password_reset(&cx, &email, opts).await
|
||||
})
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -365,8 +373,9 @@ fn bind_accept_invite(module: &mut Module, svc: &Arc<dyn UsersService>, cx: &Arc
|
||||
let password = password.to_string();
|
||||
let svc = svc.clone();
|
||||
let cx = cx.clone();
|
||||
let accept_opt: Option<GeneratedAccept> =
|
||||
block_on("users", async move { svc.accept_invite(&cx, &token, &password, None).await })?;
|
||||
let accept_opt: Option<GeneratedAccept> = block_on("users", async move {
|
||||
svc.accept_invite(&cx, &token, &password, None).await
|
||||
})?;
|
||||
Ok(accept_opt.map_or(Dynamic::UNIT, |a| Dynamic::from(a.session.token)))
|
||||
},
|
||||
);
|
||||
@@ -428,7 +437,10 @@ fn bind_remove_role(module: &mut Module, svc: &Arc<dyn UsersService>, cx: &Arc<S
|
||||
let role = role.to_string();
|
||||
let svc = svc.clone();
|
||||
let cx = cx.clone();
|
||||
block_on("users", async move { svc.remove_role(&cx, id, &role).await })
|
||||
block_on(
|
||||
"users",
|
||||
async move { svc.remove_role(&cx, id, &role).await },
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -586,4 +598,3 @@ fn optional_string(opts: &Map, key: &str) -> Option<String> {
|
||||
fn runtime_err(msg: &str) -> Box<EvalAltResult> {
|
||||
EvalAltResult::ErrorRuntime(msg.into(), rhai::Position::NONE).into()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user