From 06e43bb77e5e2254ed4bab396e18c3ee730937e8 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 30 Jan 2022 17:53:29 +0100 Subject: [PATCH] Fix retrieval of tags for multiple cds Signed-off-by: trivernis --- mediarepo-daemon/mediarepo-logic/src/dao/tag/by_name.rs | 3 ++- mediarepo-daemon/mediarepo-logic/src/dao/tag/mod.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mediarepo-daemon/mediarepo-logic/src/dao/tag/by_name.rs b/mediarepo-daemon/mediarepo-logic/src/dao/tag/by_name.rs index de7e4c9..1ae99bc 100644 --- a/mediarepo-daemon/mediarepo-logic/src/dao/tag/by_name.rs +++ b/mediarepo-daemon/mediarepo-logic/src/dao/tag/by_name.rs @@ -4,7 +4,7 @@ use mediarepo_core::error::RepoResult; use mediarepo_database::entities::{namespace, tag}; use sea_orm::prelude::*; use sea_orm::sea_query::Expr; -use sea_orm::Condition; +use sea_orm::{Condition, QuerySelect}; #[derive(Clone, Debug)] pub struct TagByNameQuery { @@ -30,6 +30,7 @@ impl TagDao { let tags = tag::Entity::find() .find_also_related(namespace::Entity) .filter(condition) + .group_by(tag::Column::Id) .all(&self.ctx.db) .await? .into_iter() diff --git a/mediarepo-daemon/mediarepo-logic/src/dao/tag/mod.rs b/mediarepo-daemon/mediarepo-logic/src/dao/tag/mod.rs index bd4a6e9..9b8e142 100644 --- a/mediarepo-daemon/mediarepo-logic/src/dao/tag/mod.rs +++ b/mediarepo-daemon/mediarepo-logic/src/dao/tag/mod.rs @@ -70,6 +70,7 @@ impl TagDao { content_descriptor_tag::Relation::ContentDescriptorId.def(), ) .filter(content_descriptor::Column::Descriptor.is_in(cds)) + .group_by(tag::Column::Id) .all(&self.ctx.db) .await? .into_iter()