refactor(router): Introduce ApiKeyId id type (#6324)

This commit is contained in:
Anurag Thakur
2024-10-21 19:19:31 +05:30
committed by GitHub
parent 58296ffae6
commit b3ce373f8e
14 changed files with 166 additions and 75 deletions

View File

@ -29,8 +29,8 @@ pub struct CreateApiKeyRequest {
#[derive(Debug, Serialize, ToSchema)]
pub struct CreateApiKeyResponse {
/// The identifier for the API Key.
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX")]
pub key_id: String,
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX", value_type = String)]
pub key_id: common_utils::id_type::ApiKeyId,
/// The identifier for the Merchant Account.
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
@ -72,8 +72,8 @@ pub struct CreateApiKeyResponse {
#[derive(Debug, Serialize, ToSchema)]
pub struct RetrieveApiKeyResponse {
/// The identifier for the API Key.
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX")]
pub key_id: String,
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX", value_type = String)]
pub key_id: common_utils::id_type::ApiKeyId,
/// The identifier for the Merchant Account.
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
@ -131,7 +131,8 @@ pub struct UpdateApiKeyRequest {
pub expiration: Option<ApiKeyExpiration>,
#[serde(skip_deserializing)]
pub key_id: String,
#[schema(value_type = String)]
pub key_id: common_utils::id_type::ApiKeyId,
#[serde(skip_deserializing)]
#[schema(value_type = String)]
@ -146,8 +147,8 @@ pub struct RevokeApiKeyResponse {
pub merchant_id: common_utils::id_type::MerchantId,
/// The identifier for the API Key.
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX")]
pub key_id: String,
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX", value_type = String)]
pub key_id: common_utils::id_type::ApiKeyId,
/// Indicates whether the API key was revoked or not.
#[schema(example = "true")]
pub revoked: bool,