新增: 三实体列表查询维度补全(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,12 +1,20 @@
|
||||
import { ideaApi } from '@/api'
|
||||
import type { IdeaQuery } from '@/api/types'
|
||||
import { t } from '@/i18n/i18n-helpers'
|
||||
import { state } from './state'
|
||||
|
||||
/** 灵感 CRUD 子 store(共享全局 state) */
|
||||
export function createIdeasStore() {
|
||||
async function loadIdeas() {
|
||||
/**
|
||||
* 加载灵感列表。
|
||||
*
|
||||
* F-260621-02:status/keyword/order_by 下沉后端 WHERE,取代前端 computed filter。
|
||||
* - 传 `query` → 多条件查询(状态/关键词/排序/分页)。
|
||||
* - 不传 → 全量(created_at DESC,等价旧行为)。
|
||||
*/
|
||||
async function loadIdeas(query?: IdeaQuery) {
|
||||
try {
|
||||
state.ideas = await ideaApi.list()
|
||||
state.ideas = await ideaApi.list(query)
|
||||
} catch (e: any) {
|
||||
state.error = e?.toString() ?? t('ideas.err.loadFailed')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user