forked from alemi/upub
chore: ok clippy
This commit is contained in:
parent
c361528b2f
commit
1a7a4f6df6
4 changed files with 10 additions and 12 deletions
|
@ -3,20 +3,20 @@ use sea_orm::{ColumnTrait, Condition, EntityTrait, PaginatorTrait, QueryFilter,
|
|||
|
||||
use crate::{activitypub::{jsonld::LD, JsonLD, Pagination}, activitystream::{object::collection::{page::CollectionPageMut, CollectionMut, CollectionType}, BaseMut, Node}, model, server::Context, url};
|
||||
|
||||
pub async fn follow___<const out: bool>(
|
||||
pub async fn follow___<const OUTGOING: bool>(
|
||||
State(ctx): State<Context>,
|
||||
Path(id): Path<String>,
|
||||
Query(page): Query<Pagination>,
|
||||
) -> Result<JsonLD<serde_json::Value>, StatusCode> {
|
||||
let follow___ = if out { "following" } else { "followers" };
|
||||
let follow___ = if OUTGOING { "following" } else { "followers" };
|
||||
let limit = page.batch.unwrap_or(20).min(50);
|
||||
let offset = page.offset.unwrap_or(0);
|
||||
if let Some(true) = page.page {
|
||||
|
||||
use model::relation::Column::{Following, Follower};
|
||||
match model::relation::Entity::find()
|
||||
.filter(Condition::all().add(if out { Follower } else { Following }.eq(id.clone())))
|
||||
.select_column(if out { Following } else { Follower })
|
||||
.filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(id.clone())))
|
||||
.select_column(if OUTGOING { Following } else { Follower })
|
||||
.limit(limit)
|
||||
.offset(page.offset.unwrap_or(0))
|
||||
.all(ctx.db()).await
|
||||
|
|
|
@ -60,6 +60,7 @@ impl MigrationTrait for Migration {
|
|||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
enum Likes {
|
||||
Table,
|
||||
Id,
|
||||
|
@ -69,6 +70,7 @@ enum Likes {
|
|||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
enum Shares {
|
||||
Table,
|
||||
Id,
|
||||
|
|
|
@ -140,6 +140,7 @@ impl MigrationTrait for Migration {
|
|||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
enum Likes {
|
||||
Table,
|
||||
Actor,
|
||||
|
@ -147,6 +148,7 @@ enum Likes {
|
|||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
enum Shares {
|
||||
Table,
|
||||
Actor,
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
use sea_orm::entity::prelude::*;
|
||||
use crate::activitypub::jsonld::LD;
|
||||
use crate::activitystream::key::{PublicKey as _, PublicKeyMut as _};
|
||||
use crate::activitystream::object::actor::ActorMut as _;
|
||||
use crate::activitystream::object::document::{DocumentMut as _, DocumentType};
|
||||
use crate::activitystream::key::PublicKey as _;
|
||||
|
||||
use crate::activitystream::object::ObjectMut as _;
|
||||
use crate::activitystream::{BaseMut as _, Object as _};
|
||||
use crate::{activitypub, activitystream::{object::actor::ActorType, BaseType, Node, ObjectType}};
|
||||
use crate::{activitypub, activitystream::object::actor::{Actor, ActorType}};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "users")]
|
||||
|
@ -40,7 +35,6 @@ pub struct Model {
|
|||
// pub streams: Option<String>,
|
||||
}
|
||||
|
||||
use crate::activitystream::object::{actor::Actor, collection::Collection, document::Image};
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
|
|
Loading…
Reference in a new issue