From cf38d2602da4af2057414c1de36553dd57d527e4 Mon Sep 17 00:00:00 2001 From: skeptrune Date: Mon, 5 Aug 2024 19:36:33 -0700 Subject: [PATCH] cleanup: always return the correct OpenAPI spec specified reponse for create_groups_query --- server/src/operators/group_operator.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/operators/group_operator.rs b/server/src/operators/group_operator.rs index d10e6fe5a1..987e36f5a6 100644 --- a/server/src/operators/group_operator.rs +++ b/server/src/operators/group_operator.rs @@ -110,7 +110,7 @@ pub async fn create_groups_query( let mut conn = pool.get().await.unwrap(); - let inserted_groups = if upsert_by_tracking_id { + let mut inserted_groups = if upsert_by_tracking_id { diesel::insert_into(chunk_group_columns::chunk_group) .values(&new_groups) .on_conflict(( @@ -142,6 +142,9 @@ pub async fn create_groups_query( ServiceError::BadRequest("Error inserting groups".to_string()) })? }; + if inserted_groups.is_empty() { + inserted_groups = new_groups; + } Ok(inserted_groups) }