From 37a3214f67ebba75d16def7cfc24e8428f35491a Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Thu, 24 Nov 2016 13:05:31 +0100 Subject: [PATCH] Add quota functions to client #302 --- client/renderer/interface.yaml | 13 +++++++++++++ client/sql/16_custom_types.sql | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/client/renderer/interface.yaml b/client/renderer/interface.yaml index 4abe429..be758f9 100644 --- a/client/renderer/interface.yaml +++ b/client/renderer/interface.yaml @@ -377,3 +377,16 @@ multi_field: true params: - { name: aggregate_type, type: text, default: 'NULL' } + +- name: cdb_service_params + return_type: SETOF cdb_dataservices_client.service_params + multi_row: true + no_params: true + params: + - {} + +- name: cdb_enough_quota + return_type: BOOLEAN + params: + - { name: service, type: cdb_dataservices_client.service_type } + - { name: input_size, type: NUMERIC } \ No newline at end of file diff --git a/client/sql/16_custom_types.sql b/client/sql/16_custom_types.sql index 0bb19a2..c400443 100644 --- a/client/sql/16_custom_types.sql +++ b/client/sql/16_custom_types.sql @@ -18,3 +18,21 @@ CREATE TYPE cdb_dataservices_client.obs_meta_denominator AS (denom_id text, deno CREATE TYPE cdb_dataservices_client.obs_meta_geometry AS (geom_id text, geom_name text, geom_description text, geom_weight text, geom_aggregate text, geom_license text, geom_source text, valid_numer boolean, valid_denom boolean, valid_timespan boolean, score numeric, numtiles bigint, notnull_percent numeric, numgeoms numeric, percentfill numeric, estnumgeoms numeric, meanmediansize numeric); CREATE TYPE cdb_dataservices_client.obs_meta_timespan AS (timespan_id text, timespan_name text, timespan_description text, timespan_weight text, timespan_aggregate text, timespan_license text, timespan_source text, valid_numer boolean, valid_denom boolean, valid_geom boolean); + + +-- For quotas and services configuration +CREATE TYPE cdb_dataservices_client.service_type AS ENUM ( + 'isolines', + 'hires_geocoder', + 'routing', + 'observatory', + 'internal_geocoder' +); + +CREATE TYPE cdb_dataservices_client.service_params AS ( + service cdb_dataservices_client.service_type, + monthly_quota NUMERIC, + used_quota NUMERIC, + soft_limit BOOLEAN, + provider TEXT +);