Add backend feedback submission and image preview
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -21,6 +21,7 @@ pub const PROFILE_TASK_STATUS_INCOMPLETE: &str = "incomplete";
|
||||
pub const PROFILE_TASK_STATUS_CLAIMABLE: &str = "claimable";
|
||||
pub const PROFILE_TASK_STATUS_CLAIMED: &str = "claimed";
|
||||
pub const PROFILE_TASK_STATUS_DISABLED: &str = "disabled";
|
||||
pub const PROFILE_FEEDBACK_STATUS_OPEN: &str = "open";
|
||||
pub const TRACKING_SCOPE_KIND_SITE: &str = "site";
|
||||
pub const TRACKING_SCOPE_KIND_WORK: &str = "work";
|
||||
pub const TRACKING_SCOPE_KIND_MODULE: &str = "module";
|
||||
@@ -254,6 +255,49 @@ pub struct CreateProfileRechargeOrderResponse {
|
||||
pub center: ProfileRechargeCenterResponse,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileFeedbackEvidenceItemRequest {
|
||||
pub file_name: String,
|
||||
pub content_type: String,
|
||||
pub size_bytes: u64,
|
||||
pub data_url: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SubmitProfileFeedbackRequest {
|
||||
pub description: String,
|
||||
#[serde(default)]
|
||||
pub contact_phone: Option<String>,
|
||||
#[serde(default)]
|
||||
pub evidence_items: Vec<ProfileFeedbackEvidenceItemRequest>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileFeedbackEvidenceItemResponse {
|
||||
pub evidence_id: String,
|
||||
pub file_name: String,
|
||||
pub content_type: String,
|
||||
pub size_bytes: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileFeedbackSubmissionResponse {
|
||||
pub feedback_id: String,
|
||||
pub status: String,
|
||||
pub created_at: String,
|
||||
pub evidence_items: Vec<ProfileFeedbackEvidenceItemResponse>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SubmitProfileFeedbackResponse {
|
||||
pub feedback: ProfileFeedbackSubmissionResponse,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProfileReferralInvitedUserResponse {
|
||||
@@ -1263,6 +1307,41 @@ mod tests {
|
||||
assert_eq!(payload.payment_channel, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_feedback_response_uses_camel_case_fields() {
|
||||
let payload = serde_json::to_value(SubmitProfileFeedbackResponse {
|
||||
feedback: ProfileFeedbackSubmissionResponse {
|
||||
feedback_id: "feedback:user-1:1".to_string(),
|
||||
status: PROFILE_FEEDBACK_STATUS_OPEN.to_string(),
|
||||
created_at: "2026-05-08T10:00:00Z".to_string(),
|
||||
evidence_items: vec![ProfileFeedbackEvidenceItemResponse {
|
||||
evidence_id: "feedback:user-1:1:evidence:01".to_string(),
|
||||
file_name: "问题截图.png".to_string(),
|
||||
content_type: "image/png".to_string(),
|
||||
size_bytes: 128,
|
||||
}],
|
||||
},
|
||||
})
|
||||
.expect("payload should serialize");
|
||||
|
||||
assert_eq!(
|
||||
payload["feedback"]["feedbackId"],
|
||||
json!("feedback:user-1:1")
|
||||
);
|
||||
assert_eq!(
|
||||
payload["feedback"]["status"],
|
||||
json!(PROFILE_FEEDBACK_STATUS_OPEN)
|
||||
);
|
||||
assert_eq!(
|
||||
payload["feedback"]["evidenceItems"][0]["contentType"],
|
||||
json!("image/png")
|
||||
);
|
||||
assert_eq!(
|
||||
payload["feedback"]["evidenceItems"][0]["sizeBytes"],
|
||||
json!(128)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_play_stats_response_uses_camel_case_fields() {
|
||||
let payload = serde_json::to_value(ProfilePlayStatsResponse {
|
||||
|
||||
Reference in New Issue
Block a user