refactor(core): patch file for removal of id from schema (#5398)

Co-authored-by: Narayan Bhat <48803246+Narayanbhat166@users.noreply.github.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
This commit is contained in:
Prajjwal Kumar
2024-07-24 23:01:18 +05:30
committed by GitHub
parent 8e7de90684
commit ff3b9a2a12
37 changed files with 127 additions and 97 deletions

View File

@ -36,11 +36,11 @@ fn get_invalid_input_character(input_string: Cow<'static, str>) -> Option<char>
.find(|char| !is_valid_id_character(char))
}
#[derive(Debug, PartialEq, Serialize, Clone, Eq, Hash)]
#[derive(Debug, PartialEq, Hash, Serialize, Clone, Eq)]
/// A type for alphanumeric ids
pub(crate) struct AlphaNumericId(String);
#[derive(Debug, Deserialize, Serialize, Error, Eq, PartialEq)]
#[derive(Debug, Deserialize, Hash, Serialize, Error, Eq, PartialEq)]
#[error("value `{0}` contains invalid character `{1}`")]
/// The error type for alphanumeric id
pub(crate) struct AlphaNumericIdError(String, char);
@ -82,7 +82,7 @@ impl AlphaNumericId {
}
/// A common type of id that can be used for reference ids with length constraint
#[derive(Debug, Clone, Serialize, PartialEq, Eq, AsExpression, Hash)]
#[derive(Debug, Clone, Serialize, Hash, PartialEq, Eq, AsExpression)]
#[diesel(sql_type = sql_types::Text)]
pub(crate) struct LengthId<const MAX_LENGTH: u8, const MIN_LENGTH: u8>(AlphaNumericId);

View File

@ -17,7 +17,7 @@ use crate::{
};
/// A type for customer_id that can be used for customer ids
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, AsExpression)]
#[derive(Clone, Serialize, Deserialize, Hash, PartialEq, Eq, AsExpression)]
#[diesel(sql_type = sql_types::Text)]
pub struct CustomerId(
LengthId<MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH, MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH>,