From 944b6b0526032ad8c1b4a2612d6723bec75e0e4c Mon Sep 17 00:00:00 2001
From: Freya Murphy <freya@freyacat.org>
Date: Fri, 29 Mar 2024 22:29:56 -0400
Subject: start database (user and post), and initial barebones home page

---
 db/rest/user/api_user.sql | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 db/rest/user/api_user.sql

(limited to 'db/rest/user/api_user.sql')

diff --git a/db/rest/user/api_user.sql b/db/rest/user/api_user.sql
new file mode 100644
index 0000000..e45768a
--- /dev/null
+++ b/db/rest/user/api_user.sql
@@ -0,0 +1,23 @@
+CREATE VIEW api.user AS
+	SELECT
+		u.id,
+		u.username,
+		NULL AS password,
+		u.role,
+		u.first_name,
+		u.last_name,
+		u.middle_name,
+		u.email,
+		u.gender,
+		u.join_date,
+		u.birth_date,
+		u.profile_avatar,
+		u.profile_banner,
+		u.profile_bio
+	FROM
+		admin.user u;
+
+GRANT SELECT ON TABLE api.user
+	TO rest_anon, rest_user;
+GRANT SELECT ON TABLE admin.user
+	TO rest_anon, rest_user;
-- 
cgit v1.2.3-freya

