Files
nj/crates/erp-plugin/src/dto.rs
iven c539e6fd83 feat: initialize Nuanji (Warm Notes) project
- Base platform from base.git (ERP base: auth, core, config, message, workflow, plugin)
- Created erp-diary module skeleton (lib.rs, dto.rs, error.rs, event.rs, state.rs)
- Integrated erp-diary into workspace and erp-server
- Added DiaryModule registration in main.rs
- Added DiaryState FromRef in state.rs
- Diary routes mounted (empty routes, ready for implementation)
- Product design spec v1.2 preserved in docs/
- Implementation plan preserved in plans/

Cargo check: OK
Cargo test: OK (78+ base tests passing)
2026-05-31 20:52:19 +08:00

69 lines
2.0 KiB
Rust

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use validator::Validate;
/// 插件信息响应
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
pub struct PluginResp {
pub id: Uuid,
pub name: String,
pub version: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<String>,
pub status: String,
pub config: serde_json::Value,
#[serde(skip_serializing_if = "Option::is_none")]
pub installed_at: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled_at: Option<DateTime<Utc>>,
pub entities: Vec<PluginEntityResp>,
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<Vec<PluginPermissionResp>>,
pub record_version: i32,
}
/// 插件实体信息
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub struct PluginEntityResp {
pub name: String,
pub display_name: String,
pub table_name: String,
}
/// 插件权限信息
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
pub struct PluginPermissionResp {
pub code: String,
pub name: String,
pub description: String,
}
/// 插件健康检查响应
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
pub struct PluginHealthResp {
pub plugin_id: Uuid,
pub status: String,
pub details: serde_json::Value,
}
/// 更新插件配置请求
#[derive(Debug, Serialize, Deserialize, Validate, utoipa::ToSchema)]
pub struct UpdatePluginConfigReq {
pub config: serde_json::Value,
pub version: i32,
}
/// 插件列表查询参数
#[derive(Debug, Serialize, Deserialize, Validate, utoipa::IntoParams)]
pub struct PluginListParams {
pub page: Option<u64>,
pub page_size: Option<u64>,
#[validate(length(max = 20, message = "状态值无效"))]
pub status: Option<String>,
#[validate(length(max = 100, message = "搜索关键词过长"))]
pub search: Option<String>,
}