GCW-SiTukang / controllers /connection_controller.go
Ryu2804
Deploy files from GitHub repository
f14a735
Raw
History Blame Contribute Delete
720 Bytes
package controllers
import (
"situkang/dto"
"situkang/services"
"situkang/utils"
"github.com/gin-gonic/gin"
)
type ConnectionController interface {
Connect(ctx *gin.Context)
}
type connectionController struct {
connectionService services.ConnectionService
}
func NewConnectionController(connectionService services.ConnectionService) ConnectionController {
return &connectionController{connectionService}
}
func (cc *connectionController) Connect(ctx *gin.Context) {
var req dto.ConnectRequest
if err := ctx.ShouldBindJSON(&req); err != nil {
utils.SendResponse[any, any](ctx, nil, nil, err)
return
}
err := cc.connectionService.Connect(ctx, req)
utils.SendResponse[any, any](ctx, nil, nil, err)
}