Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:

# Next hooks are Code Quality hooks.
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-golang
args:
- --autofix
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Miro Board: https://miro.com/app/board/uXjVKVoZwos=/?share_link_id=718027124865

# Tech Challenge
# Tech Challenge Cart API

## Install

Expand Down Expand Up @@ -138,8 +138,6 @@ kubectl port-forward svc/tech-challenge-service 4000:80 -n dev
- `internal`: Directory to contain application code that should not be exposed to external packages.
- `core`: Directory that contains the application's core business logic.
- `cart`: Directory contains definition of the entity's heights, interfaces, repository and service of the entity Cart.
- `customer`: Directory contains definition of the entity's heights, interfaces, repository and service of the entity Customer.
- `order`: Directory contains definition of the entity's heights, interfaces, repository and service of the entity Order.
- `product`: Directory contains definition of the entity's heights, interfaces, repository and service of the entity Product.
- `adapters`: Directory to contain external services that will interact with the application core.
- `db`: Directory contains the implementation of the repositories.
Expand Down
15 changes: 2 additions & 13 deletions cmd/http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
dbAdapter "github.com/pangolin-do-golang/tech-challenge/internal/adapters/db"
"github.com/pangolin-do-golang/tech-challenge/internal/adapters/rest/server"
"github.com/pangolin-do-golang/tech-challenge/internal/core/cart"
"github.com/pangolin-do-golang/tech-challenge/internal/core/customer"
"github.com/pangolin-do-golang/tech-challenge/internal/core/order"
"github.com/pangolin-do-golang/tech-challenge/internal/core/product"
"gorm.io/driver/postgres"
"gorm.io/gorm"
Expand All @@ -29,25 +27,16 @@ func main() {
panic(err)
}

customerRepository := dbAdapter.NewPostgresCustomerRepository(db)
customerService := customer.NewService(customerRepository)

productRepository := dbAdapter.NewPostgresProductRepository(db)
productService := product.NewProductService(productRepository)

cartRepository := dbAdapter.NewPostgresCartRepository(db)
cartProductsRepository := dbAdapter.NewPostgresCartProductsRepository(db)
cartService := cart.NewService(cartRepository, cartProductsRepository)

orderRepository := dbAdapter.NewPostgresOrderRepository(db)
orderProductRepository := dbAdapter.NewPostgresOrderProductsRepository(db)
orderService := order.NewOrderService(orderRepository, orderProductRepository, cartService, productService)

restServer := server.NewRestServer(&server.RestServerOptions{
OrderService: orderService,
ProductService: productService,
CartService: cartService,
CustomerService: customerService,
ProductService: productService,
CartService: cartService,
})

restServer.Serve()
Expand Down
Loading