summaryrefslogtreecommitdiff
path: root/db/rest/user/api_user_insert.sql
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-03-30 16:36:54 -0400
committerFreya Murphy <freya@freyacat.org>2024-03-30 16:36:54 -0400
commit1f647374a8cdf3bc5c2d29ff8be277b027925c8c (patch)
tree9fdf42d250edb941de13ecd1aab9185ba2b30b00 /db/rest/user/api_user_insert.sql
parentrename views to _views (diff)
downloadxssbook2-1f647374a8cdf3bc5c2d29ff8be277b027925c8c.tar.gz
xssbook2-1f647374a8cdf3bc5c2d29ff8be277b027925c8c.tar.bz2
xssbook2-1f647374a8cdf3bc5c2d29ff8be277b027925c8c.zip
post comments, refactor post loading, hide load more btn
Diffstat (limited to 'db/rest/user/api_user_insert.sql')
-rw-r--r--db/rest/user/api_user_insert.sql15
1 files changed, 11 insertions, 4 deletions
diff --git a/db/rest/user/api_user_insert.sql b/db/rest/user/api_user_insert.sql
index da3ae2d..2297ecd 100644
--- a/db/rest/user/api_user_insert.sql
+++ b/db/rest/user/api_user_insert.sql
@@ -5,6 +5,16 @@ AS $BODY$
DECLARE
_length INTEGER;
BEGIN
+
+ NEW.username := _api.trim(NEW.username);
+ NEW.password := _api.trim(NEW.password);
+ NEW.first_name := _api.trim(NEW.first_name);
+ NEW.last_name := _api.trim(NEW.last_name);
+ NEW.middle_name := _api.trim(NEW.middle_name);
+ NEW.email := _api.trim(NEW.email);
+ NEW.gender := _api.trim(NEW.gender);
+ NEW.profile_bio := _api.trim(NEW.profile_bio);
+
PERFORM _api.validate_text(
_text => NEW.username,
_column => 'username',
@@ -22,6 +32,7 @@ BEGIN
PERFORM _api.validate_text(
_text => NEW.password,
_column => 'password',
+ _min => 1,
_max => 256
);
@@ -82,8 +93,6 @@ BEGIN
email,
gender,
birth_date,
- profile_avatar,
- profile_banner,
profile_bio
) VALUES (
NEW.username,
@@ -94,8 +103,6 @@ BEGIN
NEW.email,
NEW.gender,
NEW.birth_date,
- NEW.profile_avatar,
- NEW.profile_banner,
NEW.profile_bio
);