1
0
Fork 0
mirror of synced 2024-07-05 06:20:55 +12:00

Using lodash flatten rather than pure JS.

This commit is contained in:
mike12345567 2020-10-12 10:28:53 +01:00
parent efce1c839e
commit 03584cacb2

View file

@ -1,5 +1,6 @@
const LinkController = require("./LinkController")
const { IncludeDocs, getLinkDocuments, createLinkView } = require("./linkUtils")
const _ = require("lodash")
/**
* This functionality makes sure that when records with links are created, updated or deleted they are processed
@ -90,8 +91,7 @@ exports.attachLinkInfo = async (instanceId, records) => {
}
let modelIds = [...new Set(records.map(el => el.modelId))]
// start by getting all the link values for performance reasons
let responses = [].concat.apply(
[],
let responses = _.flatten(
await Promise.all(
modelIds.map(modelId =>
getLinkDocuments({