diff --git a/src/nextcloud/card.rs b/src/nextcloud/card.rs index 6931cf6..ecc1c4e 100644 --- a/src/nextcloud/card.rs +++ b/src/nextcloud/card.rs @@ -2,7 +2,7 @@ use clap::Parser; use crate::execute::Execute; -use crate::nextcloud::model::NextcloudLabelId; +use crate::nextcloud::model::{NextcloudCardDescription, NextcloudCardTitle, NextcloudLabelId}; use crate::{ nextcloud::model::{NextcloudCardId, NextcloudStackId}, p, FullCtx, @@ -69,9 +69,9 @@ impl Execute for NextcloudCardCommand { ctx, Create { dump: *dump, - stack_id: (*stack_id), - title: title.clone(), - description: description.clone(), + stack_id: (*stack_id).into(), + title: title.clone().into(), + description: description.clone().map(|d| d.into()), }, ) .await @@ -139,9 +139,9 @@ pub(crate) async fn get( pub(crate) struct Create { pub(crate) dump: bool, - pub(crate) stack_id: i64, - pub(crate) title: String, - pub(crate) description: Option, + pub(crate) stack_id: NextcloudStackId, + pub(crate) title: NextcloudCardTitle, + pub(crate) description: Option, } pub(crate) async fn create(ctx: &FullCtx, create: Create) -> color_eyre::Result<()> { let api_result = ctx.deck_client().create_card(&create).await; diff --git a/src/nextcloud/model.rs b/src/nextcloud/model.rs index 991cb55..0d2a57f 100644 --- a/src/nextcloud/model.rs +++ b/src/nextcloud/model.rs @@ -111,6 +111,14 @@ newtype!( Ord, "Title of the Card" ); +newtype!( + NextcloudCardDescription, + String, + Display, + PartialOrd, + Ord, + "Description of the Card" +); #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub(crate) struct NextcloudBoardOwner { @@ -149,7 +157,7 @@ pub(crate) struct Stack { pub(crate) struct Card { pub(crate) id: NextcloudCardId, pub(crate) title: NextcloudCardTitle, - pub(crate) description: Option, + pub(crate) description: Option, #[serde(rename = "stackId")] pub(crate) stack_id: NextcloudStackId, pub(crate) order: NextcloudOrder,