Skip to content

Commit

Permalink
Add function route-tools.Util.buildImageInfo() for consistant user im…
Browse files Browse the repository at this point in the history
…age return data.
  • Loading branch information
Misterblue committed Oct 28, 2020
1 parent e359e51 commit 708e245
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/route-tools/Util.ts
Expand Up @@ -193,15 +193,19 @@ export async function buildUserInfo(pAccount: AccountEntity): Promise<any> {
'accountId': pAccount.id,
'id': pAccount.id,
'username': pAccount.username,
'images': {
'tiny': pAccount.imagesTiny,
'hero': pAccount.imagesHero,
'thumbnail': pAccount.imagesThumbnail
},
'images': await buildImageInfo(pAccount),
'location': await buildLocationInfo(pAccount),
};
};

export async function buildImageInfo(pAccount: AccountEntity): Promise<any> {
const ret: VKeyedCollection = {};
if (pAccount.imagesTiny) ret.tiny = pAccount.imagesTiny;
if (pAccount.imagesHero) ret.hero = pAccount.imagesHero;
if (pAccount.imagesThumbnail) ret.thumbnail = pAccount.imagesThumbnail;
return ret;
};

// Return the block of account information.
// Used by several of the requests to return the complete account information.
export async function buildAccountInfo(pReq: Request, pAccount: AccountEntity): Promise<any> {
Expand Down

0 comments on commit 708e245

Please sign in to comment.