From 1fd31bc7be1b9d3126e630c2eb2be5faaa94840a Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 8 Jun 2024 06:03:36 +0200 Subject: [PATCH] fix: maybe fix for postgres distinct maybe adding internal to order will make it respect the distinct constraint? --- upub/core/src/context.rs | 4 ++-- upub/core/src/selector.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/upub/core/src/context.rs b/upub/core/src/context.rs index bf15d819..4121e17f 100644 --- a/upub/core/src/context.rs +++ b/upub/core/src/context.rs @@ -1,8 +1,8 @@ use std::{collections::BTreeSet, sync::Arc}; -use sea_orm::{ColumnTrait, DatabaseConnection, DbErr, EntityTrait, QueryFilter, QuerySelect, SelectColumns}; +use sea_orm::{DatabaseConnection, DbErr}; -use crate::{config::Config, ext::AnyQuery, model}; +use crate::{config::Config, model}; use uriproxy::UriClass; #[derive(Clone)] diff --git a/upub/core/src/selector.rs b/upub/core/src/selector.rs index 0d0c2d6b..f5434406 100644 --- a/upub/core/src/selector.rs +++ b/upub/core/src/selector.rs @@ -21,6 +21,7 @@ impl Query { .add(model::object::Column::Id.is_not_null()) ) .order_by(model::addressing::Column::Published, Order::Desc) + .order_by(model::activity::Column::Internal, Order::Desc) .select_only(); for col in model::activity::Column::iter() { @@ -52,6 +53,7 @@ impl Query { ]) .join(sea_orm::JoinType::InnerJoin, model::addressing::Relation::Objects.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() {