feat add http body

This commit is contained in:
brian
2025-09-22 21:58:12 +08:00
parent 6a5a45bf20
commit bf2e1f2af6
5 changed files with 32 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ use serde::{Serialize, Deserialize};
use super::common::{number_stringify, OptionalI64};
#[derive(Serialize)]
pub struct BookItem {
pub struct BookResp {
#[serde(with="number_stringify")]
pub id: OptionalI64,
pub name: String,

View File

@@ -1,5 +1,12 @@
use serde::{Deserialize, Serialize};
use super::common::{number_stringify, OptionalI64};
#[derive(Serialize, Deserialize)]
pub struct CategoryResp {
pub id: i64,
pub name: String,
pub parent_id: i64,
}
#[derive(Serialize, Deserialize)]
pub struct CategoryInfo {
#[serde(with="number_stringify")]

View File

@@ -1,4 +1,5 @@
pub mod book;
pub mod common;
pub mod category;
pub mod tag;
pub mod tag;
pub mod transaction;

View File

@@ -2,7 +2,7 @@ use serde::{Serialize, Deserialize};
use super::common::{number_stringify, OptionalI64};
#[derive(Serialize)]
pub struct TagItem {
pub struct TagResp {
#[serde(with="number_stringify")]
pub id: OptionalI64,
pub name: String,

View File

@@ -0,0 +1,21 @@
use serde::{Serialize, Deserialize};
use crate::model::http_body::tag::TagInfo;
use crate::model::http_body::category::CategoryResp;
use crate::model::http_body::common::OptionalI64;
#[derive(Serialize,Deserialize)]
pub struct TransactionResp {
pub id: i64,
pub description: String,
pub category: CategoryResp,
pub tags: Vec<TagInfo>,
}
#[derive(Serialize,Deserialize)]
pub struct TransactionReq {
pub id: Option<String>,
pub description: Option<String>,
pub category_id: Option<String>,
pub tags: Vec<String>,
}