Add group_list_members command (Groups p4 M4 backend)
Wraps SyncKitClient::list_members so the admin panel can list a group's
members and pick who to remove. Registered in all_commands!.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 files changed,
+34 insertions,
-0 deletions
| 80 |
80 |
|
.collect())
|
| 81 |
81 |
|
}
|
| 82 |
82 |
|
|
|
83 |
+ |
/// One group member, for the admin panel.
|
|
84 |
+ |
#[derive(Debug, Serialize)]
|
|
85 |
+ |
#[serde(rename_all = "camelCase")]
|
|
86 |
+ |
pub struct GroupMemberDto {
|
|
87 |
+ |
pub user_id: String,
|
|
88 |
+ |
pub role: String,
|
|
89 |
+ |
pub added_at: String,
|
|
90 |
+ |
}
|
|
91 |
+ |
|
|
92 |
+ |
/// List a group's members (admin only) — the admin panel uses this to show who
|
|
93 |
+ |
/// can be removed.
|
|
94 |
+ |
#[tauri::command]
|
|
95 |
+ |
#[instrument(skip_all)]
|
|
96 |
+ |
pub async fn group_list_members(
|
|
97 |
+ |
state: State<'_, Arc<AppState>>,
|
|
98 |
+ |
group_id: String,
|
|
99 |
+ |
) -> Result<Vec<GroupMemberDto>, ApiError> {
|
|
100 |
+ |
let client = require_client(&state)?;
|
|
101 |
+ |
let group = GroupId::new(parse_uuid("group id", &group_id)?);
|
|
102 |
+ |
let members = client
|
|
103 |
+ |
.list_members(group)
|
|
104 |
+ |
.await
|
|
105 |
+ |
.map_api_err("Failed to list members", ApiError::external_service)?;
|
|
106 |
+ |
Ok(members
|
|
107 |
+ |
.into_iter()
|
|
108 |
+ |
.map(|m| GroupMemberDto {
|
|
109 |
+ |
user_id: m.user_id.to_string(),
|
|
110 |
+ |
role: m.role,
|
|
111 |
+ |
added_at: m.added_at.to_rfc3339(),
|
|
112 |
+ |
})
|
|
113 |
+ |
.collect())
|
|
114 |
+ |
}
|
|
115 |
+ |
|
| 83 |
116 |
|
/// This user's identity public key (base64), to share with a group admin so they
|
| 84 |
117 |
|
/// can add you (the paste-a-public-key model).
|
| 85 |
118 |
|
#[tauri::command]
|
| 266 |
266 |
|
// Groups (shared workspaces)
|
| 267 |
267 |
|
$crate::commands::group_create,
|
| 268 |
268 |
|
$crate::commands::group_list,
|
|
269 |
+ |
$crate::commands::group_list_members,
|
| 269 |
270 |
|
$crate::commands::my_group_pubkey,
|
| 270 |
271 |
|
$crate::commands::group_add_member,
|
| 271 |
272 |
|
$crate::commands::group_remove_member,
|