Skip to content

Commit 671d467

Browse files
authored
Merge pull request #1162 from digital-land/2316-remove-organisation-entity-field-from-download-of-alternative-source-data
Filter out dataset-field and spec fields for correct download
2 parents 2f0a224 + d0bdc5b commit 671d467

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/middleware/common.middleware.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,11 @@ export const addDatabaseFieldToSpecification = (req, res, next) => {
448448

449449
export const filterOutSystemFields = (req, res, next) => {
450450
const { specification } = req
451-
const systemFields = ['organisation'] // Currentl only organisation is not a field we want to show
451+
const systemFields = ['organisation'] // Currently only organisation is not a field we want to show
452452

453+
// Slightly odd filter of looking at fields from dataset_fields and spec fields in the filter out.
453454
req.specification.fields = specification.fields.filter(
454-
fieldObj => !systemFields.includes(fieldObj.field)
455+
fieldObj => !systemFields.includes(fieldObj.field) && !systemFields.includes(fieldObj.datasetField)
455456
)
456457

457458
next()

0 commit comments

Comments
 (0)