entertainarr-adapter-http 0.1.0

HTTP adapter for entertainarr
Documentation
use crate::entity::tvshow::TvShowSource;
use crate::entity::{Couple, Entity};

crate::create_kind!(TvShowSubscriptionKind, "tvshow-subscriptions");

pub type TvShowSubscriptionEntity = Entity<Couple, TvShowSubscriptionKind>;

#[cfg_attr(feature = "facet", derive(facet::Facet))]
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct TvShowSubscriptionDocument {
    pub id: Couple, // (tvshow_id, user_id)
    pub kind: TvShowSubscriptionKind,
    pub attributes: TvShowSubscriptionAttributes,
}

#[cfg_attr(feature = "facet", derive(facet::Facet))]
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TvShowSubscriptionAttributes {
    pub created_at: chrono::DateTime<chrono::Utc>,
}

#[cfg_attr(feature = "facet", derive(facet::Facet))]
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TvShowSubscriptionCreateDocument {
    #[serde(rename = "type")]
    pub kind: TvShowSubscriptionKind,
    pub attributes: TvShowSubscriptionCreateAttributes,
}

impl TvShowSubscriptionCreateDocument {
    pub fn new(source: TvShowSource) -> Self {
        TvShowSubscriptionCreateDocument {
            kind: Default::default(),
            attributes: TvShowSubscriptionCreateAttributes { source },
        }
    }
}

#[cfg_attr(feature = "facet", derive(facet::Facet))]
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TvShowSubscriptionCreateAttributes {
    pub source: TvShowSource,
}