-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove features/ from domain/
- Loading branch information
Showing
24 changed files
with
218 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package hello | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"test/pkg/infrastructure" | ||
) | ||
|
||
type HelloRoute struct { | ||
router *infrastructure.Router | ||
controller *HelloController | ||
groupRouter *gin.RouterGroup | ||
} | ||
|
||
func NewHelloRoute(router *infrastructure.Router, controller *HelloController) *HelloRoute { | ||
route := HelloRoute{router: router, controller: controller} | ||
route.groupRouter = route.router.Group("api/hello") | ||
route.RegisterHelloRoutes() | ||
return &route | ||
} | ||
|
||
func (r *HelloRoute) RegisterHelloRoutes() { | ||
r.groupRouter.GET("", r.controller.HandleRoot) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package middlewares | ||
|
||
import "go.uber.org/fx" | ||
|
||
var Module = fx.Module("domain-middlewares", fx.Options()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package domain | ||
|
||
import ( | ||
"test/domain/hello" | ||
"test/domain/middlewares" | ||
|
||
"go.uber.org/fx" | ||
) | ||
|
||
var Module = fx.Options( | ||
middlewares.Module, | ||
hello.Module, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package user | ||
|
||
import ( | ||
"net/http" | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
type UserController struct { | ||
service *UserService | ||
} | ||
|
||
func NewUserController(service *UserService) *UserController { | ||
return &UserController{service: service} | ||
} | ||
|
||
func (ctrl *UserController) HandleRoot(c *gin.Context) { | ||
message := ctrl.service.GetMessage() | ||
c.JSON(http.StatusOK, gin.H{"message": message.Message}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package user | ||
|
||
type UserModel struct { | ||
Message string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package user | ||
|
||
import ( | ||
"go.uber.org/fx" | ||
) | ||
|
||
var Module = fx.Module("user", | ||
fx.Options( | ||
fx.Provide( | ||
NewUserService, | ||
NewUserController, | ||
NewUserRepository, | ||
), | ||
fx.Invoke(NewUserRoute), | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package user | ||
|
||
type UserRepository struct { | ||
} | ||
|
||
func NewUserRepository() *UserRepository { | ||
return &UserRepository{} | ||
} | ||
|
||
func (s *UserRepository) GetMessage() UserModel { | ||
return UserModel{Message: "Hello World"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package user | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/mukezhz/geng/pkg/infrastructure" | ||
) | ||
|
||
type UserRoute struct { | ||
router *infrastructure.Router | ||
controller *UserController | ||
groupRouter *gin.RouterGroup | ||
} | ||
|
||
func NewUserRoute(router *infrastructure.Router, controller *UserController) *UserRoute { | ||
route := UserRoute{router: router, controller: controller} | ||
route.groupRouter = router.Group("api/user") | ||
route.RegisterHelloRoutes() | ||
return &route | ||
} | ||
|
||
func (r *UserRoute) RegisterHelloRoutes() { | ||
r.groupRouter.GET("", r.controller.HandleRoot) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package user | ||
|
||
// UserService handles the business logic of the User module | ||
type UserService struct { | ||
// Add any dependencies here | ||
repo *UserRepository | ||
} | ||
|
||
// NewUserService creates a new instance of TestService | ||
func NewUserService(repo *UserRepository) *UserService { | ||
return &UserService{ | ||
repo: repo, | ||
} | ||
} | ||
|
||
// GetMessage returns a greeting message | ||
func (s *UserService) GetMessage() UserModel { | ||
return s.repo.GetMessage() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package hello | ||
|
||
import ( | ||
"net/http" | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
type HelloController struct { | ||
service *HelloService | ||
} | ||
|
||
func NewHelloController(service *HelloService) *HelloController { | ||
return &HelloController{service: service} | ||
} | ||
|
||
func (ctrl *HelloController) HandleRoot(c *gin.Context) { | ||
message := ctrl.service.GetMessage() | ||
c.JSON(http.StatusOK, gin.H{"message": message.Message}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package hello | ||
|
||
type HelloModel struct { | ||
Message string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package hello | ||
|
||
import ( | ||
"go.uber.org/fx" | ||
) | ||
|
||
var Module = fx.Module("hello", | ||
fx.Options( | ||
fx.Provide( | ||
NewHelloService, | ||
NewHelloController, | ||
NewHelloRepository, | ||
), | ||
fx.Invoke(NewHelloRoute), | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package hello | ||
|
||
type HelloRepository struct { | ||
} | ||
|
||
func NewHelloRepository() *HelloRepository { | ||
return &HelloRepository{} | ||
} | ||
|
||
func (s *HelloRepository) GetMessage() HelloModel { | ||
return HelloModel{Message: "Hello World"} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package hello | ||
|
||
// HelloService handles the business logic of the Hello module | ||
type HelloService struct { | ||
// Add any dependencies here | ||
repo *HelloRepository | ||
} | ||
|
||
// NewHelloService creates a new instance of TestService | ||
func NewHelloService(repo *HelloRepository) *HelloService { | ||
return &HelloService{ | ||
repo: repo, | ||
} | ||
} | ||
|
||
// GetMessage returns a greeting message | ||
func (s *HelloService) GetMessage() HelloModel { | ||
return s.repo.GetMessage() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package domain | ||
|
||
import ( | ||
"{{.ProjectModuleName}}/domain/features" | ||
"{{.ProjectModuleName}}/domain/hello" | ||
"{{.ProjectModuleName}}/domain/middlewares" | ||
|
||
"go.uber.org/fx" | ||
) | ||
|
||
var Module = fx.Options( | ||
middlewares.Module, | ||
features.Module, | ||
hello.Module, | ||
) |