Linting.
This commit is contained in:
parent
c24cc5c3fb
commit
2a1243e81e
|
@ -325,7 +325,11 @@ module External {
|
|||
* This is a cached lookup, of relationship records, this is mainly for creating/deleting junction
|
||||
* information.
|
||||
*/
|
||||
async lookup(row: Row, relationship: ManyRelationship, cache: {[key: string]: Row[]} = {}) {
|
||||
async lookup(
|
||||
row: Row,
|
||||
relationship: ManyRelationship,
|
||||
cache: { [key: string]: Row[] } = {}
|
||||
) {
|
||||
const { tableId, isUpdate, id, ...rest } = relationship
|
||||
const { tableName } = breakExternalTableId(tableId)
|
||||
const table = this.tables[tableName]
|
||||
|
@ -333,7 +337,8 @@ module External {
|
|||
return { rows: [], table }
|
||||
}
|
||||
// if not updating need to make sure we have a list of all possible options
|
||||
let fullKey: string = tableId + "/", rowKey: string = ""
|
||||
let fullKey: string = tableId + "/",
|
||||
rowKey: string = ""
|
||||
for (let key of Object.keys(rest)) {
|
||||
if (row[key]) {
|
||||
fullKey += key
|
||||
|
@ -376,7 +381,9 @@ module External {
|
|||
const body = processObjectSync(rest, row)
|
||||
const { table, rows } = await this.lookup(row, relationship, cache)
|
||||
const found = rows.find(row => isEqual(body, row))
|
||||
const operation = isUpdate ? DataSourceOperation.UPDATE : DataSourceOperation.CREATE
|
||||
const operation = isUpdate
|
||||
? DataSourceOperation.UPDATE
|
||||
: DataSourceOperation.CREATE
|
||||
if (!found) {
|
||||
promises.push(
|
||||
makeExternalQuery(appId, {
|
||||
|
@ -398,10 +405,12 @@ module External {
|
|||
const { tableName } = breakExternalTableId(tableId)
|
||||
const table = this.tables[tableName]
|
||||
for (let row of rows) {
|
||||
promises.push(makeExternalQuery(this.appId, {
|
||||
promises.push(
|
||||
makeExternalQuery(this.appId, {
|
||||
endpoint: getEndpoint(tableId, DataSourceOperation.DELETE),
|
||||
filters: buildFilters(generateIdForRow(row, table), {}, table)
|
||||
}))
|
||||
filters: buildFilters(generateIdForRow(row, table), {}, table),
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
await Promise.all(promises)
|
||||
|
|
Loading…
Reference in New Issue