lemmy_db_schema/source/
local_user_vote_display_mode.rs1use crate::newtypes::LocalUserId;
2#[cfg(feature = "full")]
3use crate::schema::local_user_vote_display_mode;
4use serde::{Deserialize, Serialize};
5use serde_with::skip_serializing_none;
6#[cfg(feature = "full")]
7use ts_rs::TS;
8use typed_builder::TypedBuilder;
9
10#[skip_serializing_none]
11#[derive(PartialEq, Eq, Debug, Clone, Default, Serialize, Deserialize)]
12#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
13#[cfg_attr(feature = "full", diesel(table_name = local_user_vote_display_mode))]
14#[cfg_attr(feature = "full", diesel(primary_key(local_user_id)))]
15#[cfg_attr(
16  feature = "full",
17  diesel(belongs_to(crate::source::local_site::LocalUser))
18)]
19#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
20#[cfg_attr(feature = "full", ts(export))]
21pub struct LocalUserVoteDisplayMode {
23  pub local_user_id: LocalUserId,
24  pub score: bool,
25  pub upvotes: bool,
26  pub downvotes: bool,
27  pub upvote_percentage: bool,
28}
29
30#[derive(Clone, TypedBuilder)]
31#[builder(field_defaults(default))]
32#[cfg_attr(feature = "full", derive(Insertable))]
33#[cfg_attr(feature = "full", diesel(table_name = local_user_vote_display_mode))]
34pub struct LocalUserVoteDisplayModeInsertForm {
35  #[builder(!default)]
36  pub local_user_id: LocalUserId,
37  pub score: Option<bool>,
38  pub upvotes: Option<bool>,
39  pub downvotes: Option<bool>,
40  pub upvote_percentage: Option<bool>,
41}
42
43#[derive(Clone, Default)]
44#[cfg_attr(feature = "full", derive(AsChangeset))]
45#[cfg_attr(feature = "full", diesel(table_name = local_user_vote_display_mode))]
46pub struct LocalUserVoteDisplayModeUpdateForm {
47  pub score: Option<bool>,
48  pub upvotes: Option<bool>,
49  pub downvotes: Option<bool>,
50  pub upvote_percentage: Option<bool>,
51}