Skip to content

Commit

Permalink
bugfix: get_chunks_in_group_by_tracking_id to filter by dataset id.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdxker committed Aug 20, 2024
1 parent a7bae4c commit d17b925
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions server/src/operators/group_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<uuid::Uuid>)>(&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))
}
Expand Down Expand Up @@ -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::<uuid::Uuid>(&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,
};

Expand Down

0 comments on commit d17b925

Please sign in to comment.