ViewV2, return 404 if not found

This commit is contained in:
Adria Navarro 2025-01-16 16:58:57 +01:00
parent 325fea0c10
commit 566da4b2a3
1 changed files with 4 additions and 2 deletions

View File

@ -22,7 +22,9 @@ export async function get(viewId: string): Promise<ViewV2> {
return ensureQueryUISet(found) return ensureQueryUISet(found)
} }
export async function getEnriched(viewId: string): Promise<ViewV2Enriched> { export async function getEnriched(
viewId: string
): Promise<ViewV2Enriched | undefined> {
const { tableId } = utils.extractViewInfoFromID(viewId) const { tableId } = utils.extractViewInfoFromID(viewId)
const { datasourceId, tableName } = breakExternalTableId(tableId) const { datasourceId, tableName } = breakExternalTableId(tableId)
@ -32,7 +34,7 @@ export async function getEnriched(viewId: string): Promise<ViewV2Enriched> {
const views = Object.values(table.views!).filter(isV2) const views = Object.values(table.views!).filter(isV2)
const found = views.find(v => v.id === viewId) const found = views.find(v => v.id === viewId)
if (!found) { if (!found) {
throw new Error("No view found") return
} }
return await enrichSchema(ensureQueryUISet(found), table.schema) return await enrichSchema(ensureQueryUISet(found), table.schema)
} }