fix: Query::objects is not ordered by default

so its possible to select only ids
This commit is contained in:
əlemi 2024-08-14 15:41:10 +02:00
parent 0a98934a7e
commit 1e8cd32905
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 2 additions and 3 deletions

View file

@ -52,7 +52,6 @@ impl Query {
let mut select = model::addressing::Entity::find()
.distinct()
.join(sea_orm::JoinType::InnerJoin, model::addressing::Relation::Objects.def())
.order_by(model::object::Column::Published, Order::Desc)
.select_only();
for col in model::object::Column::iter() {

View file

@ -1,5 +1,5 @@
use axum::extract::{Path, Query, State};
use sea_orm::{ColumnTrait, Condition, PaginatorTrait, QueryFilter, QuerySelect};
use sea_orm::{ColumnTrait, Condition, Order, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
use upub::{model, selector::{BatchFillable, RichActivity}, Context};
use crate::{activitypub::Pagination, builders::JsonLD, AuthIdentity, Identity};
@ -45,7 +45,7 @@ pub async fn page(
let items = upub::Query::objects(auth.my_id())
.filter(filter)
// TODO also limit to only local activities
.order_by(model::object::Column::Published, Order::Desc)
.limit(limit)
.offset(offset)
.into_model::<RichActivity>()