Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions internal/controller/http/v1/devicemanagement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ func TestDeviceManagement(t *testing.T) {
Return(dto.Features{}, dtov2.Features{}, nil)
},
expectedCode: http.StatusOK,
response: map[string]interface{}{
"IDER": false,
"KVM": false,
"SOL": false,
"httpsBootSupported": false,
"kvmAvailable": false,
"localPBABootSupported": false,
"ocr": false,
"optInState": 0,
"redirection": false,
"remoteErase": false,
"userConsent": "",
"winREBootSupported": false,
response: dto.GetFeaturesResponse{
IDER: false,
KVM: false,
SOL: false,
HTTPSBootSupported: false,
KVMAvailable: false,
LocalPBABootSupported: false,
OCR: false,
OptInState: 0,
Redirection: false,
RemoteErase: false,
UserConsent: "",
WinREBootSupported: false,
},
},
{
Expand Down
28 changes: 14 additions & 14 deletions internal/controller/http/v1/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/gin-gonic/gin"

"github.com/device-management-toolkit/console/internal/entity/dto/v1"
dto "github.com/device-management-toolkit/console/internal/entity/dto/v1"
)

func (r *deviceManagementRoutes) getVersion(c *gin.Context) {
Expand Down Expand Up @@ -33,19 +33,19 @@ func (r *deviceManagementRoutes) getFeatures(c *gin.Context) {
return
}

v1Features := map[string]interface{}{
"redirection": features.Redirection,
"KVM": features.EnableKVM,
"SOL": features.EnableSOL,
"IDER": features.EnableIDER,
"optInState": features.OptInState,
"userConsent": features.UserConsent,
"kvmAvailable": features.KVMAvailable,
"ocr": features.OCR,
"httpsBootSupported": features.HTTPSBootSupported,
"winREBootSupported": features.WinREBootSupported,
"localPBABootSupported": features.LocalPBABootSupported,
"remoteErase": features.RemoteErase,
v1Features := dto.GetFeaturesResponse{
Redirection: features.Redirection,
KVM: features.EnableKVM,
SOL: features.EnableSOL,
IDER: features.EnableIDER,
OptInState: features.OptInState,
UserConsent: features.UserConsent,
KVMAvailable: features.KVMAvailable,
OCR: features.OCR,
HTTPSBootSupported: features.HTTPSBootSupported,
WinREBootSupported: features.WinREBootSupported,
LocalPBABootSupported: features.LocalPBABootSupported,
RemoteErase: features.RemoteErase,
}

c.JSON(http.StatusOK, v1Features)
Expand Down
16 changes: 16 additions & 0 deletions internal/entity/dto/v1/getfeatures.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dto

type GetFeaturesResponse struct {
Redirection bool `json:"redirection" binding:"required" example:"true"`
KVM bool `json:"KVM" binding:"required" example:"true"`
SOL bool `json:"SOL" binding:"required" example:"true"`
IDER bool `json:"IDER" binding:"required" example:"true"`
OptInState int `json:"optInState" binding:"required" example:"0"`
UserConsent string `json:"userConsent" binding:"required" example:"none"`
KVMAvailable bool `json:"kvmAvailable" binding:"required" example:"true"`
OCR bool `json:"ocr" binding:"required" example:"false"`
HTTPSBootSupported bool `json:"httpsBootSupported" binding:"required" example:"false"`
WinREBootSupported bool `json:"winREBootSupported" binding:"required" example:"false"`
LocalPBABootSupported bool `json:"localPBABootSupported" binding:"required" example:"false"`
RemoteErase bool `json:"remoteErase" binding:"required" example:"false"`
}
4 changes: 2 additions & 2 deletions internal/entity/dto/v1/powerstate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dto

type PowerState struct {
PowerState int `json:"powerstate" binding:"required" example:"0"`
OSPowerSavingState int `json:"osPowerSavingState" binding:"required" example:"0"`
PowerState int `json:"powerstate" example:"0"`
OSPowerSavingState int `json:"osPowerSavingState" example:"0"`
}
Loading