Added missing result elements to some responses

This commit is contained in:
Jonathan Barrow 2023-04-25 15:01:46 -04:00
parent d1fb023869
commit ea41488347
No known key found for this signature in database
GPG Key ID: E86E9FE9049C741F
5 changed files with 31 additions and 23 deletions

View File

@ -155,13 +155,15 @@ router.get('/:appID/posts', async function (request: express.Request, response:
}
const json: Record<string, any> = {
has_error: 0,
version: 1,
request_name: 'posts',
topic: {
community_id: community.community_id
},
posts: []
result: {
has_error: 0,
version: 1,
request_name: 'posts',
topic: {
community_id: community.community_id
},
posts: []
}
};
for (const post of posts) {

View File

@ -70,11 +70,13 @@ router.get('/', async function (request: express.Request, response: express.Resp
}
const json: Record<string, any> = {
has_error: 0,
version: 1,
expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'),
request_name: 'posts',
people: []
result: {
has_error: 0,
version: 1,
expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'),
request_name: 'posts',
people: []
}
};
for (const post of posts) {

View File

@ -137,10 +137,12 @@ router.get('/:post_id/replies', async function (request: express.Request, respon
}
const json: Record<string, any> = {
has_error: 0,
version: 1,
request_name: 'replies',
posts: []
result: {
has_error: 0,
version: 1,
request_name: 'replies',
posts: []
}
};
for (const post of posts) {

View File

@ -48,11 +48,13 @@ router.get('/', async function (request: express.Request, response: express.Resp
async function generateTopicsXML(communities: HydratedCommunityDocument[]): Promise<string> {
const json: Record<string, any> = {
has_error: 0,
version: 1,
expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'),
request_name: 'topics',
topics: []
result: {
has_error: 0,
version: 1,
expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'),
request_name: 'topics',
topics: []
}
};
for (const community of communities) {

View File

@ -1,4 +1,4 @@
export interface CryptoOptions {
private_key: Buffer
hmac_secret: string
private_key: Buffer;
hmac_secret: string;
}