Simplify the function signature of processInternalTables
This commit is contained in:
parent
e03b1be9d1
commit
4a00649f7f
|
@ -19,8 +19,8 @@ import {
|
|||
import datasources from "../datasources"
|
||||
import sdk from "../../../sdk"
|
||||
|
||||
function processInternalTables(docs: AllDocsResponse<Table[]>): Table[] {
|
||||
return docs.rows.map(tableDoc => processInternalTable(tableDoc.doc))
|
||||
function processInternalTables(tables: Table[]): Table[] {
|
||||
return tables.map(processInternalTable)
|
||||
}
|
||||
|
||||
export function processInternalTable(table: Table): Table {
|
||||
|
@ -40,7 +40,7 @@ export async function getAllInternalTables(db?: Database): Promise<Table[]> {
|
|||
include_docs: true,
|
||||
})
|
||||
)
|
||||
return processInternalTables(internalTables)
|
||||
return processInternalTables(internalTables.rows.map(row => row.doc!))
|
||||
}
|
||||
|
||||
async function getAllExternalTables(): Promise<Table[]> {
|
||||
|
@ -110,7 +110,9 @@ export async function getTables(tableIds: string[]): Promise<Table[]> {
|
|||
const internalTableDocs = await db.allDocs<Table[]>(
|
||||
getMultiIDParams(internalTableIds)
|
||||
)
|
||||
tables = tables.concat(processInternalTables(internalTableDocs))
|
||||
tables = tables.concat(
|
||||
processInternalTables(internalTableDocs.rows.map(row => row.doc!))
|
||||
)
|
||||
}
|
||||
return tables
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue