Adding Selectable and diesel postgres backend check. (#4175)

This commit is contained in:
Dessalines 2023-11-21 08:42:28 -05:00 committed by GitHub
parent 1c03a86c17
commit 82b30b5467
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 274 additions and 77 deletions

View file

@ -13,10 +13,14 @@ use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use ts_rs::TS; use ts_rs::TS;
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = comment_aggregates))] #[cfg_attr(feature = "full", diesel(table_name = comment_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(primary_key(comment_id)))] #[cfg_attr(feature = "full", diesel(primary_key(comment_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// Aggregate data for a comment. /// Aggregate data for a comment.
pub struct CommentAggregates { pub struct CommentAggregates {
@ -34,7 +38,10 @@ pub struct CommentAggregates {
} }
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = community_aggregates))] #[cfg_attr(feature = "full", diesel(table_name = community_aggregates))]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
@ -62,10 +69,14 @@ pub struct CommunityAggregates {
} }
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Default)] #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Default)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = person_aggregates))] #[cfg_attr(feature = "full", diesel(table_name = person_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// Aggregate data for a person. /// Aggregate data for a person.
pub struct PersonAggregates { pub struct PersonAggregates {
@ -79,10 +90,14 @@ pub struct PersonAggregates {
} }
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = post_aggregates))] #[cfg_attr(feature = "full", diesel(table_name = post_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
#[cfg_attr(feature = "full", diesel(primary_key(post_id)))] #[cfg_attr(feature = "full", diesel(primary_key(post_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// Aggregate data for a post. /// Aggregate data for a post.
pub struct PostAggregates { pub struct PostAggregates {
@ -122,10 +137,14 @@ pub struct PostAggregates {
} }
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable)
)]
#[cfg_attr(feature = "full", diesel(table_name = person_post_aggregates))] #[cfg_attr(feature = "full", diesel(table_name = person_post_aggregates))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
/// Aggregate data for a person's post. /// Aggregate data for a person's post.
pub struct PersonPostAggregates { pub struct PersonPostAggregates {
pub person_id: PersonId, pub person_id: PersonId,
@ -148,10 +167,14 @@ pub struct PersonPostAggregatesForm {
} }
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = site_aggregates))] #[cfg_attr(feature = "full", diesel(table_name = site_aggregates))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
#[cfg_attr(feature = "full", diesel(primary_key(site_id)))] #[cfg_attr(feature = "full", diesel(primary_key(site_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// Aggregate data for a site. /// Aggregate data for a site.
pub struct SiteAggregates { pub struct SiteAggregates {

View file

@ -1,6 +1,6 @@
use crate::{ use crate::{
newtypes::{ActivityId, CommunityId, DbUrl}, newtypes::{ActivityId, CommunityId, DbUrl},
schema::sent_activity, schema::{received_activity, sent_activity},
}; };
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use diesel::{sql_types::Nullable, Queryable}; use diesel::{sql_types::Nullable, Queryable};
@ -51,8 +51,10 @@ impl ActivitySendTargets {
} }
} }
#[derive(PartialEq, Eq, Debug, Queryable)] #[derive(PartialEq, Eq, Debug)]
#[diesel(table_name = sent_activity)] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", diesel(table_name = sent_activity))]
pub struct SentActivity { pub struct SentActivity {
pub id: ActivityId, pub id: ActivityId,
pub ap_id: DbUrl, pub ap_id: DbUrl,
@ -66,8 +68,8 @@ pub struct SentActivity {
pub actor_apub_id: Option<DbUrl>, pub actor_apub_id: Option<DbUrl>,
} }
#[derive(Insertable)] #[cfg_attr(feature = "full", derive(Insertable))]
#[diesel(table_name = sent_activity)] #[cfg_attr(feature = "full", diesel(table_name = sent_activity))]
pub struct SentActivityForm { pub struct SentActivityForm {
pub ap_id: DbUrl, pub ap_id: DbUrl,
pub data: Value, pub data: Value,
@ -87,10 +89,12 @@ pub enum ActorType {
Person, Person,
} }
#[derive(PartialEq, Eq, Debug, Queryable)] #[derive(PartialEq, Eq, Debug)]
#[diesel(table_name = received_activity)] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(primary_key(ap_id)))]
#[cfg_attr(feature = "full", diesel(table_name = received_activity))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct ReceivedActivity { pub struct ReceivedActivity {
pub id: i64,
pub ap_id: DbUrl, pub ap_id: DbUrl,
pub published: DateTime<Utc>, pub published: DateTime<Utc>,
} }

