1
0
Fork 0
mirror of synced 2024-07-09 00:06:05 +12:00

code review

This commit is contained in:
Martin McKeaveney 2023-07-21 09:43:25 +01:00
parent b5340c20d8
commit 567c7fd485

View file

@ -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<App | DeletedAppMetadata> {
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
}
/**