From c6ba52a6bc876513a2efab1ea211a1304519095c Mon Sep 17 00:00:00 2001 From: mirdono Date: Tue, 1 Jul 2025 09:59:40 +0200 Subject: [PATCH] chore: formatted organisations report configuration --- config/reports/organizations-report.js | 55 +++++++++++++------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/config/reports/organizations-report.js b/config/reports/organizations-report.js index d8e666e..51621f3 100644 --- a/config/reports/organizations-report.js +++ b/config/reports/organizations-report.js @@ -1,17 +1,17 @@ -import { generateReportFromData, batchedQuery } from '../helpers.js'; -import { PREFIXES } from './utils' +import { generateReportFromData, batchedQuery } from "../helpers.js"; +import { PREFIXES } from "./utils"; export default { - cronPattern: '0 00 23 * * *', - name: 'organizations', + cronPattern: "0 00 23 * * *", + name: "organizations", execute: async () => { const reportData = { - title: 'organizations', - description: 'List of the Organizations', - filePrefix: 'exports/organizations' + title: "organizations", + description: "List of the Organizations", + filePrefix: "exports/organizations", }; - console.log('Generating organizations report'); + console.log("Generating organizations report"); const queryStringPart1 = ` ${PREFIXES} @@ -44,12 +44,12 @@ export default { const queryResponsePart1 = await batchedQuery(queryStringPart1); - const dataPart1 = queryResponsePart1.results.bindings.reduce( (acc, row) => { - acc[getSafeValue(row, 'bestuur')] = { - bestuur: getSafeValue(row, 'bestuur'), - label: getSafeValue(row, 'label'), - classification: getSafeValue(row, 'classification'), - typeEredienst: getSafeValue(row, 'typeEredienst'), + const dataPart1 = queryResponsePart1.results.bindings.reduce((acc, row) => { + acc[getSafeValue(row, "bestuur")] = { + bestuur: getSafeValue(row, "bestuur"), + label: getSafeValue(row, "label"), + classification: getSafeValue(row, "classification"), + typeEredienst: getSafeValue(row, "typeEredienst"), }; return acc; }, {}); @@ -85,27 +85,28 @@ export default { `; const queryResponsePart2 = await batchedQuery(queryStringPart2); - const dataPart2 = queryResponsePart2.results.bindings.reduce( (acc, row) => { + const dataPart2 = queryResponsePart2.results.bindings.reduce((acc, row) => { let dataPart = { - bestuur: getSafeValue(row, 'bestuur'), - provincie: getSafeValue(row, 'provincie') + bestuur: getSafeValue(row, "bestuur"), + provincie: getSafeValue(row, "provincie"), }; - acc[getSafeValue(row, 'bestuur')] = Object.assign(dataPart, dataPart1[getSafeValue(row, 'bestuur')]); + acc[getSafeValue(row, "bestuur")] = Object.assign( + dataPart, + dataPart1[getSafeValue(row, "bestuur")], + ); return acc; }, {}); - await generateReportFromData(Object.values(dataPart2), [ - 'bestuur', - 'label', - 'classification', - 'typeEredienst', - 'provincie' - ], reportData); - } + await generateReportFromData( + Object.values(dataPart2), + ["bestuur", "label", "classification", "typeEredienst", "provincie"], + reportData, + ); + }, }; -function getSafeValue(entry, property){ +function getSafeValue(entry, property) { return entry[property] ? wrapInQuote(entry[property].value) : null; }