View file

@ -4,9 +4,10 @@ use crate::schema::local_user_language;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = local_user_language))] #[cfg_attr(feature = "full", diesel(table_name = local_user_language))]
#[cfg_attr(feature = "full", diesel(primary_key(local_user_id, language_id)))] #[cfg_attr(feature = "full", diesel(primary_key(local_user_id, language_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct LocalUserLanguage { pub struct LocalUserLanguage {
pub local_user_id: LocalUserId, pub local_user_id: LocalUserId,
pub language_id: LanguageId, pub language_id: LanguageId,
@ -24,9 +25,10 @@ pub struct LocalUserLanguageForm {
use crate::schema::community_language; use crate::schema::community_language;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = community_language))] #[cfg_attr(feature = "full", diesel(table_name = community_language))]
#[cfg_attr(feature = "full", diesel(primary_key(community_id, language_id)))] #[cfg_attr(feature = "full", diesel(primary_key(community_id, language_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommunityLanguage { pub struct CommunityLanguage {
pub community_id: CommunityId, pub community_id: CommunityId,
pub language_id: LanguageId, pub language_id: LanguageId,
@ -44,9 +46,10 @@ pub struct CommunityLanguageForm {
use crate::schema::site_language; use crate::schema::site_language;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = site_language))] #[cfg_attr(feature = "full", diesel(table_name = site_language))]
#[cfg_attr(feature = "full", diesel(primary_key(site_id, language_id)))] #[cfg_attr(feature = "full", diesel(primary_key(site_id, language_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct SiteLanguage { pub struct SiteLanguage {
pub site_id: SiteId, pub site_id: SiteId,
pub language_id: LanguageId, pub language_id: LanguageId,

View file

@ -7,8 +7,9 @@ use uuid::Uuid;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable))]
#[cfg_attr(feature = "full", diesel(table_name = captcha_answer))] #[cfg_attr(feature = "full", diesel(table_name = captcha_answer))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CaptchaAnswer { pub struct CaptchaAnswer {
pub uuid: Uuid, pub uuid: Uuid,
pub answer: String, pub answer: String,
@ -17,8 +18,9 @@ pub struct CaptchaAnswer {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable))]
#[cfg_attr(feature = "full", diesel(table_name = captcha_answer))] #[cfg_attr(feature = "full", diesel(table_name = captcha_answer))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CheckCaptchaAnswer { pub struct CheckCaptchaAnswer {
pub uuid: Uuid, pub uuid: Uuid,
pub answer: String, pub answer: String,

View file

@ -14,10 +14,14 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
#[cfg_attr(feature = "full", diesel(table_name = comment))] #[cfg_attr(feature = "full", diesel(table_name = comment))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
/// A comment. /// A comment.
pub struct Comment { pub struct Comment {
pub id: CommentId, pub id: CommentId,
@ -83,10 +87,14 @@ pub struct CommentUpdateForm {
} }
#[derive(PartialEq, Eq, Debug, Clone)] #[derive(PartialEq, Eq, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = comment_like))] #[cfg_attr(feature = "full", diesel(table_name = comment_like))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommentLike { pub struct CommentLike {
pub person_id: PersonId, pub person_id: PersonId,
pub comment_id: CommentId, pub comment_id: CommentId,
@ -106,10 +114,14 @@ pub struct CommentLikeForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = comment_saved))] #[cfg_attr(feature = "full", diesel(table_name = comment_saved))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommentSaved { pub struct CommentSaved {
pub comment_id: CommentId, pub comment_id: CommentId,
pub person_id: PersonId, pub person_id: PersonId,

View file

