-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): diesel models, domain models and db interface changes for callback_mapper table #6571
base: main
Are you sure you want to change the base?
Conversation
…witch into add-call-back-mapper-table
…witch into add-call-back-mapper-table
…witch into add-call-back-mapper-table
id VARCHAR(128) NOT NULL PRIMARY KEY, | ||
type VARCHAR(64) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
What values are stored in the
id
column: are we generating them or is it being provided from third-party sources?- If it's being provided by third party sources, how do we handle possible collision happening due to the
id
field?
- If it's being provided by third party sources, how do we handle possible collision happening due to the
-
What sort of values does the
type
column hold, can they be an enum on the Rust side while being aVARCHAR
on the database side?
created_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP, | ||
last_modified_at TIMESTAMP NOT NULL DEFAULT now()::TIMESTAMP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid the defaults on the database side, have the application provide the values for these columns always. This would help prevent issues with the timestamps being generated based on the database server's time zone configuration.
use crate::schema::callback_mapper; | ||
|
||
#[derive( | ||
Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the Serialize
and Deserialize
derives on CallBackMapper
and CallBackMapperNew
?
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
pub struct CallBackMapperNew { | ||
pub id: String, | ||
#[serde(rename = "type")] | ||
pub type_: String, | ||
pub data: pii::SecretSerdeValue, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you'd need the CallBackMapperNew
domain model (most probably). The idea is that we should be able to insert and retrieve the domain model itself, and it would be converted to the corresponding types from the diesel_models
crate based on need.
async fn insert_call_back_mapper( | ||
&self, | ||
call_back_mapper: DomainCallBackMapper::CallBackMapperNew, | ||
) -> CustomResult<DomainCallBackMapper::CallBackMapper, errors::StorageError>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have this method accept the CallbackMapper
domain type itself?
Type of Change
Description
Created callback_mapper table, added diesel, domain models and implemented interface for DB operations.
this is added for network tokenization webhooks feature. Since this is generic, any kind of data (excluding sensitive info) can be stored.
db changes -
Network tokenization webhook feature use case - no merchant id is passed from token requestor, so network_token_requestor_ref_id is stored in this table along with merchant_id
Additional Changes
Motivation and Context
How did you test it?
This PR is only meant for creating new call_back_mapper table and doesn't interfere with any existing flows.
Checklist
cargo +nightly fmt --all
cargo clippy