feat: category tag add fields
This commit is contained in:
@@ -26,6 +26,7 @@ pub struct CreateCategoryResponse {
|
||||
name: String,
|
||||
level: i32,
|
||||
parent_category_id: i64,
|
||||
book_id: i64,
|
||||
}
|
||||
|
||||
pub fn get_nest_handlers() -> Router<crate::AppState> {
|
||||
@@ -39,6 +40,7 @@ pub struct CreateCategoryRequest {
|
||||
name: String,
|
||||
level: i32,
|
||||
parent_category_id: i64,
|
||||
book_id: i64,
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
@@ -59,6 +61,7 @@ pub async fn create_category(
|
||||
uid: uid,
|
||||
level: payload.level,
|
||||
parent_category_id: payload.parent_category_id,
|
||||
book_id: payload.book_id,
|
||||
};
|
||||
let res = conn
|
||||
.interact(move |conn| {
|
||||
|
||||
@@ -21,6 +21,7 @@ use crate::middleware::auth::Claims;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct CreateTagRequest {
|
||||
book_id: i64,
|
||||
name: String,
|
||||
level: i32,
|
||||
parent_tag_id: i64,
|
||||
@@ -30,6 +31,7 @@ pub struct CreateTagRequest {
|
||||
pub struct CreateTagResponse {
|
||||
id: i64,
|
||||
name: String,
|
||||
book_id: i64,
|
||||
level: i32,
|
||||
parent_tag_id: i64,
|
||||
}
|
||||
@@ -53,6 +55,7 @@ pub async fn create_tag(
|
||||
.await
|
||||
.map_err(util::req::internal_error)?;
|
||||
let new_tag = db_model::TagForm {
|
||||
book_id:payload.book_id,
|
||||
name: payload.name,
|
||||
uid: uid,
|
||||
level: payload.level,
|
||||
|
||||
@@ -11,6 +11,7 @@ pub struct Category {
|
||||
name: String,
|
||||
level: i32,
|
||||
parent_category_id: i64,
|
||||
book_id: i64,
|
||||
is_delete: bool,
|
||||
create_at: chrono::NaiveDateTime,
|
||||
update_at: chrono::NaiveDateTime,
|
||||
@@ -21,6 +22,7 @@ pub struct Category {
|
||||
pub struct CategoryForm {
|
||||
pub uid: i64,
|
||||
pub name: String,
|
||||
pub book_id: i64,
|
||||
pub level: i32,
|
||||
pub parent_category_id: i64,
|
||||
}
|
||||
@@ -31,6 +33,7 @@ pub struct CategoryForm {
|
||||
pub struct Tag {
|
||||
id: i64,
|
||||
uid: i64,
|
||||
book_id: i64,
|
||||
name: String,
|
||||
level: i32,
|
||||
parent_tag_id: i64,
|
||||
@@ -43,6 +46,7 @@ pub struct Tag {
|
||||
#[diesel(table_name = schema::tags)]
|
||||
pub struct TagForm {
|
||||
pub uid: i64,
|
||||
pub book_id: i64,
|
||||
pub name: String,
|
||||
pub level: i32,
|
||||
pub parent_tag_id: i64,
|
||||
@@ -120,6 +124,7 @@ pub struct TransactionForm {
|
||||
pub struct Amount {
|
||||
pub id: i64,
|
||||
uid: i64,
|
||||
account_id: i64,
|
||||
transaction_id: i64,
|
||||
value: i64,
|
||||
expo: i64,
|
||||
@@ -134,6 +139,7 @@ pub struct Amount {
|
||||
pub struct AmountForm {
|
||||
pub uid: i64,
|
||||
pub transaction_id: i64,
|
||||
pub account_id: i64,
|
||||
pub value: i64,
|
||||
pub expo: i64,
|
||||
pub currency: String,
|
||||
|
||||
@@ -16,6 +16,7 @@ diesel::table! {
|
||||
amounts (id) {
|
||||
id -> Int8,
|
||||
uid -> Int8,
|
||||
account_id -> Int8,
|
||||
transaction_id -> Int8,
|
||||
value -> Int8,
|
||||
expo -> Int8,
|
||||
@@ -41,6 +42,7 @@ diesel::table! {
|
||||
categories (id) {
|
||||
id -> Int8,
|
||||
uid -> Int8,
|
||||
book_id -> Int8,
|
||||
name -> Text,
|
||||
level -> Int4,
|
||||
parent_category_id -> Int8,
|
||||
@@ -54,6 +56,7 @@ diesel::table! {
|
||||
tags (id) {
|
||||
id -> Int8,
|
||||
uid -> Int8,
|
||||
book_id -> Int8,
|
||||
name -> Text,
|
||||
level -> Int4,
|
||||
parent_tag_id -> Int8,
|
||||
|
||||
Reference in New Issue
Block a user