mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
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:
@ -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);
|
||||
|
||||
|
||||
@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user