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> = { const json: Record<string, any> = {
has_error: 0, result: {
version: 1, has_error: 0,
request_name: 'posts', version: 1,
topic: { request_name: 'posts',
community_id: community.community_id topic: {
}, community_id: community.community_id
posts: [] },
posts: []
}
}; };
for (const post of 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> = { const json: Record<string, any> = {
has_error: 0, result: {
version: 1, has_error: 0,
expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'), version: 1,
request_name: 'posts', expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'),
people: [] request_name: 'posts',
people: []
}
}; };
for (const post of posts) { 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> = { const json: Record<string, any> = {
has_error: 0, result: {
version: 1, has_error: 0,
request_name: 'replies', version: 1,
posts: [] request_name: 'replies',
posts: []
}
}; };
for (const post of 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> { async function generateTopicsXML(communities: HydratedCommunityDocument[]): Promise<string> {
const json: Record<string, any> = { const json: Record<string, any> = {
has_error: 0, result: {
version: 1, has_error: 0,
expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'), version: 1,
request_name: 'topics', expire: moment().add(1, 'days').format('YYYY-MM-DD HH:MM:SS'),
topics: [] request_name: 'topics',
topics: []
}
}; };
for (const community of communities) { for (const community of communities) {

View File

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