From a0791cba412942c4d68d4c356b0359441e0d4912 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 5 Dec 2023 10:40:29 +0100 Subject: [PATCH] dtmm: Extend NexusInfo This provides forward compatibility, in case I ever want to use those fields. If I only added them at the time when they are needed, I would need to come up with a process to load the `nexus.sjson` with missing fields. Closes #130. --- crates/dtmm/src/state/data.rs | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/crates/dtmm/src/state/data.rs b/crates/dtmm/src/state/data.rs index 6b5a706..23a4ae0 100644 --- a/crates/dtmm/src/state/data.rs +++ b/crates/dtmm/src/state/data.rs @@ -72,25 +72,35 @@ impl From for ModDependency { #[derive(Clone, Data, Debug, Lens, serde::Serialize, serde::Deserialize)] pub(crate) struct NexusInfo { + pub author: String, + pub category_id: u64, + pub created_timestamp: i64, + pub description: Arc, pub id: u64, pub name: String, - pub version: String, - pub author: String, - pub summary: Arc, - pub description: Arc, pub picture_url: Arc, + pub summary: Arc, + pub uid: u64, + pub updated_timestamp: i64, + pub uploaded_by: String, + pub version: String, } impl From for NexusInfo { fn from(value: NexusMod) -> Self { Self { + author: value.author, + category_id: value.category_id, + created_timestamp: value.created_timestamp.unix_timestamp(), + description: Arc::new(value.description), id: value.mod_id, name: value.name, - version: value.version, - author: value.author, - summary: Arc::new(value.summary), - description: Arc::new(value.description), picture_url: Arc::new(value.picture_url.into()), + summary: Arc::new(value.summary), + uid: value.uid, + updated_timestamp: value.updated_timestamp.unix_timestamp(), + uploaded_by: value.uploaded_by, + version: value.version, } } } @@ -106,14 +116,14 @@ pub(crate) struct ModInfo { pub image: Option, pub version: String, pub enabled: bool, + pub depends: Vector, + pub bundled: bool, #[lens(ignore)] #[data(ignore)] pub packages: Vector>, #[lens(ignore)] #[data(ignore)] pub resources: ModResourceInfo, - pub depends: Vector, - pub bundled: bool, #[data(ignore)] pub nexus: Option, } -- 2.45.3