feat: always send target info

This commit is contained in:
daimond113 2024-08-12 20:41:09 +02:00
parent 3272f8aa88
commit a2865523a0
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
4 changed files with 4 additions and 5 deletions

View file

@ -135,7 +135,7 @@ pub async fn get_package_version(
let mut response = serde_json::to_value(PackageResponse { let mut response = serde_json::to_value(PackageResponse {
name: name.to_string(), name: name.to_string(),
version: v_id.version().to_string(), version: v_id.version().to_string(),
target: Some(entry.target.into()), target: entry.target.into(),
description: entry.description.unwrap_or_default(), description: entry.description.unwrap_or_default(),
published_at: entry.published_at, published_at: entry.published_at,
license: entry.license.unwrap_or_default(), license: entry.license.unwrap_or_default(),

View file

@ -27,7 +27,7 @@ pub async fn get_package_versions(
.map(|(v_id, entry)| PackageResponse { .map(|(v_id, entry)| PackageResponse {
name: name.to_string(), name: name.to_string(),
version: v_id.version().to_string(), version: v_id.version().to_string(),
target: Some(entry.target.into()), target: entry.target.into(),
description: entry.description.unwrap_or_default(), description: entry.description.unwrap_or_default(),
published_at: entry.published_at, published_at: entry.published_at,
license: entry.license.unwrap_or_default(), license: entry.license.unwrap_or_default(),

View file

@ -84,7 +84,7 @@ pub async fn search_packages(
PackageResponse { PackageResponse {
name: id.to_string(), name: id.to_string(),
version: version_id.version().to_string(), version: version_id.version().to_string(),
target: None, target: entry.target.into(),
description: entry.description.unwrap_or_default(), description: entry.description.unwrap_or_default(),
published_at: entry.published_at, published_at: entry.published_at,
license: entry.license.unwrap_or_default(), license: entry.license.unwrap_or_default(),

View file

@ -34,8 +34,7 @@ impl From<Target> for TargetInfo {
pub struct PackageResponse { pub struct PackageResponse {
pub name: String, pub name: String,
pub version: String, pub version: String,
#[serde(skip_serializing_if = "Option::is_none")] pub target: TargetInfo,
pub target: Option<TargetInfo>,
#[serde(skip_serializing_if = "String::is_empty")] #[serde(skip_serializing_if = "String::is_empty")]
pub description: String, pub description: String,
pub published_at: DateTime<Utc>, pub published_at: DateTime<Utc>,