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/rest.sql | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 db/rest/rest.sql

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

diff --git a/db/rest/rest.sql b/db/rest/rest.sql
new file mode 100644
index 0000000..a286f9d
--- /dev/null
+++ b/db/rest/rest.sql
@@ -0,0 +1,43 @@
+BEGIN TRANSACTION;
+SET search_path = public;
+
+DROP SCHEMA IF EXISTS api CASCADE;
+CREATE SCHEMA api;
+
+DROP SCHEMA IF EXISTS _api CASCADE;
+CREATE SCHEMA _api;
+
+GRANT USAGE ON SCHEMA admin TO rest_anon, rest_user;
+GRANT USAGE ON SCHEMA sys TO rest_anon, rest_user;
+
+GRANT USAGE ON SCHEMA api TO rest_anon, rest_user;
+GRANT USAGE ON SCHEMA _api TO rest_anon, rest_user;
+
+-- util
+\i /db/rest/util/_api_serve_media.sql;
+\i /db/rest/util/_api_raise.sql;
+\i /db/rest/util/_api_raise_null.sql;
+\i /db/rest/util/_api_raise_unique.sql;
+\i /db/rest/util/_api_validate_text.sql;
+\i /db/rest/util/_api_get_user_id.sql;
+
+-- user
+\i /db/rest/user/api_user.sql;
+\i /db/rest/user/api_user_insert.sql;
+\i /db/rest/user/api_user_update.sql;
+\i /db/rest/user/api_user_delete.sql;
+\i /db/rest/user/api_avatar.sql;
+
+-- post
+\i /db/rest/post/api_post.sql;
+\i /db/rest/post/api_post_insert.sql;
+\i /db/rest/post/api_post_update.sql;
+\i /db/rest/post/api_post_delete.sql;
+
+-- login
+\i /db/rest/login/_api_sign_jwt.sql;
+\i /db/rest/login/_api_verify_jwt.sql;
+\i /db/rest/login/_api_validate_role.sql;
+\i /db/rest/login/api_login.sql;
+
+COMMIT TRANSACTION;
-- 
cgit v1.2.3-freya

