feat: add password and fix errors
This commit is contained in:
@@ -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
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user