Linting.
This commit is contained in:
parent
1fd4144189
commit
2b71f28664
|
@ -79,9 +79,17 @@ async function handleRequest(
|
||||||
}
|
}
|
||||||
await Promise.all(promises)
|
await Promise.all(promises)
|
||||||
}
|
}
|
||||||
const output = outputProcessing(response, table, relationships, tables, fullDocs)
|
const output = outputProcessing(
|
||||||
|
response,
|
||||||
|
table,
|
||||||
|
relationships,
|
||||||
|
tables,
|
||||||
|
fullDocs
|
||||||
|
)
|
||||||
// if reading it'll just be an array of rows, return whole thing
|
// if reading it'll just be an array of rows, return whole thing
|
||||||
return operation === DataSourceOperation.READ && Array.isArray(response) ? output : { row: output[0], table }
|
return operation === DataSourceOperation.READ && Array.isArray(response)
|
||||||
|
? output
|
||||||
|
: { row: output[0], table }
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.patch = async ctx => {
|
exports.patch = async ctx => {
|
||||||
|
@ -123,9 +131,14 @@ exports.find = async ctx => {
|
||||||
const appId = ctx.appId
|
const appId = ctx.appId
|
||||||
const id = ctx.params.rowId
|
const id = ctx.params.rowId
|
||||||
const tableId = ctx.params.tableId
|
const tableId = ctx.params.tableId
|
||||||
const response = await handleRequest(appId, DataSourceOperation.READ, tableId, {
|
const response = await handleRequest(
|
||||||
|
appId,
|
||||||
|
DataSourceOperation.READ,
|
||||||
|
tableId,
|
||||||
|
{
|
||||||
id,
|
id,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
return response ? response[0] : response
|
return response ? response[0] : response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,9 +240,14 @@ exports.fetchEnrichedRow = async ctx => {
|
||||||
const id = ctx.params.rowId
|
const id = ctx.params.rowId
|
||||||
const tableId = ctx.params.tableId
|
const tableId = ctx.params.tableId
|
||||||
// TODO: this only enriches the full docs 1 layer deep, need to join those as well
|
// TODO: this only enriches the full docs 1 layer deep, need to join those as well
|
||||||
const response = await handleRequest(appId, DataSourceOperation.READ, tableId, {
|
const response = await handleRequest(
|
||||||
|
appId,
|
||||||
|
DataSourceOperation.READ,
|
||||||
|
tableId,
|
||||||
|
{
|
||||||
id,
|
id,
|
||||||
fullDocs: true,
|
fullDocs: true,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
return response ? response[0] : response
|
return response ? response[0] : response
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,13 @@ exports.generateIdForRow = (row, table) => {
|
||||||
return generateRowIdField(idParts)
|
return generateRowIdField(idParts)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.updateRelationshipColumns = (row, rows, relationships, allTables, fullDocs) => {
|
exports.updateRelationshipColumns = (
|
||||||
|
row,
|
||||||
|
rows,
|
||||||
|
relationships,
|
||||||
|
allTables,
|
||||||
|
fullDocs
|
||||||
|
) => {
|
||||||
const columns = {}
|
const columns = {}
|
||||||
for (let relationship of relationships) {
|
for (let relationship of relationships) {
|
||||||
const linkedTable = allTables[relationship.tableName]
|
const linkedTable = allTables[relationship.tableName]
|
||||||
|
@ -106,7 +112,13 @@ exports.updateRelationshipColumns = (row, rows, relationships, allTables, fullDo
|
||||||
return rows
|
return rows
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.outputProcessing = (rows, table, relationships, allTables, fullDocs) => {
|
exports.outputProcessing = (
|
||||||
|
rows,
|
||||||
|
table,
|
||||||
|
relationships,
|
||||||
|
allTables,
|
||||||
|
fullDocs
|
||||||
|
) => {
|
||||||
// if no rows this is what is returned? Might be PG only
|
// if no rows this is what is returned? Might be PG only
|
||||||
if (rows[0].read === true) {
|
if (rows[0].read === true) {
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true,
|
||||||
|
"incremental": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/**/*"
|
"./src/**/*"
|
||||||
|
|
Loading…
Reference in New Issue