fix(room): accept comma-separated message_ids string in batch reaction endpoint
This commit is contained in:
parent
7152346be8
commit
0cbf6d6aa1
@ -20,7 +20,8 @@ pub struct MessageSearchQuery {
|
|||||||
|
|
||||||
#[derive(Debug, serde::Deserialize, IntoParams)]
|
#[derive(Debug, serde::Deserialize, IntoParams)]
|
||||||
pub struct ReactionBatchQuery {
|
pub struct ReactionBatchQuery {
|
||||||
pub message_ids: Vec<Uuid>,
|
/// Comma-separated list of message IDs
|
||||||
|
pub message_ids: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
@ -148,9 +149,14 @@ pub async fn reaction_batch(
|
|||||||
.user()
|
.user()
|
||||||
.ok_or_else(|| ApiError::from(service::error::AppError::Unauthorized))?;
|
.ok_or_else(|| ApiError::from(service::error::AppError::Unauthorized))?;
|
||||||
let ctx = WsUserContext::new(user_id);
|
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
|
let resp = service
|
||||||
.room
|
.room
|
||||||
.message_reactions_batch(room_id, query.into_inner().message_ids, &ctx)
|
.message_reactions_batch(room_id, message_ids, &ctx)
|
||||||
.await
|
.await
|
||||||
.map_err(ApiError::from)?;
|
.map_err(ApiError::from)?;
|
||||||
Ok(ApiResponse::ok(resp).to_response())
|
Ok(ApiResponse::ok(resp).to_response())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user