feat: 将 metadata 中的参数封装到 args 对象中,以统一结构

This commit is contained in:
xiongxiao
2026-03-19 01:17:43 +08:00
committed by cnb
parent 6a92ee7a2d
commit f305a900f4

View File

@@ -10,12 +10,14 @@ app
description: 'mark list.',
middleware: ['auth'],
metadata: {
args: {
page: z.number().optional().describe('页码'),
pageSize: z.number().optional().describe('每页数量'),
search: z.string().optional().describe('搜索关键词'),
markType: z.string().optional().describe('mark类型,simple,wallnote,md,draw等'),
sort: z.enum(['DESC', 'ASC']).default('DESC').describe('排序字段'),
}
}
})
.define(async (ctx) => {
const tokenUser = ctx.state.tokenUser;
@@ -33,7 +35,9 @@ app
key: 'getVersion',
middleware: ['auth'],
metadata: {
args: {
id: z.string().describe('mark id'),
}
},
})
.define(async (ctx) => {
@@ -66,7 +70,10 @@ app
key: 'get',
middleware: ['auth'],
metadata: {
args: {
id: z.string().describe('mark id'),
}
},
})
.define(async (ctx) => {
@@ -95,7 +102,9 @@ app
middleware: ['auth'],
isDebug: true,
metadata: {
args: {
id: z.string().describe('mark id'),
}
},
})
.define(async (ctx) => {
@@ -144,12 +153,14 @@ app
key: 'updateNode',
middleware: ['auth'],
metadata: {
args: {
id: z.string().describe('mark id'),
operate: z.enum(['update', 'delete']).default('update').describe('节点操作类型update或delete'),
data: z.object({
id: z.string().describe('节点id'),
node: z.any().describe('要更新的节点数据'),
}).describe('要更新的节点数据'),
}
},
})
.define(async (ctx) => {
@@ -197,11 +208,13 @@ app
key: 'updateNodes',
middleware: ['auth'],
metadata: {
args: {
id: z.string().describe('mark id'),
nodeOperateList: z.array(z.object({
operate: z.enum(['update', 'delete']).default('update').describe('节点操作类型update或delete'),
node: z.any().describe('要更新的节点数据'),
})).describe('要更新的节点列表'),
}
},
})
.define(async (ctx) => {
@@ -258,7 +271,9 @@ app
key: 'delete',
middleware: ['auth'],
metadata: {
args: {
id: z.string().describe('mark id'),
}
},
})
.define(async (ctx) => {