1
0
Fork 0
forked from alemi/upub

fix: hashtag query should discard dupes

This commit is contained in:
əlemi 2024-07-06 04:41:02 +02:00
parent 6f5b494a25
commit 692ae7f31d
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -94,8 +94,14 @@ impl Query {
pub fn hashtags() -> Select<model::hashtag::Entity> {
let mut select =
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::object::Relation::Addressing.def())
.order_by(model::addressing::Column::Published, Order::Desc)
.order_by(model::object::Column::Internal, Order::Desc)
.select_only();
for col in model::object::Column::iter() {