Skip to main content

API structure

Our current API structure:

.
├── README.md
├── apiv1.api_backup
│   └── main.go
├── bin
│   ├── cfbi-api
│   └── cfbi-api2
├── config
│   └── config.go
├── db
│   └── migration
│   └── main.sql
├── dispatcher
│   ├── inventory
│   │   ├── product.go
│   │   ├── product_api.go
│   │   ├── product_dto.go
│   │   ├── product_mapper.go
│   │   ├── product_repository.go
│   │   └── product_service.go
│   ├── order
│   │   ├── order.go
│   │   ├── order_api.go
│   │   ├── order_dto.go
│   │   ├── order_mapper.go
│   │   ├── order_repository.go
│   │   └── order_service.go
│   └── order_detail
│   ├── order_detail.go
│   ├── order_detail_api.go
│   ├── order_detail_dto.go
│   ├── order_detail_mapper.go
│   ├── order_detail_repository.go
│   └── order_detail_service.go
├── features
│   ├── coupon
│   ├── review
│   └── wishlist
├── go.mod
├── go.sum
├── identity
│   ├── customer
│   │   ├── customer.go
│   │   ├── customer_api.go
│   │   ├── customer_dto.go
│   │   ├── customer_mapper.go
│   │   ├── customer_repository.go
│   │   └── customer_service.go
│   └── merchant
│   ├── merchant.go
│   ├── merchant_api.go
│   ├── merchant_dto.go
│   ├── merchant_mapper.go
│   ├── merchant_repository.go
│   └── merchant_service.go
├── legacy
│   └── efood.go
├── main.go
├── payment
│   └── payment.go
├── wire.go
└── wire_gen.go

18 directories, 43 files

migrate is a bash script that controls the migrations of the database tables.

src/main.go is the main entry way into the API.

review, coupon, and wishlist have not been implemented yet, but maybe in the future.

Endpoints

Current list of used endpoints, though not all of these are used.

[GIN-debug] GET    /products                 --> cfbi-api/dispatcher/inventory.(*ProductAPI).FindAll-fm (3 handlers)
[GIN-debug] GET /products/:id --> cfbi-api/dispatcher/inventory.(*ProductAPI).FindByID-fm (3 handlers)
[GIN-debug] POST /products --> cfbi-api/dispatcher/inventory.(*ProductAPI).Create-fm (3 handlers)
[GIN-debug] PUT /products/:id --> cfbi-api/dispatcher/inventory.(*ProductAPI).Update-fm (3 handlers)
[GIN-debug] DELETE /products/:id --> cfbi-api/dispatcher/inventory.(*ProductAPI).Delete-fm (3 handlers)
[GIN-debug] GET /merchants --> cfbi-api/identity/merchant.(*MerchantAPI).FindAll-fm (3 handlers)
[GIN-debug] GET /merchants/:id --> cfbi-api/identity/merchant.(*MerchantAPI).FindByID-fm (3 handlers)
[GIN-debug] POST /merchants --> cfbi-api/identity/merchant.(*MerchantAPI).Create-fm (3 handlers)
[GIN-debug] PUT /merchants/:id --> cfbi-api/identity/merchant.(*MerchantAPI).Update-fm (3 handlers)
[GIN-debug] DELETE /merchants/:id --> cfbi-api/identity/merchant.(*MerchantAPI).Delete-fm (3 handlers)
[GIN-debug] GET /customers --> cfbi-api/identity/customer.(*CustomerAPI).FindAll-fm (3 handlers)
[GIN-debug] GET /customers/:id --> cfbi-api/identity/customer.(*CustomerAPI).FindByID-fm (3 handlers)
[GIN-debug] POST /customers --> cfbi-api/identity/customer.(*CustomerAPI).Create-fm (3 handlers)
[GIN-debug] PUT /customers/:id --> cfbi-api/identity/customer.(*CustomerAPI).Update-fm (3 handlers)
[GIN-debug] DELETE /customers/:id --> cfbi-api/identity/customer.(*CustomerAPI).Delete-fm (3 handlers)
[GIN-debug] GET /orders --> cfbi-api/dispatcher/order.(*OrderAPI).FindAll-fm (3 handlers)
[GIN-debug] GET /orders/:id --> cfbi-api/dispatcher/order.(*OrderAPI).FindByID-fm (3 handlers)
[GIN-debug] POST /orders --> cfbi-api/dispatcher/order.(*OrderAPI).Create-fm (3 handlers)
[GIN-debug] PUT /orders/:id --> cfbi-api/dispatcher/order.(*OrderAPI).Update-fm (3 handlers)
[GIN-debug] DELETE /orders/:id --> cfbi-api/dispatcher/order.(*OrderAPI).Delete-fm (3 handlers)
[GIN-debug] POST /orders/place --> cfbi-api/dispatcher/order.(*OrderAPI).Place.func1 (3 handlers)
[GIN-debug] GET /order_details --> cfbi-api/dispatcher/order_detail.(*Order_DetailAPI).FindAll-fm (3 handlers)
[GIN-debug] GET /order_details/:id --> cfbi-api/dispatcher/order_detail.(*Order_DetailAPI).FindByID-fm (3 handlers)
[GIN-debug] POST /order_details --> cfbi-api/dispatcher/order_detail.(*Order_DetailAPI).Create-fm (3 handlers)
[GIN-debug] PUT /order_details/:id --> cfbi-api/dispatcher/order_detail.(*Order_DetailAPI).Update-fm (3 handlers)
[GIN-debug] DELETE /order_details/:id --> cfbi-api/dispatcher/order_detail.(*Order_DetailAPI).Delete-fm (3 handlers)
[GIN-debug] GET /api/v2/config --> cfbi-api/config.Config (3 handlers)
[GIN-debug] GET /api/v1/categories --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/products/latest --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/products/details/ --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/banners --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/categories/products/ --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/config --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/order/track?order_id= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/message/get --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/message/send --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/auth/forgot-password --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/auth/verify-token --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/auth/reset-password --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/auth/verify-phone --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/auth/check-email --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/auth/register --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/cm-firebase-token --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/order/place --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/address/list --> cfbi-api/legacy.AddressList (3 handlers)
[GIN-debug] GET /api/v1/customer/address/delete?address_id= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/address/add --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/address/update/ --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/products/set-menu --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/info --> cfbi-api/legacy.CustomerInfo (3 handlers)
[GIN-debug] GET /api/v1/coupon/list --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/coupon/apply?code= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/order/list --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/order/payment-method --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/order/details?order_id= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/wish-list --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/wish-list/add?product_id= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/wish-list/remove?product_id= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/notifications --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/customer/update-profile --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/products/search?name= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/products/reviews/submit --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/delivery-man/last-location?order_id= --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /api/v1/delivery-man/reviews/submit --> cfbi-api/legacy.Pingpong (3 handlers)
[GIN-debug] GET /payment-test --> cfbi-api/payment.Payment (3 handlers)