mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor(users): Separate signup and signin (#2921)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -6,11 +6,12 @@ use crate::user::{
|
||||
dashboard_metadata::{
|
||||
GetMetaDataRequest, GetMetaDataResponse, GetMultipleMetaDataPayload, SetMetaDataRequest,
|
||||
},
|
||||
ChangePasswordRequest, ConnectAccountRequest, ConnectAccountResponse,
|
||||
CreateInternalUserRequest, GetUsersResponse, SwitchMerchantIdRequest, UserMerchantCreate,
|
||||
AuthorizeResponse, ChangePasswordRequest, ConnectAccountRequest, CreateInternalUserRequest,
|
||||
DashboardEntryResponse, GetUsersResponse, SignUpRequest, SignUpWithMerchantIdRequest,
|
||||
SwitchMerchantIdRequest, UserMerchantCreate,
|
||||
};
|
||||
|
||||
impl ApiEventMetric for ConnectAccountResponse {
|
||||
impl ApiEventMetric for DashboardEntryResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::User {
|
||||
merchant_id: self.merchant_id.clone(),
|
||||
@ -19,9 +20,9 @@ impl ApiEventMetric for ConnectAccountResponse {
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiEventMetric for ConnectAccountRequest {}
|
||||
|
||||
common_utils::impl_misc_api_event_type!(
|
||||
SignUpRequest,
|
||||
SignUpWithMerchantIdRequest,
|
||||
ChangePasswordRequest,
|
||||
GetMultipleMetaDataPayload,
|
||||
GetMetaDataResponse,
|
||||
@ -30,7 +31,9 @@ common_utils::impl_misc_api_event_type!(
|
||||
SwitchMerchantIdRequest,
|
||||
CreateInternalUserRequest,
|
||||
UserMerchantCreate,
|
||||
GetUsersResponse
|
||||
GetUsersResponse,
|
||||
AuthorizeResponse,
|
||||
ConnectAccountRequest
|
||||
);
|
||||
|
||||
#[cfg(feature = "dummy_connector")]
|
||||
|
||||
@ -7,13 +7,25 @@ pub mod dashboard_metadata;
|
||||
pub mod sample_data;
|
||||
|
||||
#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
|
||||
pub struct ConnectAccountRequest {
|
||||
pub struct SignUpWithMerchantIdRequest {
|
||||
pub name: Secret<String>,
|
||||
pub email: pii::Email,
|
||||
pub password: Secret<String>,
|
||||
pub company_name: String,
|
||||
}
|
||||
|
||||
pub type SignUpWithMerchantIdResponse = AuthorizeResponse;
|
||||
|
||||
#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
|
||||
pub struct SignUpRequest {
|
||||
pub email: pii::Email,
|
||||
pub password: Secret<String>,
|
||||
}
|
||||
|
||||
pub type SignUpResponse = DashboardEntryResponse;
|
||||
|
||||
#[derive(serde::Serialize, Debug, Clone)]
|
||||
pub struct ConnectAccountResponse {
|
||||
pub struct DashboardEntryResponse {
|
||||
pub token: Secret<String>,
|
||||
pub merchant_id: String,
|
||||
pub name: Secret<String>,
|
||||
@ -25,6 +37,28 @@ pub struct ConnectAccountResponse {
|
||||
pub user_id: String,
|
||||
}
|
||||
|
||||
pub type SignInRequest = SignUpRequest;
|
||||
|
||||
pub type SignInResponse = DashboardEntryResponse;
|
||||
|
||||
#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
|
||||
pub struct ConnectAccountRequest {
|
||||
pub email: pii::Email,
|
||||
}
|
||||
|
||||
pub type ConnectAccountResponse = AuthorizeResponse;
|
||||
|
||||
#[derive(serde::Serialize, Debug, Clone)]
|
||||
pub struct AuthorizeResponse {
|
||||
pub is_email_sent: bool,
|
||||
//this field is added for audit/debug reasons
|
||||
#[serde(skip_serializing)]
|
||||
pub user_id: String,
|
||||
//this field is added for audit/debug reasons
|
||||
#[serde(skip_serializing)]
|
||||
pub merchant_id: String,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, Debug, serde::Serialize)]
|
||||
pub struct ChangePasswordRequest {
|
||||
pub new_password: Secret<String>,
|
||||
@ -36,6 +70,8 @@ pub struct SwitchMerchantIdRequest {
|
||||
pub merchant_id: String,
|
||||
}
|
||||
|
||||
pub type SwitchMerchantResponse = DashboardEntryResponse;
|
||||
|
||||
#[derive(serde::Deserialize, Debug, serde::Serialize)]
|
||||
pub struct CreateInternalUserRequest {
|
||||
pub name: Secret<String>,
|
||||
|
||||
Reference in New Issue
Block a user