Skip to content

Commit 077e954

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

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
@@ -914,13 +914,30 @@ const chatEndpoints = API.v1
914914
total,
915915
});
916916
},
917-
);
918-
919-
API.v1.addRoute(
920-
'chat.getPinnedMessages',
921-
{ authRequired: true, validateParams: isChatGetPinnedMessagesProps },
922-
{
923-
async get() {
917+
)
918+
.get(
919+
'chat.getPinnedMessages',
920+
{
921+
authRequired: true,
922+
query: isChatGetPinnedMessagesProps,
923+
response: {
924+
200: ajv.compile<{ messages: IMessage[]; count: number; offset: number; total: number }>({
925+
type: 'object',
926+
properties: {
927+
messages: { type: 'array', items: { $ref: '#/components/schemas/IMessage' } },
928+
count: { type: 'number' },
929+
offset: { type: 'number' },
930+
total: { type: 'number' },
931+
success: { type: 'boolean', enum: [true] },
932+
},
933+
required: ['messages', 'count', 'offset', 'total', 'success'],
934+
additionalProperties: false,
935+
}),
936+
400: validateBadRequestErrorResponse,
937+
401: validateUnauthorizedErrorResponse,
938+
},
939+
},
940+
async function action() {
924941
const { roomId } = this.queryParams;
925942
const { offset, count } = await getPaginationItems(this.queryParams);
926943

@@ -942,8 +959,7 @@ API.v1.addRoute(
942959
total,
943960
});
944961
},
945-
},
946-
);
962+
);
947963

948964
API.v1.addRoute(
949965
'chat.getThreadsList',

0 commit comments

Comments
 (0)