|
|
@ -36,13 +36,15 @@ export async function getViewAndModelByAliasOrId(param: { |
|
|
|
project_id: project.id, |
|
|
|
project_id: project.id, |
|
|
|
aliasOrId: param.tableName, |
|
|
|
aliasOrId: param.tableName, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!model) NcError.notFound('Table not found'); |
|
|
|
|
|
|
|
|
|
|
|
const view = |
|
|
|
const view = |
|
|
|
param.viewName && |
|
|
|
param.viewName && |
|
|
|
(await View.getByTitleOrId({ |
|
|
|
(await View.getByTitleOrId({ |
|
|
|
titleOrId: param.viewName, |
|
|
|
titleOrId: param.viewName, |
|
|
|
fk_model_id: model.id, |
|
|
|
fk_model_id: model.id, |
|
|
|
})); |
|
|
|
})); |
|
|
|
if (!model) NcError.notFound('Table not found'); |
|
|
|
|
|
|
|
if (param.viewName && !view) NcError.notFound('View not found'); |
|
|
|
if (param.viewName && !view) NcError.notFound('View not found'); |
|
|
|
return { model, view }; |
|
|
|
return { model, view }; |
|
|
|
} |
|
|
|
} |
|
|
|