Skip to content

Commit

Permalink
Added district config in export to exploitation db
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineludeau committed Dec 17, 2024
1 parent e885222 commit 8ba17bb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/api/consumers/format-to-legacy-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const districtsAddressesExtraDataIndex = districtsAddressesExtraData.reduce((acc
}, {})

export const formatDistrictDataForLegacy = async (district, {totalCommonToponymRecords, totalSpecifCommonToponymRecords, totalAddressRecords, totalAddressCertifiedRecords}) => {
const {id, meta, labels} = district
const {id, meta, labels, config} = district
const {insee: {cog}} = meta

// District data from administrative division
Expand Down Expand Up @@ -65,7 +65,8 @@ export const formatDistrictDataForLegacy = async (district, {totalCommonToponymR
idRevision: meta?.bal?.idRevision,
dateRevision: meta?.bal?.dateRevision,
composedAt: new Date(),
withBanId: true
withBanId: true,
config
}
}

Expand Down Expand Up @@ -141,7 +142,8 @@ export const formatCommonToponymDataForLegacy = async (commonToponym, {district,
tiles: meta?.geography?.tiles,
position: legacyPosition,
displayBBox: commonToponymBbox,
dateMAJ: legacyUpdateDate
dateMAJ: legacyUpdateDate,
withBanId: true
}
}

Expand All @@ -168,7 +170,8 @@ export const formatCommonToponymDataForLegacy = async (commonToponym, {district,
tiles: meta?.geography?.tiles,
sources: ['bal'],
nbNumeros: Number.parseInt(addressCount, 10),
nbNumerosCertifies: Number.parseInt(certifiedAddressCount, 10)
nbNumerosCertifies: Number.parseInt(certifiedAddressCount, 10),
withBanId: true
}
}

Expand Down Expand Up @@ -240,7 +243,8 @@ export const formatAddressDataForLegacy = async (address, {district, commonTopon
certifie: certified,
codePostal: meta?.laposte?.codePostal,
libelleAcheminement: meta?.laposte?.libelleAcheminement,
adressesOriginales: [address]
adressesOriginales: [address],
withBanId: true
}
}

Expand Down

0 comments on commit 8ba17bb

Please sign in to comment.