@ -7,9 +7,13 @@ use serde::{Deserialize, Serialize};
use ts_rs::TS; use ts_rs::TS;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = comment_reply))] #[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A comment reply. /// A comment reply.
pub struct CommentReply { pub struct CommentReply {

View file

@ -9,9 +9,13 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = comment_report))] #[cfg_attr(feature = "full", diesel(table_name = comment_report))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A comment report. /// A comment report.
pub struct CommentReport { pub struct CommentReport {

View file

@ -13,8 +13,9 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = community))] #[cfg_attr(feature = "full", diesel(table_name = community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A community. /// A community.
pub struct Community { pub struct Community {
@ -128,13 +129,17 @@ pub struct CommunityUpdateForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::community::Community)) diesel(belongs_to(crate::source::community::Community))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = community_moderator))] #[cfg_attr(feature = "full", diesel(table_name = community_moderator))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommunityModerator { pub struct CommunityModerator {
pub community_id: CommunityId, pub community_id: CommunityId,
pub person_id: PersonId, pub person_id: PersonId,
@ -150,13 +155,17 @@ pub struct CommunityModeratorForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::community::Community)) diesel(belongs_to(crate::source::community::Community))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))] #[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommunityPersonBan { pub struct CommunityPersonBan {
pub community_id: CommunityId, pub community_id: CommunityId,
pub person_id: PersonId, pub person_id: PersonId,
@ -174,13 +183,17 @@ pub struct CommunityPersonBanForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::community::Community)) diesel(belongs_to(crate::source::community::Community))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = community_follower))] #[cfg_attr(feature = "full", diesel(table_name = community_follower))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommunityFollower { pub struct CommunityFollower {
pub community_id: CommunityId, pub community_id: CommunityId,
pub person_id: PersonId, pub person_id: PersonId,

View file

@ -5,13 +5,17 @@ use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::community::Community)) diesel(belongs_to(crate::source::community::Community))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = community_block))] #[cfg_attr(feature = "full", diesel(table_name = community_block))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct CommunityBlock { pub struct CommunityBlock {
pub person_id: PersonId, pub person_id: PersonId,
pub community_id: CommunityId, pub community_id: CommunityId,

View file

@ -10,12 +10,16 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji))] #[cfg_attr(feature = "full", diesel(table_name = custom_emoji))]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::local_site::LocalSite)) diesel(belongs_to(crate::source::local_site::LocalSite))
)] )]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A custom emoji. /// A custom emoji.
pub struct CustomEmoji { pub struct CustomEmoji {

View file

@ -7,13 +7,17 @@ use ts_rs::TS;
use typed_builder::TypedBuilder; use typed_builder::TypedBuilder;
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))] #[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::custom_emoji::CustomEmoji)) diesel(belongs_to(crate::source::custom_emoji::CustomEmoji))
)] )]
#[cfg_attr(feature = "full", diesel(primary_key(custom_emoji_id, keyword)))] #[cfg_attr(feature = "full", diesel(primary_key(custom_emoji_id, keyword)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A custom keyword for an emoji. /// A custom keyword for an emoji.
pub struct CustomEmojiKeyword { pub struct CustomEmojiKeyword {

View file

@ -4,13 +4,14 @@ use crate::schema::email_verification;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = email_verification))] #[cfg_attr(feature = "full", diesel(table_name = email_verification))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct EmailVerification { pub struct EmailVerification {
pub id: i32, pub id: i32,
pub local_user_id: LocalUserId, pub local_user_id: LocalUserId,
pub email: String, pub email: String,
pub verification_code: String, pub verification_token: String,
pub published: DateTime<Utc>, pub published: DateTime<Utc>,
} }

View file

@ -6,13 +6,17 @@ use serde::{Deserialize, Serialize};
use std::fmt::Debug; use std::fmt::Debug;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::instance::Instance)) diesel(belongs_to(crate::source::instance::Instance))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = federation_allowlist))] #[cfg_attr(feature = "full", diesel(table_name = federation_allowlist))]
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))] #[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct FederationAllowList { pub struct FederationAllowList {
pub instance_id: InstanceId, pub instance_id: InstanceId,
pub published: DateTime<Utc>, pub published: DateTime<Utc>,

View file

