summaryrefslogtreecommitdiff
path: root/db/rest/user/api_user_insert.sql
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
);