From 08e435104c42751689553537b1f20ffb14b8dfcc Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sat, 18 Jul 2026 21:18:18 -0600 Subject: initial commit --- sql/functions/auth.get_registration_by_id.sql | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 sql/functions/auth.get_registration_by_id.sql (limited to 'sql/functions/auth.get_registration_by_id.sql') diff --git a/sql/functions/auth.get_registration_by_id.sql b/sql/functions/auth.get_registration_by_id.sql new file mode 100644 index 0000000..dc9fdc1 --- /dev/null +++ b/sql/functions/auth.get_registration_by_id.sql @@ -0,0 +1,25 @@ +drop function auth.get_registration_by_id ( + p_id bigint +); + +create or replace function auth.get_registration_by_id ( + p_id bigint +) +returns setof auth.registrations_t +as $$ +begin + return query + select r.id, + substring(r.hash::text from 3), + r.first_name, + r.last_name, + r.email, + r.role_groups, + r.created, + (r.created - (now() - interval '3 days'))::interval as valid_for + from auth.registrations r + where r.id = p_id; + + return; +end; +$$ language plpgsql; -- cgit v1.3