fix: Query::objects is not ordered by default
so its possible to select only ids
This commit is contained in:
parent
0a98934a7e
commit
1e8cd32905
2 changed files with 2 additions and 3 deletions
|
@ -52,7 +52,6 @@ impl Query {
|
||||||
let mut select = model::addressing::Entity::find()
|
let mut select = model::addressing::Entity::find()
|
||||||
.distinct()
|
.distinct()
|
||||||
.join(sea_orm::JoinType::InnerJoin, model::addressing::Relation::Objects.def())
|
.join(sea_orm::JoinType::InnerJoin, model::addressing::Relation::Objects.def())
|
||||||
.order_by(model::object::Column::Published, Order::Desc)
|
|
||||||
.select_only();
|
.select_only();
|
||||||
|
|
||||||
for col in model::object::Column::iter() {
|
for col in model::object::Column::iter() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use axum::extract::{Path, Query, State};
|
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 upub::{model, selector::{BatchFillable, RichActivity}, Context};
|
||||||
|
|
||||||
use crate::{activitypub::Pagination, builders::JsonLD, AuthIdentity, Identity};
|
use crate::{activitypub::Pagination, builders::JsonLD, AuthIdentity, Identity};
|
||||||
|
@ -45,7 +45,7 @@ pub async fn page(
|
||||||
|
|
||||||
let items = upub::Query::objects(auth.my_id())
|
let items = upub::Query::objects(auth.my_id())
|
||||||
.filter(filter)
|
.filter(filter)
|
||||||
// TODO also limit to only local activities
|
.order_by(model::object::Column::Published, Order::Desc)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.into_model::<RichActivity>()
|
.into_model::<RichActivity>()
|
||||||
|
|
Loading…
Reference in a new issue