From: Justin Wind Date: Sat, 30 Jul 2022 17:35:24 +0000 (-0700) Subject: fix postgres duration queries to return expected integer type X-Git-Tag: v1.3.10^2~11 X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=e5c67776b7a31daac84b5a047f9e566657e5b7f9;p=websub-hub fix postgres duration queries to return expected integer type --- diff --git a/src/db/postgres/sql/topic-get-by-id.sql b/src/db/postgres/sql/topic-get-by-id.sql index 598b675..71d36ed 100644 --- a/src/db/postgres/sql/topic-get-by-id.sql +++ b/src/db/postgres/sql/topic-get-by-id.sql @@ -3,9 +3,9 @@ SELECT id, created, url, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max, + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max, publisher_validation_url, content_hash_algorithm, is_active, diff --git a/src/db/postgres/sql/topic-get-by-url.sql b/src/db/postgres/sql/topic-get-by-url.sql index 13aa67c..877c2a1 100644 --- a/src/db/postgres/sql/topic-get-by-url.sql +++ b/src/db/postgres/sql/topic-get-by-url.sql @@ -3,9 +3,9 @@ SELECT id, created, url, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max, + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max, publisher_validation_url, content_hash_algorithm, is_active, diff --git a/src/db/postgres/sql/topic-get-content-by-id.sql b/src/db/postgres/sql/topic-get-content-by-id.sql index f603991..bafda95 100644 --- a/src/db/postgres/sql/topic-get-content-by-id.sql +++ b/src/db/postgres/sql/topic-get-content-by-id.sql @@ -1,7 +1,7 @@ -- topic including content SELECT *, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max FROM topic WHERE id = $(topicId) diff --git a/src/db/postgres/sql/topic-get-info-all.sql b/src/db/postgres/sql/topic-get-info-all.sql index e428903..4d9aa0d 100644 --- a/src/db/postgres/sql/topic-get-info-all.sql +++ b/src/db/postgres/sql/topic-get-info-all.sql @@ -3,9 +3,9 @@ SELECT t.id, created, url, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max, + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max, t.publisher_validation_url, t.content_hash_algorithm, t.is_active,