forked from alemi/upub
fix: hashtag query should discard dupes
This commit is contained in:
parent
6f5b494a25
commit
692ae7f31d
1 changed files with 6 additions and 0 deletions
|
@ -94,8 +94,14 @@ impl Query {
|
||||||
pub fn hashtags() -> Select<model::hashtag::Entity> {
|
pub fn hashtags() -> Select<model::hashtag::Entity> {
|
||||||
let mut select =
|
let mut select =
|
||||||
model::hashtag::Entity::find()
|
model::hashtag::Entity::find()
|
||||||
|
.distinct_on([
|
||||||
|
(model::addressing::Entity, model::addressing::Column::Published).into_column_ref(),
|
||||||
|
(model::object::Entity, model::object::Column::Internal).into_column_ref(),
|
||||||
|
])
|
||||||
.join(sea_orm::JoinType::InnerJoin, model::hashtag::Relation::Objects.def())
|
.join(sea_orm::JoinType::InnerJoin, model::hashtag::Relation::Objects.def())
|
||||||
.join(sea_orm::JoinType::InnerJoin, model::object::Relation::Addressing.def())
|
.join(sea_orm::JoinType::InnerJoin, model::object::Relation::Addressing.def())
|
||||||
|
.order_by(model::addressing::Column::Published, Order::Desc)
|
||||||
|
.order_by(model::object::Column::Internal, Order::Desc)
|
||||||
.select_only();
|
.select_only();
|
||||||
|
|
||||||
for col in model::object::Column::iter() {
|
for col in model::object::Column::iter() {
|
||||||
|
|
Loading…
Reference in a new issue