SiLaju / controllers /connection_controller.go
RyZ
deploy: deploy on HF
d88b81b
raw
history blame contribute delete
756 Bytes
package controllers
import (
"dinacom-11.0-backend/dto"
"dinacom-11.0-backend/services"
"dinacom-11.0-backend/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)
}