diff options
author | Freya Murphy <freya@freyacat.org> | 2024-03-30 12:14:42 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-03-30 12:14:42 -0400 |
commit | 1f04b83be337cc91a3fabcf4e574e2306f3d2eaa (patch) | |
tree | 74d7d65a7047e60d1877384e3c7b0d70c7b0e49a /db/rest | |
parent | start database (user and post), and initial barebones home page (diff) | |
download | xssbook2-1f04b83be337cc91a3fabcf4e574e2306f3d2eaa.tar.gz xssbook2-1f04b83be337cc91a3fabcf4e574e2306f3d2eaa.tar.bz2 xssbook2-1f04b83be337cc91a3fabcf4e574e2306f3d2eaa.zip |
refactor
Diffstat (limited to 'db/rest')
-rw-r--r-- | db/rest/post/api_post.sql | 3 | ||||
-rw-r--r-- | db/rest/post/api_post_insert.sql | 2 | ||||
-rw-r--r-- | db/rest/util/_api_validate_text.sql | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/db/rest/post/api_post.sql b/db/rest/post/api_post.sql index a91d9d2..b49289c 100644 --- a/db/rest/post/api_post.sql +++ b/db/rest/post/api_post.sql @@ -5,7 +5,8 @@ CREATE VIEW api.post AS p.content, p.date FROM - admin.post p; + admin.post p + ORDER BY id DESC; GRANT SELECT ON TABLE api.post TO rest_anon, rest_user; diff --git a/db/rest/post/api_post_insert.sql b/db/rest/post/api_post_insert.sql index 9eb200c..02b9d8d 100644 --- a/db/rest/post/api_post_insert.sql +++ b/db/rest/post/api_post_insert.sql @@ -32,6 +32,8 @@ GRANT INSERT ON TABLE api.post TO rest_user; GRANT INSERT ON TABLE admin.post TO rest_user; +GRANT UPDATE ON TABLE sys.post_id_seq + TO rest_user; CREATE TRIGGER api_post_insert_trgr INSTEAD OF INSERT diff --git a/db/rest/util/_api_validate_text.sql b/db/rest/util/_api_validate_text.sql index 2a3764c..e4a6a7b 100644 --- a/db/rest/util/_api_validate_text.sql +++ b/db/rest/util/_api_validate_text.sql @@ -29,7 +29,7 @@ BEGIN IF _min IS NOT NULL AND _length < _min THEN PERFORM _api.raise( - _msg => 'api_text_min', + _msg => 'api_min_value', _detail => _column, _hint => _min || '' ); @@ -37,7 +37,7 @@ BEGIN IF _max IS NOT NULL AND _length > _max THEN PERFORM _api.raise( - _msg => 'api_text_max', + _msg => 'api_max_value', _detail => _column, _hint => _max || '' ); |