summaryrefslogtreecommitdiff
path: root/sql/functions/auth.get_all_active_users.sql
diff options
context:
space:
mode:
authorckonstanski <carlos.konstanski@olo.com>2024-05-25 18:03:25 -0600
committerckonstanski <carlos.konstanski@olo.com>2024-05-25 18:03:25 -0600
commitb8423f4d05c75094b7b9d09c6f0bb353acc9be1c (patch)
tree3732f71f84191b26f038130c2220fb502d738251 /sql/functions/auth.get_all_active_users.sql
initial commit
Diffstat (limited to 'sql/functions/auth.get_all_active_users.sql')
-rw-r--r--sql/functions/auth.get_all_active_users.sql25
1 files changed, 25 insertions, 0 deletions
diff --git a/sql/functions/auth.get_all_active_users.sql b/sql/functions/auth.get_all_active_users.sql
new file mode 100644
index 0000000..243be63
--- /dev/null
+++ b/sql/functions/auth.get_all_active_users.sql
@@ -0,0 +1,25 @@
+drop function auth.get_all_active_users ();
+
+create or replace function auth.get_all_active_users ()
+returns setof auth.users
+as $$
+begin
+ return query
+ select u.id,
+ u.username,
+ u.pwd,
+ u.first_name,
+ u.last_name,
+ u.email,
+ u.phone,
+ u.active,
+ u.created
+ from auth.users u
+ where u.active = true::bool
+ order by u.last_name asc,
+ u.first_name asc,
+ u.id asc;
+
+ return;
+end;
+$$ language plpgsql;