mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 03:13:56 +08:00
feat(date_time): add created_at and modified_at to merchant related tables (#925)
This commit is contained in:
@ -184,6 +184,7 @@ impl CustomerInterface for MockDb {
|
||||
description: customer_data.description,
|
||||
created_at: common_utils::date_time::now(),
|
||||
metadata: customer_data.metadata,
|
||||
modified_at: common_utils::date_time::now(),
|
||||
};
|
||||
customers.push(customer.clone());
|
||||
Ok(customer)
|
||||
|
||||
@ -199,6 +199,8 @@ impl MerchantAccountInterface for MockDb {
|
||||
locker_id: merchant_account.locker_id,
|
||||
metadata: merchant_account.metadata,
|
||||
primary_business_details: merchant_account.primary_business_details,
|
||||
created_at: common_utils::date_time::now(),
|
||||
modified_at: common_utils::date_time::now(),
|
||||
};
|
||||
accounts.push(account.clone());
|
||||
Ok(account)
|
||||
|
||||
@ -295,6 +295,8 @@ impl MerchantConnectorAccountInterface for MockDb {
|
||||
business_country: t.business_country,
|
||||
business_label: t.business_label,
|
||||
business_sub_label: t.business_sub_label,
|
||||
created_at: common_utils::date_time::now(),
|
||||
modified_at: common_utils::date_time::now(),
|
||||
};
|
||||
accounts.push(account.clone());
|
||||
Ok(account)
|
||||
|
||||
@ -31,6 +31,7 @@ pub struct Customer {
|
||||
pub description: Option<String>,
|
||||
pub created_at: PrimitiveDateTime,
|
||||
pub metadata: Option<pii::SecretSerdeValue>,
|
||||
pub modified_at: PrimitiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -54,6 +55,7 @@ pub struct CustomerUpdateInternal {
|
||||
description: Option<String>,
|
||||
phone_country_code: Option<String>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
modified_at: Option<PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
impl From<CustomerUpdate> for CustomerUpdateInternal {
|
||||
@ -73,6 +75,7 @@ impl From<CustomerUpdate> for CustomerUpdateInternal {
|
||||
description,
|
||||
phone_country_code,
|
||||
metadata,
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ pub struct MerchantAccount {
|
||||
pub routing_algorithm: Option<serde_json::Value>,
|
||||
pub primary_business_details: serde_json::Value,
|
||||
pub api_key: Option<StrongSecret<String>>,
|
||||
pub created_at: time::PrimitiveDateTime,
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
|
||||
@ -99,6 +101,7 @@ pub struct MerchantAccountUpdateInternal {
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
routing_algorithm: Option<serde_json::Value>,
|
||||
primary_business_details: Option<serde_json::Value>,
|
||||
modified_at: Option<time::PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
|
||||
@ -134,6 +137,7 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
|
||||
locker_id,
|
||||
metadata,
|
||||
primary_business_details,
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
..Default::default()
|
||||
},
|
||||
MerchantAccountUpdate::StorageSchemeUpdate { storage_scheme } => Self {
|
||||
|
||||
@ -33,6 +33,8 @@ pub struct MerchantConnectorAccount {
|
||||
pub business_country: storage_enums::CountryCode,
|
||||
pub business_label: String,
|
||||
pub business_sub_label: Option<String>,
|
||||
pub created_at: time::PrimitiveDateTime,
|
||||
pub modified_at: time::PrimitiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
|
||||
@ -80,6 +82,7 @@ pub struct MerchantConnectorAccountUpdateInternal {
|
||||
payment_methods_enabled: Option<Vec<serde_json::Value>>,
|
||||
metadata: Option<pii::SecretSerdeValue>,
|
||||
frm_configs: Option<Secret<serde_json::Value>>,
|
||||
modified_at: Option<time::PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInternal {
|
||||
@ -105,6 +108,7 @@ impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInte
|
||||
payment_methods_enabled,
|
||||
metadata,
|
||||
frm_configs,
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +106,7 @@ diesel::table! {
|
||||
description -> Nullable<Varchar>,
|
||||
created_at -> Timestamp,
|
||||
metadata -> Nullable<Json>,
|
||||
modified_at -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,6 +229,8 @@ diesel::table! {
|
||||
routing_algorithm -> Nullable<Json>,
|
||||
primary_business_details -> Json,
|
||||
api_key -> Nullable<Varchar>,
|
||||
created_at -> Timestamp,
|
||||
modified_at -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,6 +254,8 @@ diesel::table! {
|
||||
business_country -> CountryCode,
|
||||
business_label -> Varchar,
|
||||
business_sub_label -> Nullable<Varchar>,
|
||||
created_at -> Timestamp,
|
||||
modified_at -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
migrations/2023-04-19-120735_add_time_for_tables/down.sql
Normal file
12
migrations/2023-04-19-120735_add_time_for_tables/down.sql
Normal file
@ -0,0 +1,12 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE merchant_account
|
||||
DROP COLUMN IF EXISTS created_at,
|
||||
DROP COLUMN IF EXISTS modified_at;
|
||||
|
||||
|
||||
ALTER TABLE merchant_connector_account
|
||||
DROP COLUMN IF EXISTS created_at,
|
||||
DROP COLUMN IF EXISTS modified_at;
|
||||
|
||||
ALTER TABLE customers
|
||||
DROP COLUMN IF EXISTS modified_at;
|
||||
12
migrations/2023-04-19-120735_add_time_for_tables/up.sql
Normal file
12
migrations/2023-04-19-120735_add_time_for_tables/up.sql
Normal file
@ -0,0 +1,12 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE merchant_account
|
||||
ADD COLUMN IF NOT EXISTS created_at TIMESTAMP NOT NULL DEFAULT now(),
|
||||
ADD COLUMN IF NOT EXISTS modified_at TIMESTAMP NOT NULL DEFAULT now();
|
||||
|
||||
ALTER TABLE merchant_connector_account
|
||||
ADD COLUMN IF NOT EXISTS created_at TIMESTAMP NOT NULL DEFAULT now(),
|
||||
ADD COLUMN IF NOT EXISTS modified_at TIMESTAMP NOT NULL DEFAULT now();
|
||||
|
||||
|
||||
ALTER TABLE customers
|
||||
ADD COLUMN IF NOT EXISTS modified_at TIMESTAMP NOT NULL DEFAULT now();
|
||||
Reference in New Issue
Block a user