1
This commit is contained in:
@@ -19,6 +19,7 @@ pub struct AuthUserPayload {
|
||||
pub public_user_code: String,
|
||||
pub username: String,
|
||||
pub display_name: String,
|
||||
pub avatar_url: Option<String>,
|
||||
pub phone_number_masked: Option<String>,
|
||||
pub login_method: String,
|
||||
pub binding_status: String,
|
||||
@@ -31,6 +32,7 @@ pub struct PublicUserSummaryPayload {
|
||||
pub id: String,
|
||||
pub public_user_code: String,
|
||||
pub display_name: String,
|
||||
pub avatar_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
@@ -66,6 +68,19 @@ pub struct PasswordChangeResponse {
|
||||
pub user: AuthUserPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileUpdateRequest {
|
||||
pub display_name: Option<String>,
|
||||
pub avatar_data_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileUpdateResponse {
|
||||
pub user: AuthUserPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PasswordResetRequest {
|
||||
@@ -252,6 +267,23 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_update_request_uses_camel_case_fields() {
|
||||
let payload = serde_json::to_value(ProfileUpdateRequest {
|
||||
display_name: Some("旅人甲".to_string()),
|
||||
avatar_data_url: Some("data:image/png;base64,AAAA".to_string()),
|
||||
})
|
||||
.expect("payload should serialize");
|
||||
|
||||
assert_eq!(
|
||||
payload,
|
||||
json!({
|
||||
"displayName": "旅人甲",
|
||||
"avatarDataUrl": "data:image/png;base64,AAAA"
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wechat_callback_query_keeps_provider_compatible_field_names() {
|
||||
let payload = serde_json::to_value(WechatCallbackQuery {
|
||||
|
||||
Reference in New Issue
Block a user