feat: 将 metadata 中的参数封装到 args 对象中,以统一结构
This commit is contained in:
@@ -10,11 +10,13 @@ app
|
|||||||
description: 'mark list.',
|
description: 'mark list.',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
metadata: {
|
metadata: {
|
||||||
page: z.number().optional().describe('页码'),
|
args: {
|
||||||
pageSize: z.number().optional().describe('每页数量'),
|
page: z.number().optional().describe('页码'),
|
||||||
search: z.string().optional().describe('搜索关键词'),
|
pageSize: z.number().optional().describe('每页数量'),
|
||||||
markType: z.string().optional().describe('mark类型,simple,wallnote,md,draw等'),
|
search: z.string().optional().describe('搜索关键词'),
|
||||||
sort: z.enum(['DESC', 'ASC']).default('DESC').describe('排序字段'),
|
markType: z.string().optional().describe('mark类型,simple,wallnote,md,draw等'),
|
||||||
|
sort: z.enum(['DESC', 'ASC']).default('DESC').describe('排序字段'),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
@@ -33,7 +35,9 @@ app
|
|||||||
key: 'getVersion',
|
key: 'getVersion',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
metadata: {
|
metadata: {
|
||||||
id: z.string().describe('mark id'),
|
args: {
|
||||||
|
id: z.string().describe('mark id'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
@@ -66,7 +70,10 @@ app
|
|||||||
key: 'get',
|
key: 'get',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
metadata: {
|
metadata: {
|
||||||
id: z.string().describe('mark id'),
|
args: {
|
||||||
|
|
||||||
|
id: z.string().describe('mark id'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
@@ -95,7 +102,9 @@ app
|
|||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
isDebug: true,
|
isDebug: true,
|
||||||
metadata: {
|
metadata: {
|
||||||
id: z.string().describe('mark id'),
|
args: {
|
||||||
|
id: z.string().describe('mark id'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
@@ -144,12 +153,14 @@ app
|
|||||||
key: 'updateNode',
|
key: 'updateNode',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
metadata: {
|
metadata: {
|
||||||
id: z.string().describe('mark id'),
|
args: {
|
||||||
operate: z.enum(['update', 'delete']).default('update').describe('节点操作类型,update或delete'),
|
id: z.string().describe('mark id'),
|
||||||
data: z.object({
|
operate: z.enum(['update', 'delete']).default('update').describe('节点操作类型,update或delete'),
|
||||||
id: z.string().describe('节点id'),
|
data: z.object({
|
||||||
node: z.any().describe('要更新的节点数据'),
|
id: z.string().describe('节点id'),
|
||||||
}).describe('要更新的节点数据'),
|
node: z.any().describe('要更新的节点数据'),
|
||||||
|
}).describe('要更新的节点数据'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
@@ -197,11 +208,13 @@ app
|
|||||||
key: 'updateNodes',
|
key: 'updateNodes',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
metadata: {
|
metadata: {
|
||||||
id: z.string().describe('mark id'),
|
args: {
|
||||||
nodeOperateList: z.array(z.object({
|
id: z.string().describe('mark id'),
|
||||||
operate: z.enum(['update', 'delete']).default('update').describe('节点操作类型,update或delete'),
|
nodeOperateList: z.array(z.object({
|
||||||
node: z.any().describe('要更新的节点数据'),
|
operate: z.enum(['update', 'delete']).default('update').describe('节点操作类型,update或delete'),
|
||||||
})).describe('要更新的节点列表'),
|
node: z.any().describe('要更新的节点数据'),
|
||||||
|
})).describe('要更新的节点列表'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
@@ -258,7 +271,9 @@ app
|
|||||||
key: 'delete',
|
key: 'delete',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
metadata: {
|
metadata: {
|
||||||
id: z.string().describe('mark id'),
|
args: {
|
||||||
|
id: z.string().describe('mark id'),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user