68 lines
1.8 KiB
Rust
68 lines
1.8 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// 插件数据记录响应
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
|
|
pub struct PluginDataResp {
|
|
pub id: String,
|
|
pub data: serde_json::Value,
|
|
pub created_at: Option<DateTime<Utc>>,
|
|
pub updated_at: Option<DateTime<Utc>>,
|
|
pub version: Option<i32>,
|
|
}
|
|
|
|
/// 创建插件数据请求
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
|
|
pub struct CreatePluginDataReq {
|
|
pub data: serde_json::Value,
|
|
}
|
|
|
|
/// 更新插件数据请求
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
|
|
pub struct UpdatePluginDataReq {
|
|
pub data: serde_json::Value,
|
|
pub version: i32,
|
|
}
|
|
|
|
/// 插件数据列表查询参数
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::IntoParams)]
|
|
pub struct PluginDataListParams {
|
|
pub page: Option<u64>,
|
|
pub page_size: Option<u64>,
|
|
/// Base64 编码的游标(用于 Keyset 分页)
|
|
pub cursor: Option<String>,
|
|
pub search: Option<String>,
|
|
/// JSON 格式过滤: {"field":"value"}
|
|
pub filter: Option<String>,
|
|
pub sort_by: Option<String>,
|
|
/// "asc" or "desc"
|
|
pub sort_order: Option<String>,
|
|
}
|
|
|
|
/// 聚合查询响应项
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::ToSchema)]
|
|
pub struct AggregateItem {
|
|
/// 分组键(字段值)
|
|
pub key: String,
|
|
/// 计数
|
|
pub count: i64,
|
|
}
|
|
|
|
/// 聚合查询参数
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::IntoParams)]
|
|
pub struct AggregateQueryParams {
|
|
/// 分组字段名
|
|
pub group_by: String,
|
|
/// JSON 格式过滤: {"field":"value"}
|
|
pub filter: Option<String>,
|
|
}
|
|
|
|
/// 统计查询参数
|
|
#[derive(Debug, Serialize, Deserialize, utoipa::IntoParams)]
|
|
pub struct CountQueryParams {
|
|
/// 搜索关键词
|
|
pub search: Option<String>,
|
|
/// JSON 格式过滤: {"field":"value"}
|
|
pub filter: Option<String>,
|
|
}
|