fix: publish nothing should result in error
This commit is contained in:
parent
4f8c6fef81
commit
c185063847
|
|
@ -1223,7 +1223,9 @@ async fn post_publish_collabs_handler(
|
|||
}
|
||||
|
||||
if accumulator.is_empty() {
|
||||
return Ok(Json(AppResponse::Ok()));
|
||||
return Err(
|
||||
AppError::InvalidRequest(String::from("did not receive any data to publish")).into(),
|
||||
);
|
||||
}
|
||||
biz::workspace::ops::publish_collabs(&state.pg_pool, &workspace_id, &user_uuid, &accumulator)
|
||||
.await?;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,16 @@ async fn test_publish_doc() {
|
|||
let view_id_1 = uuid::Uuid::new_v4();
|
||||
let publish_name_2 = "publish-name-2";
|
||||
let view_id_2 = uuid::Uuid::new_v4();
|
||||
|
||||
{
|
||||
// cannot publish nothing
|
||||
let err = c
|
||||
.publish_collabs::<MyCustomMetadata, &[u8]>(&workspace_id, vec![])
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(err.code, ErrorCode::InvalidRequest);
|
||||
}
|
||||
|
||||
c.publish_collabs::<MyCustomMetadata, &[u8]>(
|
||||
&workspace_id,
|
||||
vec![
|
||||
|
|
|
|||
Loading…
Reference in New Issue