File size: 756 Bytes
d88b81b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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)
}
|