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:
Mani Chandra
2023-12-04 17:03:44 +05:30
committed by GitHub
parent 9d93533219
commit 80efeb76b1
9 changed files with 453 additions and 109 deletions

View File

@ -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>,