修改 Bootstrap 注入 Gateway Client 依赖到 IotCardHandler 和 DeviceHandler
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/internal/gateway"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
deviceService "github.com/break/junhong_cmp_fiber/internal/service/device"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
@@ -14,12 +15,14 @@ import (
|
||||
)
|
||||
|
||||
type DeviceHandler struct {
|
||||
service *deviceService.Service
|
||||
service *deviceService.Service
|
||||
gatewayClient *gateway.Client
|
||||
}
|
||||
|
||||
func NewDeviceHandler(service *deviceService.Service) *DeviceHandler {
|
||||
func NewDeviceHandler(service *deviceService.Service, gatewayClient *gateway.Client) *DeviceHandler {
|
||||
return &DeviceHandler{
|
||||
service: service,
|
||||
service: service,
|
||||
gatewayClient: gatewayClient,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package admin
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/internal/gateway"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
iotCardService "github.com/break/junhong_cmp_fiber/internal/service/iot_card"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
@@ -12,11 +13,15 @@ import (
|
||||
)
|
||||
|
||||
type IotCardHandler struct {
|
||||
service *iotCardService.Service
|
||||
service *iotCardService.Service
|
||||
gatewayClient *gateway.Client
|
||||
}
|
||||
|
||||
func NewIotCardHandler(service *iotCardService.Service) *IotCardHandler {
|
||||
return &IotCardHandler{service: service}
|
||||
func NewIotCardHandler(service *iotCardService.Service, gatewayClient *gateway.Client) *IotCardHandler {
|
||||
return &IotCardHandler{
|
||||
service: service,
|
||||
gatewayClient: gatewayClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *IotCardHandler) ListStandalone(c *fiber.Ctx) error {
|
||||
|
||||
Reference in New Issue
Block a user