refactor: moved hashing logic into application layer for security;

fix: error handling in auth service for database;
refactor: removed redundant taken email check;
chore: removed todos that were completed/not needed;
fix: leaking transactions in complete registration and login on error;
refactor: got rid of txless requests during transactions;
This commit is contained in:
2025-07-06 13:01:00 +03:00
parent 5e32c3cbd3
commit 333817c9e1
9 changed files with 177 additions and 121 deletions

View File

@@ -0,0 +1,17 @@
package errors
import (
"errors"
"github.com/jackc/pgx/v5/pgconn"
)
func GetPgError(err error) string {
var pgErr *pgconn.PgError
errors.As(err, &pgErr)
return pgErr.Code
}
func MatchPgError(err error, code string) bool {
return GetPgError(err) == code
}