Fix user alias availability check (#832)

Related to #831

Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
This commit is contained in:
Sergio C. Arteaga 2020-11-09 09:03:53 +01:00 committed by GitHub
parent 40ce3f423f
commit 98d2f75f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 13 deletions

View File

@ -18,19 +18,25 @@ import (
const ( const (
// Database queries // Database queries
checkUserAliasAvailDBQ = `select user_id from "user" where alias = $1` checkUserAliasAvailDBQ = `
checkUserCredsDBQ = `select user_id, password from "user" where email = $1 and password is not null and email_verified = true` select user_id
deleteSessionDBQ = `delete from session where session_id = $1` from "user" u
getAPIKeyUserIDDBQ = `select user_id from api_key where key = $1` join email_verification_code c using (user_id)
getSessionDBQ = `select user_id, floor(extract(epoch from created_at)) from session where session_id = $1` where u.alias = $1
getUserIDDBQ = `select user_id from "user" where email = $1` and current_timestamp - '1 day'::interval < c.created_at
getUserPasswordDBQ = `select password from "user" where user_id = $1 and password is not null` `
getUserProfileDBQ = `select get_user_profile($1::uuid)` checkUserCredsDBQ = `select user_id, password from "user" where email = $1 and password is not null and email_verified = true`
registerSessionDBQ = `select register_session($1::jsonb)` deleteSessionDBQ = `delete from session where session_id = $1`
registerUserDBQ = `select register_user($1::jsonb)` getAPIKeyUserIDDBQ = `select user_id from api_key where key = $1`
updateUserPasswordDBQ = `select update_user_password($1::uuid, $2::text, $3::text)` getSessionDBQ = `select user_id, floor(extract(epoch from created_at)) from session where session_id = $1`
updateUserProfileDBQ = `select update_user_profile($1::uuid, $2::jsonb)` getUserIDDBQ = `select user_id from "user" where email = $1`
verifyEmailDBQ = `select verify_email($1::uuid)` getUserPasswordDBQ = `select password from "user" where user_id = $1 and password is not null`
getUserProfileDBQ = `select get_user_profile($1::uuid)`
registerSessionDBQ = `select register_session($1::jsonb)`
registerUserDBQ = `select register_user($1::jsonb)`
updateUserPasswordDBQ = `select update_user_password($1::uuid, $2::text, $3::text)`
updateUserProfileDBQ = `select update_user_profile($1::uuid, $2::jsonb)`
verifyEmailDBQ = `select verify_email($1::uuid)`
) )
var ( var (