@ -6,13 +6,17 @@ use serde::{Deserialize, Serialize};
use std::fmt::Debug; use std::fmt::Debug;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::instance::Instance)) diesel(belongs_to(crate::source::instance::Instance))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = federation_blocklist))] #[cfg_attr(feature = "full", diesel(table_name = federation_blocklist))]
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))] #[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct FederationBlockList { pub struct FederationBlockList {
pub instance_id: InstanceId, pub instance_id: InstanceId,
pub published: DateTime<Utc>, pub published: DateTime<Utc>,

View file

@ -11,7 +11,10 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = image_upload))] #[cfg_attr(feature = "full", diesel(table_name = image_upload))]
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))] #[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
@ -19,6 +22,7 @@ use typed_builder::TypedBuilder;
feature = "full", feature = "full",
diesel(belongs_to(crate::source::local_user::LocalUser)) diesel(belongs_to(crate::source::local_user::LocalUser))
)] )]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct ImageUpload { pub struct ImageUpload {
pub local_user_id: LocalUserId, pub local_user_id: LocalUserId,
pub pictrs_alias: String, pub pictrs_alias: String,

View file

@ -13,6 +13,7 @@ use typed_builder::TypedBuilder;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = instance))] #[cfg_attr(feature = "full", diesel(table_name = instance))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A federated instance / site. /// A federated instance / site.
pub struct Instance { pub struct Instance {

View file

@ -5,13 +5,17 @@ use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::instance::Instance)) diesel(belongs_to(crate::source::instance::Instance))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = instance_block))] #[cfg_attr(feature = "full", diesel(table_name = instance_block))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, instance_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, instance_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct InstanceBlock { pub struct InstanceBlock {
pub person_id: PersonId, pub person_id: PersonId,
pub instance_id: InstanceId, pub instance_id: InstanceId,

View file

@ -6,8 +6,9 @@ use serde::{Deserialize, Serialize};
use ts_rs::TS; use ts_rs::TS;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = language))] #[cfg_attr(feature = "full", diesel(table_name = language))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A language. /// A language.
pub struct Language { pub struct Language {

View file

@ -17,6 +17,7 @@ use typed_builder::TypedBuilder;
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = local_site))] #[cfg_attr(feature = "full", diesel(table_name = local_site))]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// The local site. /// The local site.
pub struct LocalSite { pub struct LocalSite {

View file

@ -10,13 +10,14 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = local_site_rate_limit))] #[cfg_attr(feature = "full", diesel(table_name = local_site_rate_limit))]
#[cfg_attr(feature = "full", diesel(primary_key(local_site_id)))] #[cfg_attr(feature = "full", diesel(primary_key(local_site_id)))]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::local_site::LocalSite)) diesel(belongs_to(crate::source::local_site::LocalSite))
)] )]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// Rate limits for your site. Given in count / length of time. /// Rate limits for your site. Given in count / length of time.
pub struct LocalSiteRateLimit { pub struct LocalSiteRateLimit {

View file

@ -14,8 +14,9 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = local_user))] #[cfg_attr(feature = "full", diesel(table_name = local_user))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A local user. /// A local user.
pub struct LocalUser { pub struct LocalUser {

View file

@ -1,12 +1,12 @@
use crate::newtypes::{LanguageId, LocalUserId, LocalUserLanguageId}; use crate::newtypes::{LanguageId, LocalUserId, LocalUserLanguageId};
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::schema::local_user_language; use crate::schema::local_user_language;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = local_user_language))] #[cfg_attr(feature = "full", diesel(table_name = local_user_language))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct LocalUserLanguage { pub struct LocalUserLanguage {
#[serde(skip)] #[serde(skip)]
pub id: LocalUserLanguageId, pub id: LocalUserLanguageId,

View file

