mirror of
https://github.com/PretendoNetwork/miiverse-api.git
synced 2026-03-21 17:24:38 -05:00
removed the use of any in post endpoints
This commit is contained in:
parent
ee3e0bfbdc
commit
eab3c10e68
|
|
@ -17,6 +17,7 @@ import { LOG_WARN } from '@/logger';
|
|||
import { Post } from '@/models/post';
|
||||
import { Community } from '@/models/community';
|
||||
import { HydratedPostDocument } from '@/types/mongoose/post';
|
||||
import { PostRepliesResult } from '@/types/miiverse/post';
|
||||
|
||||
const newPostSchema = z.object({
|
||||
community_id: z.string().optional(),
|
||||
|
|
@ -133,17 +134,15 @@ router.get('/:post_id/replies', async function (request: express.Request, respon
|
|||
return;
|
||||
}
|
||||
|
||||
const json: Record<string, any> = {
|
||||
result: {
|
||||
has_error: 0,
|
||||
version: 1,
|
||||
request_name: 'replies',
|
||||
posts: []
|
||||
}
|
||||
const result: PostRepliesResult = {
|
||||
has_error: 0,
|
||||
version: 1,
|
||||
request_name: 'replies',
|
||||
posts: []
|
||||
};
|
||||
|
||||
for (const post of posts) {
|
||||
json.result.posts.push({
|
||||
result.posts.push({
|
||||
post: post.json({
|
||||
with_mii: request.query.with_mii as string === '1',
|
||||
topic_tag: true
|
||||
|
|
@ -151,7 +150,14 @@ router.get('/:post_id/replies', async function (request: express.Request, respon
|
|||
});
|
||||
}
|
||||
|
||||
response.send(xmlbuilder.create(json, { separateArrayItems: true }).end({ pretty: true, allowEmpty: true }));
|
||||
response.send(xmlbuilder.create({
|
||||
result
|
||||
}, {
|
||||
separateArrayItems: true
|
||||
}).end({
|
||||
pretty: true,
|
||||
allowEmpty: true
|
||||
}));
|
||||
});
|
||||
|
||||
router.get('/', async function (request: express.Request, response: express.Response): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -41,4 +41,13 @@ export type PostScreenshot = {
|
|||
export type PostTopicTag = {
|
||||
name: string;
|
||||
title_id: string;
|
||||
};
|
||||
|
||||
export type PostRepliesResult = {
|
||||
has_error: 0 | 1;
|
||||
version: 1;
|
||||
request_name: 'replies';
|
||||
posts: {
|
||||
post: PostData;
|
||||
}[];
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user