From 3eafd595a724389a1f17a4d35867486e750bee9a Mon Sep 17 00:00:00 2001 From: dbauszus-glx Date: Fri, 27 Oct 2023 18:57:10 +0100 Subject: [PATCH] query templates --- mod/workspace/cache.js | 56 +++--------------------------- mod/workspace/templates/queries.js | 51 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 51 deletions(-) create mode 100644 mod/workspace/templates/queries.js diff --git a/mod/workspace/cache.js b/mod/workspace/cache.js index 0f11978ae3..0b5ac3e929 100644 --- a/mod/workspace/cache.js +++ b/mod/workspace/cache.js @@ -38,6 +38,8 @@ const mail_templates = require('./templates/mails') const msg_templates = require('./templates/msgs') +const query_templates = require('./templates/queries') + async function cache() { // Get workspace from source. @@ -56,58 +58,10 @@ async function cache() { ...view_templates, ...mail_templates, ...msg_templates, - ...custom_templates, + ...query_templates, - // Query templates: - gaz_query: { - template: require('./templates/gaz_query'), - }, - get_last_location: { - template: require('./templates/get_last_location'), - }, - distinct_values: { - template: require('./templates/distinct_values'), - }, - field_stats: { - template: require('./templates/field_stats'), - }, - field_min: { - template: require('./templates/field_min'), - }, - field_max: { - template: require('./templates/field_max'), - }, - get_nnearest: { - render: require('./templates/get_nnearest'), - }, - geojson: { - render: require('./templates/geojson'), - }, - cluster: { - render: require('./templates/cluster'), - reduce: true - }, - cluster_hex: { - render: require('./templates/cluster_hex'), - reduce: true - }, - wkt: { - render: require('./templates/wkt'), - reduce: true - }, - infotip: { - render: require('./templates/infotip'), - }, - layer_extent: { - template: require('./templates/layer_extent'), - }, - mvt_cache: { - admin: true, - render: require('./templates/mvt_cache'), - }, - mvt_cache_delete_intersects: { - template: require('./templates/mvt_cache_delete_intersects'), - }, + // Can override default templates. + ...custom_templates, // Default templates can be overridden by assigning a template with the same name. ...workspace.templates diff --git a/mod/workspace/templates/queries.js b/mod/workspace/templates/queries.js new file mode 100644 index 0000000000..6f515a50fb --- /dev/null +++ b/mod/workspace/templates/queries.js @@ -0,0 +1,51 @@ +module.exports = { + gaz_query: { + template: require('./gaz_query'), + }, + get_last_location: { + template: require('./get_last_location'), + }, + distinct_values: { + template: require('./distinct_values'), + }, + field_stats: { + template: require('./field_stats'), + }, + field_min: { + template: require('./field_min'), + }, + field_max: { + template: require('./field_max'), + }, + get_nnearest: { + render: require('./get_nnearest'), + }, + geojson: { + render: require('./geojson'), + }, + cluster: { + render: require('./cluster'), + reduce: true + }, + cluster_hex: { + render: require('./cluster_hex'), + reduce: true + }, + wkt: { + render: require('./wkt'), + reduce: true + }, + infotip: { + render: require('./infotip'), + }, + layer_extent: { + template: require('./layer_extent'), + }, + mvt_cache: { + admin: true, + render: require('./mvt_cache'), + }, + mvt_cache_delete_intersects: { + template: require('./mvt_cache_delete_intersects'), + } +} \ No newline at end of file