xssbook2/db/rest/rest.sql

43 lines
1.1 KiB
PL/PgSQL

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;