milelogistic-server/core/handlers/ttn/handlers.go

48 lines
844 B
Go
Raw Normal View History

2023-12-24 21:07:18 +03:00
package ttn
import (
"github.com/gin-gonic/gin"
)
type TTNHandlers struct{}
type TTNHandlersInterface interface {
CreateTTN(c *gin.Context)
TrackTTN(c *gin.Context)
}
type ResponseWrapper struct {
Status string `json:"status"`
Info string `json:"info"`
}
type CreateTTNOKResponse struct {
Response ResponseWrapper `json:"response"`
Data CreateTTNOkResponseData `json:"data"`
}
type CreateTTNOkResponseData struct {
Id string
}
func (h *TTNHandlers) CreateTTN(c *gin.Context) {
// TODO
c.JSON(200, &CreateTTNOKResponse{
Response: ResponseWrapper{
Status: "ok",
Info: "TTN has created successfully",
},
Data: CreateTTNOkResponseData{
Id: "123123",
},
})
}
func (h *TTNHandlers) TrackTTN(c *gin.Context) {
c.JSON(200, gin.H{
"status": "ok",
"info": "TTN has created successfully",
})
}