Browse Source

Linting.

pull/1907/head
mike12345567 5 years ago
parent
commit
e82e175b9c
  1. 21
      packages/server/src/api/controllers/row/external.js
  2. 14
      packages/server/src/api/controllers/row/externalUtils.js
  3. 2
      packages/server/src/api/controllers/table/utils.js

21
packages/server/src/api/controllers/row/external.js

@ -1,5 +1,9 @@
const { makeExternalQuery } = require("./utils")
const { DataSourceOperation, SortDirection, FieldTypes } = require("../../../constants")
const {
DataSourceOperation,
SortDirection,
FieldTypes,
} = require("../../../constants")
const { getAllExternalTables } = require("../table/utils")
const {
breakExternalTableId,
@ -81,12 +85,7 @@ async function handleRequest(
}
await Promise.all(promises)
}
const output = outputProcessing(
response,
table,
relationships,
tables
)
const output = outputProcessing(response, table, relationships, tables)
// if reading it'll just be an array of rows, return whole thing
return operation === DataSourceOperation.READ && Array.isArray(response)
? output
@ -256,7 +255,11 @@ exports.fetchEnrichedRow = async ctx => {
// this seems like a lot of work, but basically we need to dig deeper for the enrich
// for a single row, there is probably a better way to do this with some smart multi-layer joins
for (let [fieldName, field] of Object.entries(table.schema)) {
if (field.type !== FieldTypes.LINK || !row[fieldName] || row[fieldName].length === 0) {
if (
field.type !== FieldTypes.LINK ||
!row[fieldName] ||
row[fieldName].length === 0
) {
continue
}
const links = row[fieldName]
@ -275,7 +278,7 @@ exports.fetchEnrichedRow = async ctx => {
[linkedTable.primary]: linkedIds,
},
},
},
}
)
}
return row

14
packages/server/src/api/controllers/row/externalUtils.js

@ -76,12 +76,7 @@ exports.generateIdForRow = (row, table) => {
return generateRowIdField(idParts)
}
exports.updateRelationshipColumns = (
row,
rows,
relationships,
allTables
) => {
exports.updateRelationshipColumns = (row, rows, relationships, allTables) => {
const columns = {}
for (let relationship of relationships) {
const linkedTable = allTables[relationship.tableName]
@ -109,12 +104,7 @@ exports.updateRelationshipColumns = (
return rows
}
exports.outputProcessing = (
rows,
table,
relationships,
allTables
) => {
exports.outputProcessing = (rows, table, relationships, allTables) => {
// if no rows this is what is returned? Might be PG only
if (rows[0].read === true) {
return []

2
packages/server/src/api/controllers/table/utils.js

@ -1,5 +1,3 @@
import {breakExternalTableId} from "../../../integrations/utils"
const CouchDB = require("../../../db")
const csvParser = require("../../../utilities/csvParser")
const {

Loading…
Cancel
Save