feat: update auth and fix url for gitea
Some checks failed
Backend ci / build (push) Failing after 3m12s
Backend ci / build (pull_request) Failing after 3m6s

This commit is contained in:
d3m0k1d
2026-02-12 19:14:23 +03:00
parent 7464828e07
commit 809879971a
5 changed files with 13 additions and 11 deletions

View File

@@ -20,16 +20,20 @@ func NewAuthRepository(db *sql.DB) AuthRepository {
}
}
func (a *authRepository) Register(ctx context.Context, user storage.UserReg) error {
func (a *authRepository) Register(ctx context.Context, user storage.UserReg) (int, error) {
var id int
_, err := a.db.Exec(
"INSERT INTO users(email, github_id, github_login, avatar_url) VALUES(?, ?, ?, ?)",
)
if err != nil {
a.logger.Error("error scan: " + err.Error())
return err
a.logger.Error("error request: " + err.Error())
return 0, err
}
row := a.db.QueryRow("SELECT id FROM users WHERE github_id = ?", user.GithubID)
row.Scan(&id)
a.logger.Info("User registered:", "email", user.Email)
return nil
return id, nil
}
func (a *authRepository) IsRegistered(ctx context.Context, github_id int) (bool, error) {