From ad32c2369e9ad0dff4856bf9f224e434e759d3e9 Mon Sep 17 00:00:00 2001 From: Ryan Ruckley Date: Thu, 23 Jan 2025 09:36:41 +1100 Subject: [PATCH 1/2] chore: Updates --- Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 25d755c..231df1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ allow_dirty = true [package] name = "tmflib" -version = "0.1.25" +version = "0.1.26" edition = "2021" authors = ["Ryan Ruckley "] description = "Interface library for processing TMF payloads" @@ -216,10 +216,10 @@ default = ["all","build-V4"] chrono = "0.4.39" rust_iso4217 = "0.1.1" serde = { version = "1.0.217", features = ["derive"]} -serde_json = "1.0.135" +serde_json = "1.0.137" sha256 = { version = "1.5", default-features = false } -uuid = { version = "1.11.0", features = ["v4"]} -tmflib-derive = { version = "0.1.29" } +uuid = { version = "1.12.1", features = ["v4"]} +tmflib-derive = { version = "0.1.30" } # tmflib-derive = { path = "tmflib-derive"} hex = "0.4.3" base32 = "0.5.1" From 570df836e34285cd74edd913d3c706971f836e21 Mon Sep 17 00:00:00 2001 From: Ryan Ruckley Date: Thu, 23 Jan 2025 09:36:56 +1100 Subject: [PATCH 2/2] bug: Added HasDescription trait --- src/tmf620/catalog.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/tmf620/catalog.rs b/src/tmf620/catalog.rs index 7d78b87..9b4ce0d 100644 --- a/src/tmf620/catalog.rs +++ b/src/tmf620/catalog.rs @@ -4,6 +4,7 @@ use crate::{ HasId, HasName, + HasDescription, HasLastUpdate, HasValidity, HasRelatedParty, @@ -16,7 +17,14 @@ use crate::{ use crate::tmf620::category::CategoryRef; use crate::common::related_party::RelatedParty; use crate::common::event::{Event,EventPayload}; -use tmflib_derive::{HasLastUpdate,HasId,HasName,HasValidity,HasRelatedParty}; +use tmflib_derive::{ + HasLastUpdate, + HasId, + HasName, + HasDescription, + HasValidity, + HasRelatedParty +}; use chrono::Utc; use serde::{Deserialize, Serialize}; @@ -29,7 +37,7 @@ const CLASS_PATH: &str = "catalog"; const CAT_VERS: &str = "1.0"; /// Catalogue -#[derive(Clone, Default, Debug, Deserialize,HasLastUpdate, HasId, HasName, HasValidity, HasRelatedParty, Serialize)] +#[derive(Clone, Default, Debug, Deserialize,HasLastUpdate, HasId, HasName, HasDescription, HasValidity, HasRelatedParty, Serialize)] #[serde(rename_all = "camelCase")] pub struct Catalog { /// Non-optional fields @@ -194,6 +202,7 @@ pub struct CatalogBatchEvent {} mod tests { const CAT_NAME : &str = "A Catalog"; + const CAT_DESC : &str = "A Description"; use crate::common::event::EventPayload; use crate::common::related_party::RelatedParty; @@ -202,7 +211,7 @@ mod tests { use super::{Catalog, CatalogEvent, CatalogEventType}; use crate::tmf620::category::{Category, CategoryRef}; - use crate::{HasId,HasName, HasValidity,HasRelatedParty,TimePeriod}; + use crate::{HasDescription, HasId, HasName, HasRelatedParty, HasValidity, TimePeriod}; const CAT_JSON : &str = "{ \"name\" : \"CatalogueName\", @@ -345,5 +354,14 @@ mod tests { assert_eq!(related_party.name,Some("An Organisation".to_string())); } + #[test] + fn test_catalog_description() { + let cat = Catalog::new(CAT_NAME) + .description(CAT_DESC); + + assert_eq!(cat.description.is_some(),true); + assert_eq!(cat.get_description(),CAT_DESC.to_string()); + } + }