fix(room): accept comma-separated message_ids string in batch reaction endpoint

This commit is contained in:
ZhenYi 2026-04-17 22:28:24 +08:00
parent 7152346be8
commit 0cbf6d6aa1

View File

@ -20,7 +20,8 @@ pub struct MessageSearchQuery {
#[derive(Debug, serde::Deserialize, IntoParams)]
pub struct ReactionBatchQuery {
pub message_ids: Vec<Uuid>,
/// Comma-separated list of message IDs
pub message_ids: String,
}
#[utoipa::path(
@ -148,9 +149,14 @@ pub async fn reaction_batch(
.user()
.ok_or_else(|| ApiError::from(service::error::AppError::Unauthorized))?;
let ctx = WsUserContext::new(user_id);
let message_ids: Vec<Uuid> = query
.message_ids
.split(',')
.filter_map(|s| Uuid::parse_str(s.trim()).ok())
.collect();
let resp = service
.room
.message_reactions_batch(room_id, query.into_inner().message_ids, &ctx)
.message_reactions_batch(room_id, message_ids, &ctx)
.await
.map_err(ApiError::from)?;
Ok(ApiResponse::ok(resp).to_response())