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