diff options
Diffstat (limited to 'common/src')
-rw-r--r-- | common/src/lib.rs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs index c836b95..7e5b68c 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -14,7 +14,6 @@ pub mod user; pub use chrono; use bincode::{Decode, Encode}; - #[cfg(feature = "rocket")] use rocket::{FromFormField, UriDisplayQuery}; use serde::{Deserialize, Serialize}; @@ -32,8 +31,6 @@ pub struct Node { #[derive(Debug, Clone, Deserialize, Serialize, Default, Encode,Decode)] pub struct NodePrivate { #[serde(default)] pub id: Option<String>, - #[serde(default)] pub poster: Option<AssetLocation>, - #[serde(default)] pub backdrop: Option<AssetLocation>, #[serde(default)] pub source: Option<Vec<TrackSource>>, } @@ -41,6 +38,10 @@ pub struct NodePrivate { #[derive(Debug, Clone, Deserialize, Serialize, Default, Encode, Decode)] pub struct NodePublic { #[serde(default)] pub kind: Option<NodeKind>, + + #[serde(default)] pub poster: Option<Asset>, + #[serde(default)] pub backdrop: Option<Asset>, + #[serde(default)] pub title: Option<String>, #[serde(default)] pub id: Option<String>, #[serde(default)] pub path: Vec<String>, @@ -54,6 +55,9 @@ pub struct NodePublic { #[serde(default)] pub federated: Option<String>, } +#[derive(Debug, Serialize, Deserialize, Encode, Decode, PartialEq, Eq, Clone)] +pub struct Asset(pub String); + #[derive(Debug, Clone, Deserialize, Serialize, Default, Encode, Decode)] pub struct ExtendedNode { pub ids: ObjectIds, @@ -72,7 +76,7 @@ pub struct Appearance { #[derive(Debug, Clone, Deserialize, Serialize, Default, Encode, Decode)] pub struct Person { pub name: String, - pub asset: Option<AssetLocation>, + pub headshot: Option<Asset>, pub ids: ObjectIds, } @@ -126,7 +130,7 @@ pub enum ImportSource { path: Option<PathBuf>, }, Media { - location: AssetLocation, + path: PathBuf, #[serde(default)] ignore_metadata: bool, #[serde(default)] @@ -139,16 +143,6 @@ pub enum ImportSource { }, } -#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq, Encode, Decode)] -#[serde(rename_all = "snake_case")] -pub enum AssetLocation { - Cache(PathBuf), - Library(PathBuf), - Assets(PathBuf), - Temp(PathBuf), - Media(PathBuf), -} - #[rustfmt::skip] #[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, Default, Encode,Decode)] #[cfg_attr(feature = "rocket", derive(FromFormField, UriDisplayQuery))] |