Make code more readable

This commit is contained in:
Adria Navarro 2024-02-12 12:33:16 +01:00
parent ffdfb731fb
commit 231c8ccaab
1 changed files with 5 additions and 1 deletions

View File

@ -18,12 +18,16 @@ export async function save(ctx: UserCtx<SaveTableRequest, SaveTableResponse>) {
_rename?: RenameColumn
} = {
_id: generateTableID(),
views: {},
...rest,
// Ensure these fields are populated, even if not sent in the request
type: rest.type || "table",
sourceType: rest.sourceType || TableSourceType.INTERNAL,
}
if (!tableToSave.views) {
tableToSave.views = {}
}
const renaming = tableToSave._rename
delete tableToSave._rename