big refacto
This commit is contained in:
@@ -2,8 +2,6 @@ package account
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"nos-comptes/handler"
|
||||
"nos-comptes/internal/storage/dao/postgresql"
|
||||
"nos-comptes/internal/storage/model"
|
||||
"nos-comptes/internal/storage/validators"
|
||||
"nos-comptes/internal/user"
|
||||
@@ -16,7 +14,7 @@ type Context struct {
|
||||
service *Service
|
||||
db *Database
|
||||
userService *user.Service
|
||||
*handler.Context
|
||||
validator *Validator
|
||||
}
|
||||
|
||||
func (c *Context) GetAllAccountOfUser(gc *gin.Context) {
|
||||
@@ -92,9 +90,6 @@ func (c *Context) GetSpecificAccountOfUser(gc *gin.Context) {
|
||||
utils.JSON(gc.Writer, http.StatusOK, account)
|
||||
}
|
||||
|
||||
func NewHandler(ctx *handler.Context, db *postgresql.DatabasePostgreSQL) *Context {
|
||||
database := NewDatabase(db)
|
||||
service := NewService(database)
|
||||
userService := user.NewService(user.NewDatabase(db))
|
||||
return &Context{service: service, db: database, userService: userService, Context: ctx}
|
||||
func NewHandler(validator *Validator, database *Database, service *Service, userService *user.Service) *Context {
|
||||
return &Context{service: service, db: database, userService: userService, validator: validator}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user