feat: use more non-String types
This commit is contained in:
parent
9e414d8947
commit
3552faf7a9
2 changed files with 16 additions and 8 deletions
|
@ -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<String>,
|
||||
pub(crate) stack_id: NextcloudStackId,
|
||||
pub(crate) title: NextcloudCardTitle,
|
||||
pub(crate) description: Option<NextcloudCardDescription>,
|
||||
}
|
||||
pub(crate) async fn create(ctx: &FullCtx, create: Create) -> color_eyre::Result<()> {
|
||||
let api_result = ctx.deck_client().create_card(&create).await;
|
||||
|
|
|
@ -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<String>,
|
||||
pub(crate) description: Option<NextcloudCardDescription>,
|
||||
#[serde(rename = "stackId")]
|
||||
pub(crate) stack_id: NextcloudStackId,
|
||||
pub(crate) order: NextcloudOrder,
|
||||
|
|
Loading…
Reference in a new issue