Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

1.5 KB
Raw Blame
use common_utils::{encryption::Encryption, id_type};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use hyperswitch_masking::Secret;

use crate::schema::hierarchical_resources;

#[derive(
    Clone,
    Debug,
    Identifiable,
    Queryable,
    Selectable,
    router_derive::DebugAsDisplay,
    serde::Serialize,
    serde::Deserialize,
)]
#[diesel(table_name = hierarchical_resources, primary_key(id), check_for_backend(diesel::pg::Pg))]
pub struct HierarchicalResource {
    pub id: id_type::ResourceId,
    pub resource_type: String,
    pub scope: String,
    pub scope_id: String,
    pub data: Secret<serde_json::Value>,
    pub encrypted_data: Option<Encryption>,
    pub created_by: String,
    pub created_at: time::PrimitiveDateTime,
    pub modified_at: time::PrimitiveDateTime,
}

#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = hierarchical_resources)]
pub struct HierarchicalResourceNew {
    pub id: id_type::ResourceId,
    pub resource_type: String,
    pub scope: String,
    pub scope_id: String,
    pub data: Secret<serde_json::Value>,
    pub encrypted_data: Option<Encryption>,
    pub created_by: String,
    pub created_at: time::PrimitiveDateTime,
    pub modified_at: time::PrimitiveDateTime,
}

#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = hierarchical_resources)]
pub struct HierarchicalResourceUpdateInternal {
    pub data: Option<Secret<serde_json::Value>>,
    pub modified_at: time::PrimitiveDateTime,
}