This commit is contained in:
root 2025-07-11 00:34:04 +08:00
parent 010080f61e
commit a56336b63e
1 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tauri::{command, AppHandle}; use tauri::{command, AppHandle};
use crate::python_executor::execute_python_command; use crate::python_executor::{execute_python_command, PythonExecutorConfig};
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct CreateCategoryRequest { pub struct CreateCategoryRequest {
@ -20,6 +20,7 @@ pub struct UpdateCategoryRequest {
#[command] #[command]
pub async fn get_all_resource_categories(app: AppHandle) -> Result<String, String> { pub async fn get_all_resource_categories(app: AppHandle) -> Result<String, String> {
let args = vec![ let args = vec![
"-m".to_string(),
"python_core.services.resource_category_manager".to_string(), "python_core.services.resource_category_manager".to_string(),
"get_all_categories".to_string(), "get_all_categories".to_string(),
]; ];
@ -31,6 +32,7 @@ pub async fn get_all_resource_categories(app: AppHandle) -> Result<String, Strin
#[command] #[command]
pub async fn get_resource_category_by_id(app: AppHandle, category_id: String) -> Result<String, String> { pub async fn get_resource_category_by_id(app: AppHandle, category_id: String) -> Result<String, String> {
let args = vec![ let args = vec![
"-m".to_string(),
"python_core.services.resource_category_manager".to_string(), "python_core.services.resource_category_manager".to_string(),
"get_category_by_id".to_string(), "get_category_by_id".to_string(),
category_id, category_id,
@ -43,6 +45,7 @@ pub async fn get_resource_category_by_id(app: AppHandle, category_id: String) ->
#[command] #[command]
pub async fn create_resource_category(app: AppHandle, request: CreateCategoryRequest) -> Result<String, String> { pub async fn create_resource_category(app: AppHandle, request: CreateCategoryRequest) -> Result<String, String> {
let args = vec![ let args = vec![
"-m".to_string(),
"python_core.services.resource_category_manager".to_string(), "python_core.services.resource_category_manager".to_string(),
"create_category".to_string(), "create_category".to_string(),
request.title, request.title,
@ -64,6 +67,7 @@ pub async fn update_resource_category(
.map_err(|e| format!("Failed to serialize request: {}", e))?; .map_err(|e| format!("Failed to serialize request: {}", e))?;
let args = vec![ let args = vec![
"-m".to_string(),
"python_core.services.resource_category_manager".to_string(), "python_core.services.resource_category_manager".to_string(),
"update_category".to_string(), "update_category".to_string(),
category_id, category_id,
@ -77,6 +81,7 @@ pub async fn update_resource_category(
#[command] #[command]
pub async fn delete_resource_category(app: AppHandle, category_id: String) -> Result<String, String> { pub async fn delete_resource_category(app: AppHandle, category_id: String) -> Result<String, String> {
let args = vec![ let args = vec![
"-m".to_string(),
"python_core.services.resource_category_manager".to_string(), "python_core.services.resource_category_manager".to_string(),
"delete_category".to_string(), "delete_category".to_string(),
category_id, category_id,