summaryrefslogtreecommitdiff
path: root/src/db/rest/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/rest/util')
-rw-r--r--src/db/rest/util/_api_get_user_id.sql4
-rw-r--r--src/db/rest/util/api_root.sql19
2 files changed, 21 insertions, 2 deletions
diff --git a/src/db/rest/util/_api_get_user_id.sql b/src/db/rest/util/_api_get_user_id.sql
index e86afc3..799affc 100644
--- a/src/db/rest/util/_api_get_user_id.sql
+++ b/src/db/rest/util/_api_get_user_id.sql
@@ -10,7 +10,7 @@ BEGIN
TRUE
)::JSON->>'user_id';
- UPDATE admin.user
+ UPDATE xssbook.user
SET seen = clock_timestamp()
WHERE id = _user_id;
@@ -18,5 +18,5 @@ BEGIN
END
$BODY$;
-GRANT UPDATE ON TABLE admin.user
+GRANT UPDATE ON TABLE xssbook.user
TO rest_anon, rest_user;
diff --git a/src/db/rest/util/api_root.sql b/src/db/rest/util/api_root.sql
new file mode 100644
index 0000000..7141a5f
--- /dev/null
+++ b/src/db/rest/util/api_root.sql
@@ -0,0 +1,19 @@
+
+CREATE FUNCTION FUNCTION _api.root()
+RETURNS JSON
+LANGUAGE plpgsql;
+AS $BODY$
+DECLARE
+openapi JSON = $$
+ {
+ "swagger": "2.0",
+ "info": {
+ "title": "XSSBook",
+ "description": "XSSBook Api Documentation"
+ }
+ }
+$$;
+BEGIN
+ RETURN openapi;
+END
+$BODY$;