@ -10,9 +10,10 @@ use ts_rs::TS;
/// Stores data related to a specific user login session. /// Stores data related to a specific user login session.
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = login_token))] #[cfg_attr(feature = "full", diesel(table_name = login_token))]
#[cfg_attr(feature = "full", diesel(primary_key(token)))] #[cfg_attr(feature = "full", diesel(primary_key(token)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
pub struct LoginToken { pub struct LoginToken {
/// Jwt token for this login /// Jwt token for this login

View file

@ -25,8 +25,9 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))] #[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator removes a post. /// When a moderator removes a post.
pub struct ModRemovePost { pub struct ModRemovePost {
@ -48,8 +49,9 @@ pub struct ModRemovePostForm {
} }
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))] #[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator locks a post (prevents new comments being made). /// When a moderator locks a post (prevents new comments being made).
pub struct ModLockPost { pub struct ModLockPost {
@ -69,8 +71,9 @@ pub struct ModLockPostForm {
} }
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))] #[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator features a post on a community (pins it to the top). /// When a moderator features a post on a community (pins it to the top).
pub struct ModFeaturePost { pub struct ModFeaturePost {
@ -93,8 +96,9 @@ pub struct ModFeaturePostForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))] #[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator removes a comment. /// When a moderator removes a comment.
pub struct ModRemoveComment { pub struct ModRemoveComment {
@ -117,8 +121,9 @@ pub struct ModRemoveCommentForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))] #[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator removes a community. /// When a moderator removes a community.
pub struct ModRemoveCommunity { pub struct ModRemoveCommunity {
@ -141,8 +146,9 @@ pub struct ModRemoveCommunityForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))] #[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is banned from a community. /// When someone is banned from a community.
pub struct ModBanFromCommunity { pub struct ModBanFromCommunity {
@ -169,8 +175,9 @@ pub struct ModBanFromCommunityForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_ban))] #[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is banned from the site. /// When someone is banned from the site.
pub struct ModBan { pub struct ModBan {
@ -194,8 +201,9 @@ pub struct ModHideCommunityForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))] #[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a community is hidden from public view. /// When a community is hidden from public view.
pub struct ModHideCommunity { pub struct ModHideCommunity {
@ -218,8 +226,9 @@ pub struct ModBanForm {
} }
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_add_community))] #[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is added as a community moderator. /// When someone is added as a community moderator.
pub struct ModAddCommunity { pub struct ModAddCommunity {
@ -241,8 +250,9 @@ pub struct ModAddCommunityForm {
} }
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))] #[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator transfers a community to a new owner. /// When a moderator transfers a community to a new owner.
pub struct ModTransferCommunity { pub struct ModTransferCommunity {
@ -262,8 +272,9 @@ pub struct ModTransferCommunityForm {
} }
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = mod_add))] #[cfg_attr(feature = "full", diesel(table_name = mod_add))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is added as a site moderator. /// When someone is added as a site moderator.
pub struct ModAdd { pub struct ModAdd {
@ -284,8 +295,9 @@ pub struct ModAddForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a person. /// When an admin purges a person.
pub struct AdminPurgePerson { pub struct AdminPurgePerson {
@ -304,8 +316,9 @@ pub struct AdminPurgePersonForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a community. /// When an admin purges a community.
pub struct AdminPurgeCommunity { pub struct AdminPurgeCommunity {
@ -324,8 +337,9 @@ pub struct AdminPurgeCommunityForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a post. /// When an admin purges a post.
pub struct AdminPurgePost { pub struct AdminPurgePost {
@ -346,8 +360,9 @@ pub struct AdminPurgePostForm {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))] #[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a comment. /// When an admin purges a comment.
pub struct AdminPurgeComment { pub struct AdminPurgeComment {

View file

@ -4,8 +4,9 @@ use crate::schema::password_reset_request;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = password_reset_request))] #[cfg_attr(feature = "full", diesel(table_name = password_reset_request))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct PasswordResetRequest { pub struct PasswordResetRequest {
pub id: i32, pub id: i32,
pub token: String, pub token: String,

View file

@ -13,8 +13,9 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = person))] #[cfg_attr(feature = "full", diesel(table_name = person))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A person. /// A person.
pub struct Person { pub struct Person {
@ -112,10 +113,14 @@ pub struct PersonUpdateForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
#[cfg_attr(feature = "full", diesel(table_name = person_follower))] #[cfg_attr(feature = "full", diesel(table_name = person_follower))]
#[cfg_attr(feature = "full", diesel(primary_key(follower_id, person_id)))] #[cfg_attr(feature = "full", diesel(primary_key(follower_id, person_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct PersonFollower { pub struct PersonFollower {
pub person_id: PersonId, pub person_id: PersonId,
pub follower_id: PersonId, pub follower_id: PersonId,

View file

@ -5,10 +5,14 @@ use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
#[cfg_attr(feature = "full", diesel(table_name = person_block))] #[cfg_attr(feature = "full", diesel(table_name = person_block))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, target_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, target_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct PersonBlock { pub struct PersonBlock {
pub person_id: PersonId, pub person_id: PersonId,
pub target_id: PersonId, pub target_id: PersonId,

View file

@ -7,9 +7,13 @@ use serde::{Deserialize, Serialize};
use ts_rs::TS; use ts_rs::TS;
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
#[cfg_attr(feature = "full", diesel(table_name = person_mention))] #[cfg_attr(feature = "full", diesel(table_name = person_mention))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A person mention. /// A person mention.
pub struct PersonMention { pub struct PersonMention {

View file

@ -10,9 +10,10 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = post))] #[cfg_attr(feature = "full", diesel(table_name = post))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
/// A post. /// A post.
pub struct Post { pub struct Post {
pub id: PostId, pub id: PostId,
@ -111,10 +112,14 @@ pub struct PostUpdateForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
#[cfg_attr(feature = "full", diesel(table_name = post_like))] #[cfg_attr(feature = "full", diesel(table_name = post_like))]
#[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))] #[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct PostLike { pub struct PostLike {
pub post_id: PostId, pub post_id: PostId,
pub person_id: PersonId, pub person_id: PersonId,
@ -132,10 +137,14 @@ pub struct PostLikeForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
#[cfg_attr(feature = "full", diesel(table_name = post_saved))] #[cfg_attr(feature = "full", diesel(table_name = post_saved))]
#[cfg_attr(feature = "full", diesel(primary_key(post_id, person_id)))] #[cfg_attr(feature = "full", diesel(primary_key(post_id, person_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct PostSaved { pub struct PostSaved {
pub post_id: PostId, pub post_id: PostId,
pub person_id: PersonId, pub person_id: PersonId,
@ -150,11 +159,15 @@ pub struct PostSavedForm {
} }
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
#[cfg_attr(feature = "full", diesel(table_name = post_read))] #[cfg_attr(feature = "full", diesel(table_name = post_read))]
#[cfg_attr(feature = "full", diesel(primary_key(post_id, person_id)))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct PostRead { pub struct PostRead {
pub id: i32,
pub post_id: PostId, pub post_id: PostId,
pub person_id: PersonId, pub person_id: PersonId,
pub published: DateTime<Utc>, pub published: DateTime<Utc>,

View file

@ -9,9 +9,13 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations, TS))] #[cfg_attr(
feature = "full",
derive(Identifiable, Queryable, Selectable, Associations, TS)
)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc? #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc?
#[cfg_attr(feature = "full", diesel(table_name = post_report))] #[cfg_attr(feature = "full", diesel(table_name = post_report))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A post report. /// A post report.
pub struct PostReport { pub struct PostReport {

View file

@ -10,12 +10,16 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::person::Person, foreign_key = creator_id) diesel(belongs_to(crate::source::person::Person, foreign_key = creator_id)
))] // Is this the right assoc? ))] // Is this the right assoc?
#[cfg_attr(feature = "full", diesel(table_name = private_message))] #[cfg_attr(feature = "full", diesel(table_name = private_message))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A private message. /// A private message.
pub struct PrivateMessage { pub struct PrivateMessage {

View file

@ -9,12 +9,16 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)] #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::private_message::PrivateMessage)) diesel(belongs_to(crate::source::private_message::PrivateMessage))
)] )]
#[cfg_attr(feature = "full", diesel(table_name = private_message_report))] #[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// The private message report. /// The private message report.
pub struct PrivateMessageReport { pub struct PrivateMessageReport {

View file

@ -9,8 +9,9 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)] #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = registration_application))] #[cfg_attr(feature = "full", diesel(table_name = registration_application))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A registration application. /// A registration application.
pub struct RegistrationApplication { pub struct RegistrationApplication {

View file

@ -2,8 +2,9 @@
use crate::schema::secret; use crate::schema::secret;
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
#[cfg_attr(feature = "full", diesel(table_name = secret))] #[cfg_attr(feature = "full", diesel(table_name = secret))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
pub struct Secret { pub struct Secret {
pub id: i32, pub id: i32,
pub jwt_secret: String, pub jwt_secret: String,

View file

@ -10,8 +10,9 @@ use typed_builder::TypedBuilder;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))] #[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
#[cfg_attr(feature = "full", diesel(table_name = site))] #[cfg_attr(feature = "full", diesel(table_name = site))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// The site. /// The site.
pub struct Site { pub struct Site {

View file

@ -9,12 +9,16 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)] #[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))] #[cfg_attr(
feature = "full",
derive(Queryable, Selectable, Associations, Identifiable, TS)
)]
#[cfg_attr(feature = "full", diesel(table_name = tagline))] #[cfg_attr(feature = "full", diesel(table_name = tagline))]
#[cfg_attr( #[cfg_attr(
feature = "full", feature = "full",
diesel(belongs_to(crate::source::local_site::LocalSite)) diesel(belongs_to(crate::source::local_site::LocalSite))
)] )]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A tagline, shown at the top of your site. /// A tagline, shown at the top of your site.
pub struct Tagline { pub struct Tagline {

View file

@ -29,6 +29,7 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A comment report view. /// A comment report view.
pub struct CommentReportView { pub struct CommentReportView {
@ -47,6 +48,7 @@ pub struct CommentReportView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A comment view. /// A comment view.
pub struct CommentView { pub struct CommentView {
@ -65,6 +67,7 @@ pub struct CommentView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A local user view. /// A local user view.
pub struct LocalUserView { pub struct LocalUserView {
@ -76,6 +79,7 @@ pub struct LocalUserView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A post report view. /// A post report view.
pub struct PostReportView { pub struct PostReportView {
@ -101,6 +105,7 @@ pub struct PaginationCursor(pub(crate) String);
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A post view. /// A post view.
pub struct PostView { pub struct PostView {
@ -120,6 +125,7 @@ pub struct PostView {
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A private message view. /// A private message view.
pub struct PrivateMessageView { pub struct PrivateMessageView {
@ -131,6 +137,7 @@ pub struct PrivateMessageView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A private message report view. /// A private message report view.
pub struct PrivateMessageReportView { pub struct PrivateMessageReportView {
@ -144,6 +151,7 @@ pub struct PrivateMessageReportView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A registration application view. /// A registration application view.
pub struct RegistrationApplicationView { pub struct RegistrationApplicationView {
@ -155,6 +163,7 @@ pub struct RegistrationApplicationView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A site view. /// A site view.
pub struct SiteView { pub struct SiteView {
@ -165,7 +174,8 @@ pub struct SiteView {
} }
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A custom emoji view. /// A custom emoji view.
pub struct CustomEmojiView { pub struct CustomEmojiView {

View file

@ -21,6 +21,7 @@ use ts_rs::TS;
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A community block. /// A community block.
pub struct CommunityBlockView { pub struct CommunityBlockView {
@ -31,6 +32,7 @@ pub struct CommunityBlockView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// An instance block by a user. /// An instance block by a user.
pub struct InstanceBlockView { pub struct InstanceBlockView {
@ -41,6 +43,7 @@ pub struct InstanceBlockView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A community follower. /// A community follower.
pub struct CommunityFollowerView { pub struct CommunityFollowerView {
@ -50,6 +53,7 @@ pub struct CommunityFollowerView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A community moderator. /// A community moderator.
pub struct CommunityModeratorView { pub struct CommunityModeratorView {
@ -59,6 +63,7 @@ pub struct CommunityModeratorView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable))] #[cfg_attr(feature = "full", derive(Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
/// A community person ban. /// A community person ban.
pub struct CommunityPersonBanView { pub struct CommunityPersonBanView {
pub community: Community, pub community: Community,
@ -67,6 +72,7 @@ pub struct CommunityPersonBanView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A community view. /// A community view.
pub struct CommunityView { pub struct CommunityView {
@ -78,6 +84,7 @@ pub struct CommunityView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A person block. /// A person block.
pub struct PersonBlockView { pub struct PersonBlockView {
@ -88,6 +95,7 @@ pub struct PersonBlockView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A person mention view. /// A person mention view.
pub struct PersonMentionView { pub struct PersonMentionView {
@ -109,6 +117,7 @@ pub struct PersonMentionView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A comment reply view. /// A comment reply view.
pub struct CommentReplyView { pub struct CommentReplyView {
@ -129,6 +138,7 @@ pub struct CommentReplyView {
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// A person view. /// A person view.
pub struct PersonView { pub struct PersonView {

View file

@ -34,6 +34,7 @@ use ts_rs::TS;
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is added as a community moderator. /// When someone is added as a community moderator.
pub struct ModAddCommunityView { pub struct ModAddCommunityView {
@ -46,6 +47,7 @@ pub struct ModAddCommunityView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is added as a site moderator. /// When someone is added as a site moderator.
pub struct ModAddView { pub struct ModAddView {
@ -57,6 +59,7 @@ pub struct ModAddView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is banned from a community. /// When someone is banned from a community.
pub struct ModBanFromCommunityView { pub struct ModBanFromCommunityView {
@ -69,6 +72,7 @@ pub struct ModBanFromCommunityView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When someone is banned from the site. /// When someone is banned from the site.
pub struct ModBanView { pub struct ModBanView {
@ -80,6 +84,7 @@ pub struct ModBanView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a community is hidden from public view. /// When a community is hidden from public view.
pub struct ModHideCommunityView { pub struct ModHideCommunityView {
@ -91,6 +96,7 @@ pub struct ModHideCommunityView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator locks a post (prevents new comments being made). /// When a moderator locks a post (prevents new comments being made).
pub struct ModLockPostView { pub struct ModLockPostView {
@ -103,6 +109,7 @@ pub struct ModLockPostView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator removes a comment. /// When a moderator removes a comment.
pub struct ModRemoveCommentView { pub struct ModRemoveCommentView {
@ -117,6 +124,7 @@ pub struct ModRemoveCommentView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator removes a community. /// When a moderator removes a community.
pub struct ModRemoveCommunityView { pub struct ModRemoveCommunityView {
@ -128,6 +136,7 @@ pub struct ModRemoveCommunityView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator removes a post. /// When a moderator removes a post.
pub struct ModRemovePostView { pub struct ModRemovePostView {
@ -140,6 +149,7 @@ pub struct ModRemovePostView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator features a post on a community (pins it to the top). /// When a moderator features a post on a community (pins it to the top).
pub struct ModFeaturePostView { pub struct ModFeaturePostView {
@ -152,6 +162,7 @@ pub struct ModFeaturePostView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When a moderator transfers a community to a new owner. /// When a moderator transfers a community to a new owner.
pub struct ModTransferCommunityView { pub struct ModTransferCommunityView {
@ -164,6 +175,7 @@ pub struct ModTransferCommunityView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a comment. /// When an admin purges a comment.
pub struct AdminPurgeCommentView { pub struct AdminPurgeCommentView {
@ -175,6 +187,7 @@ pub struct AdminPurgeCommentView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a community. /// When an admin purges a community.
pub struct AdminPurgeCommunityView { pub struct AdminPurgeCommunityView {
@ -185,6 +198,7 @@ pub struct AdminPurgeCommunityView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a person. /// When an admin purges a person.
pub struct AdminPurgePersonView { pub struct AdminPurgePersonView {
@ -195,6 +209,7 @@ pub struct AdminPurgePersonView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// When an admin purges a post. /// When an admin purges a post.
pub struct AdminPurgePostView { pub struct AdminPurgePostView {
@ -206,6 +221,7 @@ pub struct AdminPurgePostView {
#[skip_serializing_none] #[skip_serializing_none]
#[derive(Debug, Serialize, Deserialize, Clone, Copy)] #[derive(Debug, Serialize, Deserialize, Clone, Copy)]
#[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", derive(TS, Queryable))]
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
#[cfg_attr(feature = "full", ts(export))] #[cfg_attr(feature = "full", ts(export))]
/// Querying / filtering the modlog. /// Querying / filtering the modlog.
pub struct ModlogListParams { pub struct ModlogListParams {