refactor(tenant): use tenant id type (#6643)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Apoorv Dixit
2024-11-26 13:47:58 +05:30
committed by GitHub
parent 108b1603fa
commit c9df7b0557
32 changed files with 252 additions and 118 deletions

View File

@ -1120,11 +1120,15 @@ pub async fn create_internal_user(
}
})?;
let default_tenant_id = common_utils::consts::DEFAULT_TENANT.to_string();
let default_tenant_id = common_utils::id_type::TenantId::try_from_string(
common_utils::consts::DEFAULT_TENANT.to_owned(),
)
.change_context(UserErrors::InternalServerError)
.attach_printable("Unable to parse default tenant id")?;
if state.tenant.tenant_id != default_tenant_id {
return Err(UserErrors::ForbiddenTenantId)
.attach_printable("Operation allowed only for the default tenant.");
.attach_printable("Operation allowed only for the default tenant");
}
let internal_merchant_id = common_utils::id_type::MerchantId::get_internal_user_merchant_id(