feat: add purchase domain structure

This commit is contained in:
Sahar Mokarrami 2026-03-21 23:35:39 +03:30
parent b9db2926c1
commit e72b78701a
17 changed files with 98 additions and 0 deletions

1
purchaseapp/app.go Normal file
View File

@ -0,0 +1 @@
package purchaseapp

4
purchaseapp/config.go Normal file
View File

@ -0,0 +1,4 @@
package purchaseapp
type Config struct {
}

View File

@ -0,0 +1,10 @@
package http
import (
"github.com/labstack/echo/v4"
"net/http"
)
func (s Server) healthCheck(c echo.Context) error {
return c.JSON(http.StatusOK, "everything is good!")
}

View File

@ -0,0 +1,8 @@
package invoice
type Handler struct {
}
func New() *Handler {
return &Handler{}
}

View File

@ -0,0 +1,7 @@
package invoice
import "github.com/labstack/echo/v4"
func (h Handler) SetRoutes(e *echo.Echo) {
}

View File

@ -0,0 +1,7 @@
package order
type Handler struct{}
func New() *Handler {
return &Handler{}
}

View File

@ -0,0 +1,7 @@
package order
import "github.com/labstack/echo/v4"
func (h Handler) SetRoutes(e *echo.Echo) {
}

View File

@ -0,0 +1,33 @@
package http
import (
httpserver "git.gocasts.ir/ebhomengo/niki/delivery/http_server"
"git.gocasts.ir/ebhomengo/niki/purchaseapp/delivery/http/invoice"
"git.gocasts.ir/ebhomengo/niki/purchaseapp/delivery/http/order"
)
type Server struct {
HTTPServer *httpserver.Server
OrderHandler *order.Handler
InvoiceHandler *invoice.Handler
}
func New(httpserver *httpserver.Server) *Server {
return &Server{
HTTPServer: httpserver,
OrderHandler: order.New(),
InvoiceHandler: invoice.New(),
}
}
func (s *Server) Serve() {
s.RegisterRoutes()
}
func (s *Server) Stop() {}
func (s *Server) RegisterRoutes() {
s.HTTPServer.Router.GET("/purchase/health-check", s.healthCheck)
s.OrderHandler.SetRoutes(s.HTTPServer.Router)
s.InvoiceHandler.SetRoutes(s.HTTPServer.Router)
}

View File

@ -0,0 +1,4 @@
package entity
type Invoice struct {
}

View File

@ -0,0 +1,4 @@
package entity
type Order struct {
}

View File

@ -0,0 +1 @@
package mysql

View File

@ -0,0 +1 @@
package invoice

View File

@ -0,0 +1,4 @@
package invoice
type Service struct {
}

View File

@ -0,0 +1 @@
package invoice

View File

@ -0,0 +1 @@
package order

View File

@ -0,0 +1,4 @@
package order
type Service struct {
}

View File

@ -0,0 +1 @@
package order