- Go Programming Language v1.20.x
- MySQL v5.7.x
- AIR (Go Live Reloader)
- Docker
- Your favorite code editor
Before running API server, you should set your env. Your DB will automatically generated and the name will be combination of your app name and your stage. (ex: myapp_dev)
# Run
cd assestment_go_source_code_krisna_satriadi
make run
# Run (with live reload)
cd assestment_go_source_code_krisna_satriadi
make live
# Build
cd assestment_go_source_code_krisna_satriadi
make build
# Build Docker image andd container
cd assestment_go_source_code_krisna_satriadi
make container
.
├── cmd
│ └── api
│ └── main.go // main package
├── config // config control
│ └── config.go
├── core
│ ├── model // data model
│ │ ├── model_customer.go
│ │ ├── model_invoice.go
│ │ ├── model_item.go
│ │ ├── model_item_type.go
│ │ ├── model_misc.go
│ │ └── model_quantity.go
│ ├── ports // ports/interface
│ │ ├── ports_customer.go
│ │ ├── ports_invoice.go
│ │ ├── ports_item.go
│ │ ├── ports_item_type.go
│ │ ├── ports_misc.go
│ │ └── ports_quantity.go
│ └── services // service layer
│ ├── service_customer.go
│ ├── service_invoice.go
│ ├── service_item.go
│ ├── service_item_type.go
│ ├── service_misc.go
│ └── service_quantity.go
├── di // dependency injector
│ └── di.go
├── documentation // postman documentation
│ ├── assessment_krisna.postman_collection.json
│ └── assessment_krisna.postman_environment.json
├── go.mod
├── go.sum
├── Makefile
├── README.md // YOU ARE HERE
├── sources // data sources directory
│ └── gorm
│ ├── gorm_adapter // gorm adapter/repository
│ │ ├── gorm_adapter_base.go
│ │ ├── gorm_adapter_customer.go
│ │ ├── gorm_adapter_invoice.go
│ │ ├── gorm_adapter_item.go
│ │ ├── gorm_adapter_item_type.go
│ │ └── gorm_adapter_quantity.go
│ └── gorm_connection // gorm connector starter
│ └── gorm_connection.go
├── transports // data presenter directory
│ └── fiber
│ ├── fiber_handler // restAPI handler
│ │ ├── fiber_handler_customer.go
│ │ ├── fiber_handler_invoice.go
│ │ ├── fiber_handler_item.go
│ │ ├── fiber_handler_item_type.go
│ │ ├── fiber_handler_misc.go
│ │ └── fiber_handler_quantity.go
│ ├── fiber_middleware // API middleware
│ │ └── middleware.go
│ ├── fiber_presenter // json presenter
│ │ └── fiber_presenter.go
│ └── fiber_router // http router
│ └── router.go
└── utils // utils storage
├── checker.go
├── errors.go
├── logger.go
├── ulid.go
└── validator.go
GET
: Get all customersPOST
: Create a new customer
PUT
: Update a customerDELETE
: Delete a customer
GET
: Get all invoicesPOST
: Create a new invoice
GET
: Get detail invoice by idPUT
: Update a invoiceDELETE
: Delete a invoice
DELETE
: Delete invoice item
GET
: Get all typesPOST
: Create a new type
PUT
: Update a typeDELETE
: Delete a type
GET
: Get all itemsPOST
: Create a new item
PUT
: Update a itemDELETE
: Delete a item