feat: add lega/repoOwner and map to forge repository owner(namespace)
This commit is contained in:
parent
632479ff58
commit
f9da115100
1 changed files with 6 additions and 9 deletions
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use db_core::AddRepository;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
@ -34,7 +35,6 @@ pub struct Repository {
|
||||||
pub is_based_on: Option<String>,
|
pub is_based_on: Option<String>,
|
||||||
#[serde(skip_serializing_if = "HashMap::is_empty")]
|
#[serde(skip_serializing_if = "HashMap::is_empty")]
|
||||||
pub description: HashMap<String, Description>,
|
pub description: HashMap<String, Description>,
|
||||||
#[serde(skip_serializing_if = "Legal::is_none")]
|
|
||||||
pub legal: Legal,
|
pub legal: Legal,
|
||||||
#[serde(skip_serializing_if = "IntendedAudience::is_none")]
|
#[serde(skip_serializing_if = "IntendedAudience::is_none")]
|
||||||
pub intended_audience: IntendedAudience,
|
pub intended_audience: IntendedAudience,
|
||||||
|
@ -56,13 +56,7 @@ pub struct Description {
|
||||||
pub struct Legal {
|
pub struct Legal {
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub license: Option<String>,
|
pub license: Option<String>,
|
||||||
}
|
pub repo_owner: String,
|
||||||
|
|
||||||
impl Legal {
|
|
||||||
/// global is_none, to skip_serializing_if
|
|
||||||
pub fn is_none(&self) -> bool {
|
|
||||||
self.license.is_none()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -115,7 +109,10 @@ impl From<&db_core::AddRepository<'_>> for Repository {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let legal = Legal { license: None };
|
let legal = Legal {
|
||||||
|
license: None,
|
||||||
|
repo_owner: r.owner.to_string(),
|
||||||
|
};
|
||||||
|
|
||||||
let scope = r
|
let scope = r
|
||||||
.tags
|
.tags
|
||||||
|
|
Loading…
Add table
Reference in a new issue