mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-02-11 14:48:35 -06:00
21 lines
462 B
Go
21 lines
462 B
Go
package users
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
|
"github.com/eduardolat/pgbackweb/internal/util/cryptoutil"
|
|
)
|
|
|
|
func (s *Service) CreateUser(
|
|
ctx context.Context, params dbgen.UsersServiceCreateUserParams,
|
|
) (dbgen.User, error) {
|
|
hash, err := cryptoutil.CreateBcryptHash(params.Password)
|
|
if err != nil {
|
|
return dbgen.User{}, err
|
|
}
|
|
params.Password = hash
|
|
|
|
return s.dbgen.UsersServiceCreateUser(ctx, params)
|
|
}
|