From d17b925562e4eb2258f21f58e6004fde3b6256ae Mon Sep 17 00:00:00 2001 From: cdxker Date: Tue, 20 Aug 2024 15:13:54 -0700 Subject: [PATCH] bugfix: get_chunks_in_group_by_tracking_id to filter by dataset id. --- server/src/operators/group_operator.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/operators/group_operator.rs b/server/src/operators/group_operator.rs index 28204cfd02..62f6095154 100644 --- a/server/src/operators/group_operator.rs +++ b/server/src/operators/group_operator.rs @@ -36,14 +36,16 @@ pub async fn get_group_from_tracking_id_query( .on(chunk_group_columns::id.eq(groups_from_files_columns::group_id)), ) .filter(chunk_group_columns::dataset_id.eq(dataset_uuid)) - .filter(chunk_group_columns::tracking_id.eq(tracking_id)) + .filter(chunk_group_columns::tracking_id.eq(&tracking_id)) .select(( ChunkGroup::as_select(), groups_from_files_columns::file_id.nullable(), )) .first::<(ChunkGroup, Option)>(&mut conn) .await - .map_err(|_| ServiceError::NotFound("Group with tracking_id not found".to_string()))?; + .map_err(|_| { + ServiceError::NotFound(format!("Group with tracking_id {:} not found", tracking_id)) + })?; Ok(ChunkGroupAndFileId::from_group(group, file_id)) } @@ -413,11 +415,14 @@ pub async fn get_bookmarks_for_group_query( let group_uuid = match group_id { UnifiedId::TrackingId(id) => chunk_group_columns::chunk_group - .filter(chunk_group_columns::tracking_id.eq(id)) + .filter(chunk_group_columns::tracking_id.eq(&id)) + .filter(chunk_group_columns::dataset_id.eq(&dataset_uuid)) .select(chunk_group_columns::id) .first::(&mut conn) .await - .map_err(|_| ServiceError::NotFound("Group with id not found".to_string()))?, + .map_err(|_| { + ServiceError::NotFound(format!("Group with tracking id not found {:}", id)) + })?, UnifiedId::TrieveUuid(id) => id, };