Skip to content

Commit eb144a9

Browse files
ggazzoclaude
andcommitted
refactor(api): migrate chat.getThreadsList to typed endpoint with response schema
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 077e954 commit eb144a9

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

  • apps/meteor/app/api/server/v1

apps/meteor/app/api/server/v1/chat.ts

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -959,13 +959,30 @@ const chatEndpoints = API.v1
959959
total,
960960
});
961961
},
962-
);
963-
964-
API.v1.addRoute(
965-
'chat.getThreadsList',
966-
{ authRequired: true, validateParams: isChatGetThreadsListProps },
967-
{
968-
async get() {
962+
)
963+
.get(
964+
'chat.getThreadsList',
965+
{
966+
authRequired: true,
967+
query: isChatGetThreadsListProps,
968+
response: {
969+
200: ajv.compile<{ threads: IThreadMainMessage[]; count: number; offset: number; total: number }>({
970+
type: 'object',
971+
properties: {
972+
threads: { type: 'array', items: { type: 'object' } },
973+
count: { type: 'number' },
974+
offset: { type: 'number' },
975+
total: { type: 'number' },
976+
success: { type: 'boolean', enum: [true] },
977+
},
978+
required: ['threads', 'count', 'offset', 'total', 'success'],
979+
additionalProperties: false,
980+
}),
981+
400: validateBadRequestErrorResponse,
982+
401: validateUnauthorizedErrorResponse,
983+
},
984+
},
985+
async function action() {
969986
const { rid, type, text } = this.queryParams;
970987

971988
const { offset, count } = await getPaginationItems(this.queryParams);
@@ -1005,8 +1022,7 @@ API.v1.addRoute(
10051022
total,
10061023
});
10071024
},
1008-
},
1009-
);
1025+
);
10101026

10111027
API.v1.addRoute(
10121028
'chat.syncThreadsList',

0 commit comments

Comments
 (0)