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:
2026-08-18 11:13:53 +05:00
parent 514b9ca5fc
commit 0788585c0e
6 changed files with 119 additions and 143 deletions

View File

@@ -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
}