type safe translation record

This commit is contained in:
Nate Kelley 2025-09-17 16:32:24 -06:00
parent c1f37870bb
commit 15e78020e2
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 6 additions and 6 deletions

View File

@ -135,12 +135,12 @@ export async function generateAssetMessages(input: GenerateAssetMessagesInput):
}
const timestamp = Math.floor(Date.now() / 1000);
const assetTypeStr =
validated.assetType === 'metric_file'
? 'metric'
: validated.assetType === 'dashboard_file'
? 'dashboard'
: 'report';
const translationRecord: Record<DatabaseAssetType, string> = {
metric_file: 'metric',
dashboard_file: 'dashboard',
report_file: 'report',
};
const assetTypeStr = translationRecord[validated.assetType];
// Prepare asset data and fetch additional context files for dashboards
interface AssetFileData {