big refacto
This commit is contained in:
@@ -2,10 +2,9 @@ package expense
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"gopkg.in/go-playground/validator.v9"
|
||||
"net/http"
|
||||
"nos-comptes/handler"
|
||||
"nos-comptes/internal/account"
|
||||
"nos-comptes/internal/storage/dao/postgresql"
|
||||
"nos-comptes/internal/storage/model"
|
||||
"nos-comptes/internal/storage/validators"
|
||||
"nos-comptes/internal/utils"
|
||||
@@ -18,7 +17,7 @@ type Context struct {
|
||||
service *Service
|
||||
db *Database
|
||||
accountService *account.Service
|
||||
*handler.Context
|
||||
validator *validator.Validate
|
||||
}
|
||||
|
||||
func (c *Context) ImportExpenseFromCSV(gc *gin.Context) {
|
||||
@@ -124,9 +123,6 @@ func (c *Context) GetAnExpenses(context *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func NewHandler(ctx *handler.Context, db *postgresql.DatabasePostgreSQL) *Context {
|
||||
database := NewDatabase(db)
|
||||
service := NewService(database)
|
||||
accountService := account.NewService(account.NewDatabase(db))
|
||||
return &Context{service: service, db: database, accountService: accountService, Context: ctx}
|
||||
func NewHandler(validator *validator.Validate, database *Database, service *Service, accountService *account.Service) *Context {
|
||||
return &Context{service: service, db: database, accountService: accountService, validator: validator}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user