remove interfaces

This commit is contained in:
yanghao05
2023-02-09 14:57:32 +08:00
parent 45400ae272
commit aceac5d8eb
16 changed files with 74 additions and 137 deletions

View File

@@ -9,11 +9,7 @@ import (
"github.com/gin-gonic/gin"
)
type UserController interface {
Login(*gin.Context, dto.LoginRequestForm) (*dto.LoginResponse, error)
}
type userControllerImpl struct {
type UserController struct {
conf *config.Config
user service.UserService
jwt *jwt.JWT
@@ -23,15 +19,15 @@ func NewUserController(
conf *config.Config,
user service.UserService,
jwt *jwt.JWT,
) UserController {
return &userControllerImpl{
) *UserController {
return &UserController{
conf: conf,
user: user,
jwt: jwt,
}
}
func (c *userControllerImpl) Login(ctx *gin.Context, req dto.LoginRequestForm) (*dto.LoginResponse, error) {
func (c *UserController) Login(ctx *gin.Context, req dto.LoginRequestForm) (*dto.LoginResponse, error) {
user, err := c.user.AuthMatchPassword(ctx, &req)
if err != nil {
return nil, err