Assign users to roles via role_user and drop unused social media and light-mode fields.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -190,6 +190,16 @@ func (r *repository) CompleteRegistration(ctx context.Context, v auth.Verificati
|
||||
return 0, err
|
||||
}
|
||||
|
||||
tag, err := tx.Exec(ctx, `
|
||||
INSERT INTO role_user (role_id, user_id)
|
||||
SELECT r.id, $1 FROM roles r WHERE r.code = 'user'`, userID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if tag.RowsAffected() == 0 {
|
||||
return 0, errors.New(`role "user" not found`)
|
||||
}
|
||||
|
||||
if _, err := tx.Exec(ctx, `DELETE FROM registration_verifications WHERE id = $1`, v.ID); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user