community_block,
community_follower,
community_person_ban,
- language,
local_user_language,
person,
person_block,
},
source::{
community::{Community, CommunityFollower, CommunityPersonBan, CommunitySafe},
- language::Language,
local_user::LocalUser,
person::{Person, PersonSafe},
person_block::PersonBlock,
Option<PostRead>,
Option<PersonBlock>,
Option<i16>,
- Language,
);
impl PostView {
read,
creator_blocked,
post_like,
- language,
) = post::table
.find(post_id)
.inner_join(person::table)
.and(post_like::person_id.eq(person_id_join)),
),
)
- .inner_join(language::table)
.select((
post::all_columns,
Person::safe_columns_tuple(),
post_read::all_columns.nullable(),
person_block::all_columns.nullable(),
post_like::score.nullable(),
- language::all_columns,
))
.first::<PostViewTuple>(conn)?;
read: read.is_some(),
creator_blocked: creator_blocked.is_some(),
my_vote,
- language,
})
}
}
.and(post_like::person_id.eq(person_id_join)),
),
)
- .inner_join(language::table)
.left_join(
local_user_language::table.on(
post::language_id
post_read::all_columns.nullable(),
person_block::all_columns.nullable(),
post_like::score.nullable(),
- language::all_columns,
))
.into_boxed();
read: a.7.is_some(),
creator_blocked: a.8.is_some(),
my_vote: a.9,
- language: a.10,
})
.collect::<Vec<Self>>()
}
read: false,
saved: false,
creator_blocked: false,
- language: Language {
- id: LanguageId(47),
- code: "fr".to_string(),
- name: "Français".to_string(),
- },
}
}
}
pub read: bool, // Left join to PostRead
pub creator_blocked: bool, // Left join to PersonBlock
pub my_vote: Option<i16>, // Left join to PostLike
- pub language: Language,
}
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]