fix: oops doesnt work that way :(

This commit is contained in:
əlemi 2024-06-25 05:14:59 +02:00
parent 804a2fba29
commit e6b40f0239
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 5 additions and 8 deletions

View file

@ -1,5 +1,5 @@
use apb::{ActivityMut, BaseMut, ObjectMut}; use apb::{ActivityMut, BaseMut, ObjectMut};
use sea_orm::{ActiveValue::{NotSet, Set}, DbErr, EntityTrait}; use sea_orm::{ActiveValue::{NotSet, Set}, DbErr, EntityTrait, QueryFilter, ColumnTrait};
use upub::traits::fetch::PullError; use upub::traits::fetch::PullError;
#[derive(Debug, Clone, clap::Subcommand)] #[derive(Debug, Clone, clap::Subcommand)]
@ -87,8 +87,9 @@ pub async fn relay(ctx: upub::Context, action: RelayCommand) -> Result<(), PullE
let my_internal = upub::model::actor::Entity::ap_to_internal(ctx.base(), ctx.db()) let my_internal = upub::model::actor::Entity::ap_to_internal(ctx.base(), ctx.db())
.await? .await?
.ok_or_else(|| DbErr::RecordNotFound(ctx.base().to_string()))?; .ok_or_else(|| DbErr::RecordNotFound(ctx.base().to_string()))?;
let relation = upub::Query::related(Some(their_internal), Some(my_internal), true) let relation = upub::model::relation::Entity::find()
.into_model::<upub::model::relation::Model>() .filter(upub::model::relation::Column::Follower.eq(their_internal))
.filter(upub::model::relation::Column::Following.eq(my_internal))
.one(ctx.db()) .one(ctx.db())
.await? .await?
.ok_or_else(|| DbErr::RecordNotFound(format!("relation-{their_internal}-{my_internal}")))?; .ok_or_else(|| DbErr::RecordNotFound(format!("relation-{their_internal}-{my_internal}")))?;

View file

@ -97,12 +97,8 @@ impl Query {
.filter(condition) .filter(condition)
.select_only(); .select_only();
for column in model::relation::Column::iter() {
select = select.select_column_as(column, format!("{}{}", model::relation::Entity.table_name(), column.to_string()));
}
for column in model::actor::Column::iter() { for column in model::actor::Column::iter() {
select = select.select_column_as(column, format!("{}{}", model::actor::Entity.table_name(), column.to_string())); select = select.select_column(column);
} }
select select