mirror of https://github.com/LemmyNet/lemmy.git
WithoutId
parent
86a433b0b3
commit
5e86922b0f
|
@ -128,6 +128,7 @@ rustls = { version = "0.21.3", features = ["dangerous_configuration"] }
|
||||||
futures-util = "0.3.28"
|
futures-util = "0.3.28"
|
||||||
tokio-postgres = "0.7.8"
|
tokio-postgres = "0.7.8"
|
||||||
tokio-postgres-rustls = "0.10.0"
|
tokio-postgres-rustls = "0.10.0"
|
||||||
|
macro_rules_attribute = "0.2.0
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_api = { workspace = true }
|
lemmy_api = { workspace = true }
|
||||||
|
|
|
@ -34,6 +34,8 @@ full = [
|
||||||
"tokio-postgres",
|
"tokio-postgres",
|
||||||
"tokio-postgres-rustls",
|
"tokio-postgres-rustls",
|
||||||
"rustls",
|
"rustls",
|
||||||
|
"macro_rules_attribute",
|
||||||
|
"paste",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -75,6 +77,8 @@ tokio-postgres = { workspace = true, optional = true }
|
||||||
tokio-postgres-rustls = { workspace = true, optional = true }
|
tokio-postgres-rustls = { workspace = true, optional = true }
|
||||||
rustls = { workspace = true, optional = true }
|
rustls = { workspace = true, optional = true }
|
||||||
uuid = { workspace = true, features = ["v4"] }
|
uuid = { workspace = true, features = ["v4"] }
|
||||||
|
macro_rules_attribute = { workspace = true, optional = true }
|
||||||
|
paste = { workspace = true, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = { workspace = true }
|
serial_test = { workspace = true }
|
||||||
|
|
|
@ -20,6 +20,17 @@ extern crate diesel_migrations;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate async_trait;
|
extern crate async_trait;
|
||||||
|
|
||||||
|
#[cfg(feature = "full")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate macro_rules_attribute;
|
||||||
|
|
||||||
|
#[cfg(feature = "full")]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate paste;
|
||||||
|
|
||||||
|
#[cfg(feature = "full)]
|
||||||
|
#[macro_use]
|
||||||
|
mod without_id;
|
||||||
pub mod aggregates;
|
pub mod aggregates;
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/// `macro_rules_attribute::derive(WithoutId!)` generates a variant of the struct with
|
||||||
|
/// `WithoutId` added to the name and no `id` field.
|
||||||
|
///
|
||||||
|
/// This is useful for making less redundant selections of multiple joined tables.
|
||||||
|
/// For example, selecting both `comment::post_id` and `post::id` is redundant if they
|
||||||
|
/// have the same value. In this case, the selection of `post::id` can be avoided by selecting
|
||||||
|
/// `PostWithoutId::as_select()` instead of `post::all_columns`.
|
||||||
|
///
|
||||||
|
/// This macro generates an `into_full` method, which converts to the sturct with `id`.
|
||||||
|
/// For example, `PostWithoutId` would have this:
|
||||||
|
///
|
||||||
|
/// `pub fn into_full(self, id: PostId) -> Post`
|
||||||
|
///
|
||||||
|
/// The `id` value can come from a column in another table, like `comment::post_id`.
|
||||||
|
///
|
||||||
|
/// The generated struct implements `Selectable` and `Queryable`.
|
||||||
|
macro_rules! WithoutId {
|
||||||
|
(
|
||||||
|
#[diesel(table_name = $table_name:ident)]
|
||||||
|
$(#[$_struct_meta:meta])*
|
||||||
|
$vis:vis struct $struct_name:ident {
|
||||||
|
$(#[$_id_meta:meta])*
|
||||||
|
$_id_vis:vis id: $id_type:ty,
|
||||||
|
$(
|
||||||
|
$(#[$_field_meta:meta])*
|
||||||
|
$field_vis:vis $field_name:ident : $field_type:ty,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
) => {
|
||||||
|
::paste::paste! {
|
||||||
|
#[derive(::diesel::Queryable, ::diesel::Selectable)]
|
||||||
|
#[diesel(table_name = $table_name)]
|
||||||
|
$vis struct [<$struct_name WithoutId>] {
|
||||||
|
$(
|
||||||
|
// Field attributes are not kept because either they are for other
|
||||||
|
// derive macros, or they are `#[cfg(...)]` which is evaluated before
|
||||||
|
// macro expansion.
|
||||||
|
$field_vis $field_name : $field_type,
|
||||||
|
)*
|
||||||
|
}
|
||||||
|
|
||||||
|
impl [<$struct_name WithoutId>] {
|
||||||
|
pub fn into_full(self, id: $id_type) -> $struct_name {
|
||||||
|
$struct_name {
|
||||||
|
$($field_name : self.$field_name,)*
|
||||||
|
id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Keep on removing the first attribute until `diesel(table_name = ...)` becomes
|
||||||
|
// the first, which will cause the first pattern to be matched.
|
||||||
|
(#[$_meta:meta] $($remaining:tt)*) => {
|
||||||
|
$($remaining)*
|
||||||
|
};
|
||||||
|
|
||||||
|
// This pattern is matched when there's no attributes.
|
||||||
|
($_vis:vis struct $($_tt:tt)*) => {
|
||||||
|
::std::compile_error!("`#[diesel(table_name = ...)]` is missing");
|
||||||
|
};
|
||||||
|
}
|
|
@ -27,11 +27,11 @@ use lemmy_db_schema::{
|
||||||
post,
|
post,
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
comment::Comment,
|
comment::CommentWithoutId,
|
||||||
comment_report::CommentReport,
|
comment_report::CommentReport,
|
||||||
community::Community,
|
community::CommunityWithoutId,
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
post::Post,
|
post::PostWithoutId,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
|
@ -66,15 +66,15 @@ fn queries<'a>() -> Queries<
|
||||||
|
|
||||||
let selection = (
|
let selection = (
|
||||||
comment_report::all_columns,
|
comment_report::all_columns,
|
||||||
comment::all_columns,
|
CommentWithoutId::as_select(),
|
||||||
post::all_columns,
|
PostWithoutId::as_select(),
|
||||||
community::all_columns,
|
CommunityWithoutId::as_select(),
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(PersonWithoutId::as_select()),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
comment_like::score.nullable(),
|
comment_like::score.nullable(),
|
||||||
aliases::person2.fields(person::all_columns).nullable(),
|
aliases::person2.fields(PersonWithoutId::as_select()).nullable(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let read = move |mut conn: DbConn<'a>, (report_id, my_person_id): (CommentReportId, PersonId)| async move {
|
let read = move |mut conn: DbConn<'a>, (report_id, my_person_id): (CommentReportId, PersonId)| async move {
|
||||||
|
@ -223,30 +223,42 @@ impl CommentReportQuery {
|
||||||
impl JoinView for CommentReportView {
|
impl JoinView for CommentReportView {
|
||||||
type JoinTuple = (
|
type JoinTuple = (
|
||||||
CommentReport,
|
CommentReport,
|
||||||
Comment,
|
CommentWithoutId,
|
||||||
Post,
|
PostWithoutId,
|
||||||
Community,
|
CommunityWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
bool,
|
bool,
|
||||||
Option<i16>,
|
Option<i16>,
|
||||||
Option<Person>,
|
Option<PersonWithoutId>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
let counts = a.6.into_full(&a.1);
|
(
|
||||||
Self {
|
comment_report,
|
||||||
comment_report: a.0,
|
comment,
|
||||||
comment: a.1,
|
post,
|
||||||
post: a.2,
|
community,
|
||||||
community: a.3,
|
creator,
|
||||||
creator: a.4,
|
comment_creator,
|
||||||
comment_creator: a.5,
|
|
||||||
counts,
|
counts,
|
||||||
creator_banned_from_community: a.7,
|
creator_banned_from_community,
|
||||||
my_vote: a.8,
|
my_vote,
|
||||||
resolver: a.9,
|
resolver,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
resolver: resolver.zip(comment_report.resolver_id).map(|(resolver, id)| resolver.into_full(id)),
|
||||||
|
my_vote,
|
||||||
|
creator_banned_from_community,
|
||||||
|
counts: counts.into_full(&comment),
|
||||||
|
comment_creator: comment_creator.into_full(comment.creator_id),
|
||||||
|
creator: creator.into_full(comment_report.creator_id),
|
||||||
|
community: community.into_full(post.community_id),
|
||||||
|
post: post.into_full(comment.post_id),
|
||||||
|
comment: comment.into_full(comment_report.comment_id),
|
||||||
|
comment_report,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ use lemmy_db_schema::{
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
comment::Comment,
|
comment::Comment,
|
||||||
community::{Community, CommunityFollower},
|
community::{CommunityWithoutId, CommunityFollower},
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
post::Post,
|
post::PostWithoutId,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{fuzzy_search, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{fuzzy_search, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
|
@ -44,9 +44,9 @@ use lemmy_db_schema::{
|
||||||
|
|
||||||
type CommentViewTuple = (
|
type CommentViewTuple = (
|
||||||
Comment,
|
Comment,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Post,
|
PostWithoutId,
|
||||||
Community,
|
CommunityWithoutId,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
bool,
|
bool,
|
||||||
SubscribedType,
|
SubscribedType,
|
||||||
|
@ -106,9 +106,9 @@ fn queries<'a>() -> Queries<
|
||||||
|
|
||||||
let selection = (
|
let selection = (
|
||||||
comment::all_columns,
|
comment::all_columns,
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
post::all_columns,
|
PostWithoutId::as_select(),
|
||||||
community::all_columns,
|
CommunityWithoutId::as_select(),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
CommunityFollower::select_subscribed_type(),
|
CommunityFollower::select_subscribed_type(),
|
||||||
|
@ -324,19 +324,31 @@ impl<'a> CommentQuery<'a> {
|
||||||
|
|
||||||
impl JoinView for CommentView {
|
impl JoinView for CommentView {
|
||||||
type JoinTuple = CommentViewTuple;
|
type JoinTuple = CommentViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
let counts = a.4.into_full(&a.0);
|
(
|
||||||
Self {
|
comment,
|
||||||
comment: a.0,
|
creator,
|
||||||
creator: a.1,
|
post,
|
||||||
post: a.2,
|
community,
|
||||||
community: a.3,
|
|
||||||
counts,
|
counts,
|
||||||
creator_banned_from_community: a.5,
|
creator_banned_from_community,
|
||||||
subscribed: a.6,
|
subscribed,
|
||||||
saved: a.7,
|
saved,
|
||||||
creator_blocked: a.8,
|
creator_blocked,
|
||||||
my_vote: a.9,
|
my_vote,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
counts: counts.into_full(&comment),
|
||||||
|
community: community.into_full(post.community_id),
|
||||||
|
post: post.into_full(comment.post_id),
|
||||||
|
creator: creator.into_full(comment.creator_id),
|
||||||
|
comment,
|
||||||
|
creator_banned_from_community,
|
||||||
|
subscribed,
|
||||||
|
saved,
|
||||||
|
creator_blocked,
|
||||||
|
my_vote,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ use lemmy_db_schema::{
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
type CustomEmojiTuple = (CustomEmoji, Option<CustomEmojiKeyword>);
|
type CustomEmojiTuple = (CustomEmoji, Option<KeywordTuple>);
|
||||||
|
|
||||||
|
type KeywordTuple = (CustomEmojiId, String);
|
||||||
|
|
||||||
impl CustomEmojiView {
|
impl CustomEmojiView {
|
||||||
pub async fn get(pool: &mut DbPool<'_>, emoji_id: CustomEmojiId) -> Result<Self, Error> {
|
pub async fn get(pool: &mut DbPool<'_>, emoji_id: CustomEmojiId) -> Result<Self, Error> {
|
||||||
|
@ -21,7 +23,7 @@ impl CustomEmojiView {
|
||||||
)
|
)
|
||||||
.select((
|
.select((
|
||||||
custom_emoji::all_columns,
|
custom_emoji::all_columns,
|
||||||
custom_emoji_keyword::all_columns.nullable(), // (or all the columns if you want)
|
(custom_emoji_keyword::id, custom_emoji_keyword::keyword).nullable(), // (or all the columns if you want)
|
||||||
))
|
))
|
||||||
.load::<CustomEmojiTuple>(conn)
|
.load::<CustomEmojiTuple>(conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -49,7 +51,7 @@ impl CustomEmojiView {
|
||||||
.then_order_by(custom_emoji::id)
|
.then_order_by(custom_emoji::id)
|
||||||
.select((
|
.select((
|
||||||
custom_emoji::all_columns,
|
custom_emoji::all_columns,
|
||||||
custom_emoji_keyword::all_columns.nullable(), // (or all the columns if you want)
|
(custom_emoji_keyword::id, custom_emoji_keyword::keyword).nullable(), // (or all the columns if you want)
|
||||||
))
|
))
|
||||||
.load::<CustomEmojiTuple>(conn)
|
.load::<CustomEmojiTuple>(conn)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -71,7 +73,11 @@ impl CustomEmojiView {
|
||||||
}
|
}
|
||||||
if let Some(item_keyword) = &item.1 {
|
if let Some(item_keyword) = &item.1 {
|
||||||
if let Some(keywords) = hash.get_mut(&emoji_id) {
|
if let Some(keywords) = hash.get_mut(&emoji_id) {
|
||||||
keywords.push(item_keyword.clone())
|
keywords.push(CustomEmojiKeyword {
|
||||||
|
id: item_keyword.0,
|
||||||
|
custom_emoji_id: emoji_id,
|
||||||
|
keyword: item_keyword.1.clone(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
use crate::structs::LocalUserView;
|
use crate::structs::LocalUserView;
|
||||||
use diesel::{result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, QueryDsl};
|
use diesel::{result::Error, BoolExpressionMethods, ExpressionMethods, JoinOnDsl, QueryDsl, SelectableHelper};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
aggregates::structs::PersonAggregates,
|
aggregates::structs::PersonAggregates,
|
||||||
newtypes::{LocalUserId, PersonId},
|
newtypes::{LocalUserId, PersonId},
|
||||||
schema::{local_user, person, person_aggregates},
|
schema::{local_user, person, person_aggregates},
|
||||||
source::{local_user::LocalUser, person::Person},
|
source::{local_user::LocalUser, person::PersonWithoutId},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{functions::lower, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{functions::lower, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
};
|
};
|
||||||
|
|
||||||
type LocalUserViewTuple = (LocalUser, Person, PersonAggregates);
|
type LocalUserViewTuple = (LocalUser, PersonWithoutId, PersonAggregates);
|
||||||
|
|
||||||
enum ReadBy<'a> {
|
enum ReadBy<'a> {
|
||||||
Id(LocalUserId),
|
Id(LocalUserId),
|
||||||
|
@ -28,7 +28,7 @@ fn queries<'a>(
|
||||||
) -> Queries<impl ReadFn<'a, LocalUserView, ReadBy<'a>>, impl ListFn<'a, LocalUserView, ListMode>> {
|
) -> Queries<impl ReadFn<'a, LocalUserView, ReadBy<'a>>, impl ListFn<'a, LocalUserView, ListMode>> {
|
||||||
let selection = (
|
let selection = (
|
||||||
local_user::all_columns,
|
local_user::all_columns,
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(,
|
||||||
person_aggregates::all_columns,
|
person_aggregates::all_columns,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -108,11 +108,11 @@ impl LocalUserView {
|
||||||
|
|
||||||
impl JoinView for LocalUserView {
|
impl JoinView for LocalUserView {
|
||||||
type JoinTuple = LocalUserViewTuple;
|
type JoinTuple = LocalUserViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple((loal_user, person, counts): Self::JoinTuple) -> Self {
|
||||||
Self {
|
Self {
|
||||||
local_user: a.0,
|
person: person.into_full(local_user.person_id),
|
||||||
person: a.1,
|
local_user,
|
||||||
counts: a.2,
|
counts,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,21 +24,21 @@ use lemmy_db_schema::{
|
||||||
post_like,
|
post_like,
|
||||||
post_report,
|
post_report,
|
||||||
},
|
},
|
||||||
source::{community::Community, person::Person, post::Post, post_report::PostReport},
|
source::{community::CommunityWithoutId, person::PersonWithoutId, post::PostWithoutId, post_report::PostReport},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
};
|
};
|
||||||
|
|
||||||
type PostReportViewTuple = (
|
type PostReportViewTuple = (
|
||||||
PostReport,
|
PostReport,
|
||||||
Post,
|
PostWithoutId,
|
||||||
Community,
|
CommunityWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
bool,
|
bool,
|
||||||
Option<i16>,
|
Option<i16>,
|
||||||
PostAggregatesNotInPost,
|
PostAggregatesNotInPost,
|
||||||
Option<Person>,
|
Option<PersonWithoutId>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn queries<'a>() -> Queries<
|
fn queries<'a>() -> Queries<
|
||||||
|
@ -72,14 +72,14 @@ fn queries<'a>() -> Queries<
|
||||||
)
|
)
|
||||||
.select((
|
.select((
|
||||||
post_report::all_columns,
|
post_report::all_columns,
|
||||||
post::all_columns,
|
PostWithoutId::as_select(),
|
||||||
community::all_columns,
|
CommunityWithoutId::as_select(),
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(PersonWithoutId::as_select()),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
post_like::score.nullable(),
|
post_like::score.nullable(),
|
||||||
PostAggregatesNotInPost::as_select(),
|
PostAggregatesNotInPost::as_select(),
|
||||||
aliases::person2.fields(person::all_columns.nullable()),
|
aliases::person2.fields(PersonWithoutId::as_select.nullable()),
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,18 +202,29 @@ impl PostReportQuery {
|
||||||
|
|
||||||
impl JoinView for PostReportView {
|
impl JoinView for PostReportView {
|
||||||
type JoinTuple = PostReportViewTuple;
|
type JoinTuple = PostReportViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
let counts = a.7.into_full(&a.1);
|
(
|
||||||
Self {
|
post_report,
|
||||||
post_report: a.0,
|
post,
|
||||||
post: a.1,
|
community,
|
||||||
community: a.2,
|
creator,
|
||||||
creator: a.3,
|
post_creator,
|
||||||
post_creator: a.4,
|
creator_banned_from_community,
|
||||||
creator_banned_from_community: a.5,
|
my_vote,
|
||||||
my_vote: a.6,
|
|
||||||
counts,
|
counts,
|
||||||
resolver: a.8,
|
resolver,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
resolver: (resolver, post_report.resolver_id).zip().map(|(resolver, id)| resolver.into_full(id)),
|
||||||
|
counts: counts.into_full(&post),
|
||||||
|
my_vote,
|
||||||
|
creator_banned_from_community,
|
||||||
|
post_creator: post_creator.into_full(post.creator_id),
|
||||||
|
creator: creator.into_full(post_report.creator_id),
|
||||||
|
community: community.into_full(post.community_id),
|
||||||
|
post: post.into_full(post_report.post_id),
|
||||||
|
post_report,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ use lemmy_db_schema::{
|
||||||
post_saved,
|
post_saved,
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
community::{Community, CommunityFollower},
|
community::{CommunityWithoutId, CommunityFollower},
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
post::Post,
|
post::Post,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
|
@ -49,8 +49,8 @@ use tracing::debug;
|
||||||
|
|
||||||
type PostViewTuple = (
|
type PostViewTuple = (
|
||||||
Post,
|
Post,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Community,
|
CommunityWithoutId,
|
||||||
bool,
|
bool,
|
||||||
PostAggregatesNotInPost,
|
PostAggregatesNotInPost,
|
||||||
SubscribedType,
|
SubscribedType,
|
||||||
|
@ -135,8 +135,8 @@ fn queries<'a>() -> Queries<
|
||||||
|
|
||||||
let selection = (
|
let selection = (
|
||||||
post::all_columns,
|
post::all_columns,
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
community::all_columns,
|
CommunityWithoutId::as_select(),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
PostAggregatesNotInPost::as_select(),
|
PostAggregatesNotInPost::as_select(),
|
||||||
CommunityFollower::select_subscribed_type(),
|
CommunityFollower::select_subscribed_type(),
|
||||||
|
@ -438,20 +438,34 @@ impl<'a> PostQuery<'a> {
|
||||||
|
|
||||||
impl JoinView for PostView {
|
impl JoinView for PostView {
|
||||||
type JoinTuple = PostViewTuple;
|
type JoinTuple = PostViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
|
(
|
||||||
|
post,
|
||||||
|
creator,
|
||||||
|
community,
|
||||||
|
creator_banned_from_community,
|
||||||
|
counts,
|
||||||
|
subscribed,
|
||||||
|
saved,
|
||||||
|
read,
|
||||||
|
creator_blocked,
|
||||||
|
my_vote,
|
||||||
|
unread_comments,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
let counts = a.4.into_full(&a.0);
|
let counts = a.4.into_full(&a.0);
|
||||||
Self {
|
Self {
|
||||||
post: a.0,
|
creator: creator.into_full(post.creator_id),
|
||||||
creator: a.1,
|
community: community.into_full(post.community_id),
|
||||||
community: a.2,
|
counts: counts.into_full(&post),
|
||||||
creator_banned_from_community: a.3,
|
post,
|
||||||
counts,
|
creator_banned_from_community,
|
||||||
subscribed: a.5,
|
subscribed,
|
||||||
saved: a.6,
|
saved,
|
||||||
read: a.7,
|
read,
|
||||||
creator_blocked: a.8,
|
creator_blocked,
|
||||||
my_vote: a.9,
|
my_vote,
|
||||||
unread_comments: a.10,
|
unread_comments,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ use diesel::{
|
||||||
JoinOnDsl,
|
JoinOnDsl,
|
||||||
NullableExpressionMethods,
|
NullableExpressionMethods,
|
||||||
QueryDsl,
|
QueryDsl,
|
||||||
|
SelectableHelper,
|
||||||
};
|
};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -13,8 +14,8 @@ use lemmy_db_schema::{
|
||||||
newtypes::PrivateMessageReportId,
|
newtypes::PrivateMessageReportId,
|
||||||
schema::{person, private_message, private_message_report},
|
schema::{person, private_message, private_message_report},
|
||||||
source::{
|
source::{
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
private_message::PrivateMessage,
|
private_message::PrivateMessageWithoutId,
|
||||||
private_message_report::PrivateMessageReport,
|
private_message_report::PrivateMessageReport,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
|
@ -23,10 +24,10 @@ use lemmy_db_schema::{
|
||||||
|
|
||||||
type PrivateMessageReportViewTuple = (
|
type PrivateMessageReportViewTuple = (
|
||||||
PrivateMessageReport,
|
PrivateMessageReport,
|
||||||
PrivateMessage,
|
PrivateMessageWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Option<Person>,
|
Option<PersonWithoutId>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn queries<'a>() -> Queries<
|
fn queries<'a>() -> Queries<
|
||||||
|
@ -47,10 +48,10 @@ fn queries<'a>() -> Queries<
|
||||||
))
|
))
|
||||||
.select((
|
.select((
|
||||||
private_message_report::all_columns,
|
private_message_report::all_columns,
|
||||||
private_message::all_columns,
|
PrivateMessageWithoutId::as_select(),
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(PersonWithoutId::as_select()),
|
||||||
aliases::person2.fields(person::all_columns).nullable(),
|
aliases::person2.fields(PersonWithoutId::as_select()).nullable(),
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -121,13 +122,21 @@ impl PrivateMessageReportQuery {
|
||||||
|
|
||||||
impl JoinView for PrivateMessageReportView {
|
impl JoinView for PrivateMessageReportView {
|
||||||
type JoinTuple = PrivateMessageReportViewTuple;
|
type JoinTuple = PrivateMessageReportViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
|
(
|
||||||
|
private_message_report,
|
||||||
|
private_message,
|
||||||
|
private_message_creator,
|
||||||
|
creator,
|
||||||
|
resolver,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
private_message_report: a.0,
|
resolver: (resolver, private_message_report.resolver_id).zip().map(|(resolver, id) resolver.into_full(id)),
|
||||||
private_message: a.1,
|
creator: creator.into_full(private_message_report.creator_id),
|
||||||
private_message_creator: a.2,
|
private_message_creator: private_message_creator.into_full(private_message.creator_id),
|
||||||
creator: a.3,
|
private_message: private_message.into_full(private_message_report.private_message_id),
|
||||||
resolver: a.4,
|
private_message_report,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,20 @@ use diesel::{
|
||||||
ExpressionMethods,
|
ExpressionMethods,
|
||||||
JoinOnDsl,
|
JoinOnDsl,
|
||||||
QueryDsl,
|
QueryDsl,
|
||||||
|
SelectableHelper,
|
||||||
};
|
};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
aliases,
|
aliases,
|
||||||
newtypes::{PersonId, PrivateMessageId},
|
newtypes::{PersonId, PrivateMessageId},
|
||||||
schema::{person, private_message},
|
schema::{person, private_message},
|
||||||
source::{person::Person, private_message::PrivateMessage},
|
source::{person::PersonWithoutId, private_message::PrivateMessage},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
};
|
};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
type PrivateMessageViewTuple = (PrivateMessage, Person, Person);
|
type PrivateMessageViewTuple = (PrivateMessage, PersonWithoutId, PersonWithoutId);
|
||||||
|
|
||||||
fn queries<'a>() -> Queries<
|
fn queries<'a>() -> Queries<
|
||||||
impl ReadFn<'a, PrivateMessageView, PrivateMessageId>,
|
impl ReadFn<'a, PrivateMessageView, PrivateMessageId>,
|
||||||
|
@ -35,8 +36,8 @@ fn queries<'a>() -> Queries<
|
||||||
|
|
||||||
let selection = (
|
let selection = (
|
||||||
private_message::all_columns,
|
private_message::all_columns,
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(PersonWithoutId::as_select()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let read = move |mut conn: DbConn<'a>, private_message_id: PrivateMessageId| async move {
|
let read = move |mut conn: DbConn<'a>, private_message_id: PrivateMessageId| async move {
|
||||||
|
@ -129,11 +130,17 @@ impl PrivateMessageQuery {
|
||||||
|
|
||||||
impl JoinView for PrivateMessageView {
|
impl JoinView for PrivateMessageView {
|
||||||
type JoinTuple = PrivateMessageViewTuple;
|
type JoinTuple = PrivateMessageViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
|
(
|
||||||
|
private_message,
|
||||||
|
creator,
|
||||||
|
recipient,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
private_message: a.0,
|
creator: creator.into_full(private_message.creator_id),
|
||||||
creator: a.1,
|
recipient: recipient.into_full(private_message.recipient_id),
|
||||||
recipient: a.2,
|
private_message,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,15 @@ use diesel::{
|
||||||
JoinOnDsl,
|
JoinOnDsl,
|
||||||
NullableExpressionMethods,
|
NullableExpressionMethods,
|
||||||
QueryDsl,
|
QueryDsl,
|
||||||
|
SelectableHelper,
|
||||||
};
|
};
|
||||||
use diesel_async::RunQueryDsl;
|
use diesel_async::RunQueryDsl;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
aliases,
|
aliases,
|
||||||
schema::{local_user, person, registration_application},
|
schema::{local_user, person, registration_application},
|
||||||
source::{
|
source::{
|
||||||
local_user::LocalUser,
|
local_user::LocalUserWithoutId,
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
registration_application::RegistrationApplication,
|
registration_application::RegistrationApplication,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
|
@ -22,7 +23,7 @@ use lemmy_db_schema::{
|
||||||
};
|
};
|
||||||
|
|
||||||
type RegistrationApplicationViewTuple =
|
type RegistrationApplicationViewTuple =
|
||||||
(RegistrationApplication, LocalUser, Person, Option<Person>);
|
(RegistrationApplication, LocalUserWithoutId, PersonWithoutId, Option<PersonWithoutId>);
|
||||||
|
|
||||||
fn queries<'a>() -> Queries<
|
fn queries<'a>() -> Queries<
|
||||||
impl ReadFn<'a, RegistrationApplicationView, i32>,
|
impl ReadFn<'a, RegistrationApplicationView, i32>,
|
||||||
|
@ -39,9 +40,9 @@ fn queries<'a>() -> Queries<
|
||||||
.order_by(registration_application::published.desc())
|
.order_by(registration_application::published.desc())
|
||||||
.select((
|
.select((
|
||||||
registration_application::all_columns,
|
registration_application::all_columns,
|
||||||
local_user::all_columns,
|
LocalUserWithoutId::as_select(),
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns).nullable(),
|
aliases::person1.fields(PersonWithoutId::as_select()).nullable(),
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,12 +138,19 @@ impl RegistrationApplicationQuery {
|
||||||
|
|
||||||
impl JoinView for RegistrationApplicationView {
|
impl JoinView for RegistrationApplicationView {
|
||||||
type JoinTuple = RegistrationApplicationViewTuple;
|
type JoinTuple = RegistrationApplicationViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
|
(
|
||||||
|
registration_application,
|
||||||
|
creator_local_user,
|
||||||
|
creator,
|
||||||
|
admin,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
registration_application: a.0,
|
admin: admin.into_full(registration_application.admin_id),
|
||||||
creator_local_user: a.1,
|
creator: creator.into_full(creator_local_user.person_id),
|
||||||
creator: a.2,
|
creator_local_user: creator_local_user.into_full(registration_application.local_user_id),
|
||||||
admin: a.3,
|
registration_application,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use diesel_async::RunQueryDsl;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
aggregates::structs::SiteAggregates,
|
aggregates::structs::SiteAggregates,
|
||||||
schema::{local_site, local_site_rate_limit, site, site_aggregates},
|
schema::{local_site, local_site_rate_limit, site, site_aggregates},
|
||||||
source::{local_site::LocalSite, local_site_rate_limit::LocalSiteRateLimit, site::Site},
|
source::{local_site::LocalSite, local_site_rate_limit::LocalSiteRateLimit, site::SiteWithoutId},
|
||||||
utils::{get_conn, DbPool},
|
utils::{get_conn, DbPool},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ impl SiteView {
|
||||||
)
|
)
|
||||||
.inner_join(site_aggregates::table)
|
.inner_join(site_aggregates::table)
|
||||||
.select((
|
.select((
|
||||||
site::all_columns,
|
SiteWithoutId::as_select(),
|
||||||
local_site::all_columns,
|
local_site::all_columns,
|
||||||
local_site_rate_limit::all_columns,
|
local_site_rate_limit::all_columns,
|
||||||
site_aggregates::all_columns,
|
site_aggregates::all_columns,
|
||||||
|
@ -28,7 +28,7 @@ impl SiteView {
|
||||||
|
|
||||||
site.private_key = None;
|
site.private_key = None;
|
||||||
Ok(SiteView {
|
Ok(SiteView {
|
||||||
site,
|
site: site.into_full(local_site.site_id),
|
||||||
local_site,
|
local_site,
|
||||||
local_site_rate_limit,
|
local_site_rate_limit,
|
||||||
counts,
|
counts,
|
||||||
|
|
|
@ -28,11 +28,11 @@ use lemmy_db_schema::{
|
||||||
post,
|
post,
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
comment::Comment,
|
comment::CommentWithoutId,
|
||||||
comment_reply::CommentReply,
|
comment_reply::CommentReply,
|
||||||
community::{Community, CommunityFollower},
|
community::{CommunityWithoutId, CommunityFollower},
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
post::Post,
|
post::PostWithoutId,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
|
@ -42,11 +42,11 @@ use lemmy_db_schema::{
|
||||||
|
|
||||||
type CommentReplyViewTuple = (
|
type CommentReplyViewTuple = (
|
||||||
CommentReply,
|
CommentReply,
|
||||||
Comment,
|
CommentWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Post,
|
PostWithoutId,
|
||||||
Community,
|
CommunityWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
bool,
|
bool,
|
||||||
SubscribedType,
|
SubscribedType,
|
||||||
|
@ -107,11 +107,11 @@ fn queries<'a>() -> Queries<
|
||||||
)
|
)
|
||||||
.select((
|
.select((
|
||||||
comment_reply::all_columns,
|
comment_reply::all_columns,
|
||||||
comment::all_columns,
|
CommentWithoutId::as_select(),
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
post::all_columns,
|
PostWithoutId::as_select(),
|
||||||
community::all_columns,
|
CommunityWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(PersonWithoutId::as_select()),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
CommunityFollower::select_subscribed_type(),
|
CommunityFollower::select_subscribed_type(),
|
||||||
|
@ -218,21 +218,35 @@ impl CommentReplyQuery {
|
||||||
|
|
||||||
impl JoinView for CommentReplyView {
|
impl JoinView for CommentReplyView {
|
||||||
type JoinTuple = CommentReplyViewTuple;
|
type JoinTuple = CommentReplyViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
let counts = a.6.into_full(&a.1);
|
(
|
||||||
Self {
|
comment_reply,
|
||||||
comment_reply: a.0,
|
comment,
|
||||||
comment: a.1,
|
creator,
|
||||||
creator: a.2,
|
post,
|
||||||
post: a.3,
|
community,
|
||||||
community: a.4,
|
recipient,
|
||||||
recipient: a.5,
|
|
||||||
counts,
|
counts,
|
||||||
creator_banned_from_community: a.7,
|
creator_banned_from_community,
|
||||||
subscribed: a.8,
|
subscribed,
|
||||||
saved: a.9,
|
saved,
|
||||||
creator_blocked: a.10,
|
creator_blocked,
|
||||||
my_vote: a.11,
|
my_vote,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
counts: counts.into_full(&comment),
|
||||||
|
recipient: recipient.into_full(comment_reply.recipient_id),
|
||||||
|
community: community.into_full(post.community_id),
|
||||||
|
post: post.into_full(comment.post_id),
|
||||||
|
creator: creator.into_full(comment.creator_id),
|
||||||
|
comment: comment.into_full(comment_reply.comment_id),
|
||||||
|
comment_reply,
|
||||||
|
creator_banned_from_community,
|
||||||
|
subscribed,
|
||||||
|
saved,
|
||||||
|
creator_blocked,
|
||||||
|
my_vote,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,11 @@ use lemmy_db_schema::{
|
||||||
post,
|
post,
|
||||||
},
|
},
|
||||||
source::{
|
source::{
|
||||||
comment::Comment,
|
comment::CommentWithoutId,
|
||||||
community::{Community, CommunityFollower},
|
community::{CommunityWithoutId, CommunityFollower},
|
||||||
person::Person,
|
person::PersonWithoutId,
|
||||||
person_mention::PersonMention,
|
person_mention::PersonMention,
|
||||||
post::Post,
|
post::PostWithoutId,
|
||||||
},
|
},
|
||||||
traits::JoinView,
|
traits::JoinView,
|
||||||
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
utils::{get_conn, limit_and_offset, DbConn, DbPool, ListFn, Queries, ReadFn},
|
||||||
|
@ -43,11 +43,11 @@ use lemmy_db_schema::{
|
||||||
|
|
||||||
type PersonMentionViewTuple = (
|
type PersonMentionViewTuple = (
|
||||||
PersonMention,
|
PersonMention,
|
||||||
Comment,
|
CommentWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
Post,
|
PostWithoutId,
|
||||||
Community,
|
CommunityWithoutId,
|
||||||
Person,
|
PersonWithoutId,
|
||||||
CommentAggregatesNotInComment,
|
CommentAggregatesNotInComment,
|
||||||
bool,
|
bool,
|
||||||
SubscribedType,
|
SubscribedType,
|
||||||
|
@ -103,11 +103,11 @@ fn queries<'a>() -> Queries<
|
||||||
|
|
||||||
let selection = (
|
let selection = (
|
||||||
person_mention::all_columns,
|
person_mention::all_columns,
|
||||||
comment::all_columns,
|
CommentWithoutId::as_select(),
|
||||||
person::all_columns,
|
PersonWithoutId::as_select(),
|
||||||
post::all_columns,
|
PostWithoutId::as_select(),
|
||||||
community::all_columns,
|
CommunityWithoutId::as_select(),
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(PersonWithoutId::as_select()),
|
||||||
CommentAggregatesNotInComment::as_select(),
|
CommentAggregatesNotInComment::as_select(),
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
CommunityFollower::select_subscribed_type(),
|
CommunityFollower::select_subscribed_type(),
|
||||||
|
@ -235,21 +235,35 @@ impl PersonMentionQuery {
|
||||||
|
|
||||||
impl JoinView for PersonMentionView {
|
impl JoinView for PersonMentionView {
|
||||||
type JoinTuple = PersonMentionViewTuple;
|
type JoinTuple = PersonMentionViewTuple;
|
||||||
fn from_tuple(a: Self::JoinTuple) -> Self {
|
fn from_tuple(
|
||||||
let counts = a.6.into_full(&a.1);
|
(
|
||||||
Self {
|
person_mention,
|
||||||
person_mention: a.0,
|
comment,
|
||||||
comment: a.1,
|
creator,
|
||||||
creator: a.2,
|
post,
|
||||||
post: a.3,
|
community,
|
||||||
community: a.4,
|
recipient,
|
||||||
recipient: a.5,
|
|
||||||
counts,
|
counts,
|
||||||
creator_banned_from_community: a.7,
|
creator_banned_from_community,
|
||||||
subscribed: a.8,
|
subscribed,
|
||||||
saved: a.9,
|
saved,
|
||||||
creator_blocked: a.10,
|
creator_blocked,
|
||||||
my_vote: a.11,
|
my_vote,
|
||||||
|
): Self::JoinTuple,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
counts: counts.into_full(&comment),
|
||||||
|
recipient: recipient.into_full(person_mention.recipient_id),
|
||||||
|
community: community.into_full(post.community_id),
|
||||||
|
post: post.into_full(comment.post_id),
|
||||||
|
creator: creator.into_full(comment.creator_id),
|
||||||
|
comment: comment.into_full(person_mention.comment_id),
|
||||||
|
person_mention,
|
||||||
|
creator_banned_from_community,
|
||||||
|
subscribed,
|
||||||
|
saved,
|
||||||
|
creator_blocked,
|
||||||
|
my_vote,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue