feat: 将 metadata 中的参数封装到 args 对象中,以统一结构
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user