新增: 三实体列表查询维度补全(status/关键词/排序/分页下沉后端)
任务/项目/灵感三实体新增 list_by_query 动态 WHERE(累积式 where_clauses
+params_vec 收口)+ order_by 白名单防注入 + limit/offset 钳制。命令层
list_{tasks,projects,ideas} 吃 Option<XxxQuery> 双参向后兼容(旧无参/单参
路径等价全量)。前端 Tasks/Ideas status/keyword 筛选下沉后端 query。
F-260621-02
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import type { TaskRecord, CreateTaskInput } from './types'
|
||||
import type { TaskRecord, CreateTaskInput, TaskQuery } from './types'
|
||||
|
||||
export const taskApi = {
|
||||
list(projectId?: string): Promise<TaskRecord[]> {
|
||||
return invoke('list_tasks', { projectId: projectId ?? null })
|
||||
/**
|
||||
* 列出任务。
|
||||
*
|
||||
* **双签名向后兼容**(F-260621-02):
|
||||
* - `list(projectId?)`:旧签名,仅项目过滤(等价 `list({ project_id: projectId })`)。
|
||||
* - `list(query?)`:新签名,多条件(status/keyword/project_id/priority/assignee/...)走后端 WHERE。
|
||||
*
|
||||
* 参数为空 → 后端返回全量未删任务(created_at DESC,等价改造前 list_active)。
|
||||
*/
|
||||
list(queryOrProjectId?: TaskQuery | string): Promise<TaskRecord[]> {
|
||||
if (typeof queryOrProjectId === 'string') {
|
||||
return invoke('list_tasks', { projectId: queryOrProjectId ?? null, query: null })
|
||||
}
|
||||
return invoke('list_tasks', { projectId: null, query: queryOrProjectId ?? null })
|
||||
},
|
||||
|
||||
get(id: string): Promise<TaskRecord> {
|
||||
|
||||
Reference in New Issue
Block a user