From 567c7fd485724823542b7c3f436c00ded5dcef42 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 21 Jul 2023 09:43:25 +0100 Subject: [PATCH] code review --- packages/backend-core/src/cache/appMetadata.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/cache/appMetadata.ts b/packages/backend-core/src/cache/appMetadata.ts index 5ecc6f10b1..69f734162b 100644 --- a/packages/backend-core/src/cache/appMetadata.ts +++ b/packages/backend-core/src/cache/appMetadata.ts @@ -24,6 +24,10 @@ function isInvalid(metadata?: { state: string }) { return !metadata || metadata.state === AppState.INVALID } +interface DeletedAppMetadata { + state: AppState +} + /** * Get the requested app metadata by id. * Use redis cache to first read the app metadata. @@ -31,7 +35,9 @@ function isInvalid(metadata?: { state: string }) { * @param {string} appId the id of the app to get metadata from. * @returns {object} the app metadata. */ -export async function getAppMetadata(appId: string) { +export async function getAppMetadata( + appId: string +): Promise { const client = await getAppClient() // try cache let metadata = await client.get(appId) @@ -62,7 +68,7 @@ export async function getAppMetadata(appId: string) { await client.store(appId, metadata, expiry) } - return metadata as App & { state: AppState } + return metadata } /**