mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
feat(customer_v2): add customer create v2 endpoint (#5444)
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in> Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: Prajjwal Kumar <prajjwal.kumar@juspay.in> Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -705,3 +705,62 @@ pub struct ChargeRefunds {
|
||||
}
|
||||
|
||||
crate::impl_to_sql_from_sql_json!(ChargeRefunds);
|
||||
|
||||
/// Domain type for description
|
||||
#[derive(
|
||||
Debug, Clone, PartialEq, Eq, Queryable, serde::Deserialize, serde::Serialize, AsExpression,
|
||||
)]
|
||||
#[diesel(sql_type = sql_types::Text)]
|
||||
pub struct Description(String);
|
||||
|
||||
impl Description {
|
||||
/// Create a new Description Domain type
|
||||
pub fn new(value: String) -> Self {
|
||||
Self(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Description> for String {
|
||||
fn from(description: Description) -> Self {
|
||||
description.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Description {
|
||||
fn from(description: String) -> Self {
|
||||
Self(description)
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB> Queryable<sql_types::Text, DB> for Description
|
||||
where
|
||||
DB: Backend,
|
||||
Self: FromSql<sql_types::Text, DB>,
|
||||
{
|
||||
type Row = Self;
|
||||
|
||||
fn build(row: Self::Row) -> deserialize::Result<Self> {
|
||||
Ok(row)
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB> FromSql<sql_types::Text, DB> for Description
|
||||
where
|
||||
DB: Backend,
|
||||
String: FromSql<sql_types::Text, DB>,
|
||||
{
|
||||
fn from_sql(bytes: DB::RawValue<'_>) -> deserialize::Result<Self> {
|
||||
let val = String::from_sql(bytes)?;
|
||||
Ok(Self::from(val))
|
||||
}
|
||||
}
|
||||
|
||||
impl<DB> ToSql<sql_types::Text, DB> for Description
|
||||
where
|
||||
DB: Backend,
|
||||
String: ToSql<sql_types::Text, DB>,
|
||||
{
|
||||
fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, DB>) -> diesel::serialize::Result {
|
||||
self.0.to_sql(out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user