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 {
|
||||
|
||||
@@ -26,6 +26,8 @@ pub struct BigFishWorkSummaryResponse {
|
||||
pub remix_count: u32,
|
||||
#[serde(default)]
|
||||
pub like_count: u32,
|
||||
#[serde(default)]
|
||||
pub recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
|
||||
@@ -5,6 +5,10 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct CreatePuzzleAgentSessionRequest {
|
||||
#[serde(default)]
|
||||
pub seed_text: Option<String>,
|
||||
#[serde(default)]
|
||||
pub picture_description: Option<String>,
|
||||
#[serde(default)]
|
||||
pub reference_image_src: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
|
||||
@@ -29,6 +29,18 @@ pub struct DragPuzzlePieceRequest {
|
||||
pub target_col: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UsePuzzleRuntimePropRequest {
|
||||
pub prop_kind: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct UpdatePuzzleRuntimePauseRequest {
|
||||
pub paused: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SubmitPuzzleLeaderboardRequest {
|
||||
@@ -108,6 +120,20 @@ pub struct PuzzleRuntimeLevelSnapshotResponse {
|
||||
#[serde(default)]
|
||||
pub elapsed_ms: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub time_limit_ms: u64,
|
||||
#[serde(default)]
|
||||
pub remaining_ms: u64,
|
||||
#[serde(default)]
|
||||
pub paused_accumulated_ms: u64,
|
||||
#[serde(default)]
|
||||
pub pause_started_at_ms: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub freeze_accumulated_ms: u64,
|
||||
#[serde(default)]
|
||||
pub freeze_started_at_ms: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub freeze_until_ms: Option<u64>,
|
||||
#[serde(default)]
|
||||
pub leaderboard_entries: Vec<PuzzleLeaderboardEntryResponse>,
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ pub struct PuzzleWorkSummaryResponse {
|
||||
pub remix_count: u32,
|
||||
#[serde(default)]
|
||||
pub like_count: u32,
|
||||
#[serde(default)]
|
||||
pub recent_play_count_7d: u32,
|
||||
pub publish_ready: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -443,6 +443,8 @@ pub struct CustomWorldLibraryEntryResponse {
|
||||
pub remix_count: u32,
|
||||
#[serde(default)]
|
||||
pub like_count: u32,
|
||||
#[serde(default)]
|
||||
pub recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
@@ -469,6 +471,8 @@ pub struct CustomWorldGalleryCardResponse {
|
||||
pub remix_count: u32,
|
||||
#[serde(default)]
|
||||
pub like_count: u32,
|
||||
#[serde(default)]
|
||||
pub recent_play_count_7d: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
@@ -955,14 +959,14 @@ mod tests {
|
||||
},
|
||||
point_products: vec![ProfileRechargeProductResponse {
|
||||
product_id: "points_60".to_string(),
|
||||
title: "60叙世币".to_string(),
|
||||
title: "60陶泥币".to_string(),
|
||||
price_cents: 600,
|
||||
kind: "points".to_string(),
|
||||
points_amount: 60,
|
||||
bonus_points: 60,
|
||||
duration_days: 0,
|
||||
badge_label: "首充双倍".to_string(),
|
||||
description: "首充送60叙世币".to_string(),
|
||||
description: "首充送60陶泥币".to_string(),
|
||||
tier: "normal".to_string(),
|
||||
}],
|
||||
membership_products: vec![],
|
||||
@@ -978,11 +982,11 @@ mod tests {
|
||||
json!("2026-05-25T10:00:00Z")
|
||||
);
|
||||
assert_eq!(payload["pointProducts"][0]["productId"], json!("points_60"));
|
||||
assert_eq!(payload["pointProducts"][0]["title"], json!("60叙世币"));
|
||||
assert_eq!(payload["pointProducts"][0]["title"], json!("60陶泥币"));
|
||||
assert_eq!(payload["pointProducts"][0]["priceCents"], json!(600));
|
||||
assert_eq!(
|
||||
payload["pointProducts"][0]["description"],
|
||||
json!("首充送60叙世币")
|
||||
json!("首充送60陶泥币")
|
||||
);
|
||||
assert_eq!(payload["hasPointsRecharged"], json!(false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user