feat: add password and fix errors

This commit is contained in:
Elton Minetto
2020-06-29 13:38:13 -03:00
parent 328b4e428c
commit d4b9b713e4
12 changed files with 246 additions and 21 deletions
+2
View File
@@ -1,6 +1,7 @@
package handler
import (
"fmt"
"net/http"
"github.com/eminetto/clean-architecture-go-v2/domain/entity/user"
@@ -56,6 +57,7 @@ func borrowBook(bService book.UseCase, uService user.UseCase, loanService loan.U
}
err = loanService.Borrow(u, b)
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(errorMessage))
return
+3 -1
View File
@@ -9,6 +9,8 @@ import (
"strconv"
"time"
"github.com/eminetto/clean-architecture-go-v2/pkg/password"
"github.com/eminetto/clean-architecture-go-v2/domain/loan"
"github.com/eminetto/clean-architecture-go-v2/domain/entity/user"
@@ -39,7 +41,7 @@ func main() {
bookService := book.NewService(bookRepo)
userRepo := user.NewMySQLRepoRepository(db)
userService := user.NewService(userRepo)
userService := user.NewService(userRepo, password.NewService())
loanService := loan.NewService(userService, bookService)