feat: change user password
This commit is contained in:
@@ -40,6 +40,18 @@ func (r *UserRepo) CreateUser(ctx context.Context, email string, name string, pa
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func (r *UserRepo) ChangePassword(ctx context.Context, userID string, passwordHash string) error {
|
||||
_, err := r.db.ExecContext(ctx,
|
||||
"UPDATE users SET password_hash = $1 WHERE id = $2",
|
||||
passwordHash, userID,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update user: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *UserRepo) GetUserByEmail(ctx context.Context, email string) (*domain.User, error) {
|
||||
user := &domain.User{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user