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
6 changes: 5 additions & 1 deletion internal/controller/httpapi/v1/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,9 @@ func amtErrorHandle(c *gin.Context, err devices.AMTError) {

func notUniqueErrorHandle(c *gin.Context, err sqldb.NotUniqueError) {
msg := err.Console.FriendlyMessage()
c.AbortWithStatusJSON(http.StatusBadRequest, response{Error: msg, Message: msg})
if msg == "" {
msg = "resource already exists"
}

c.AbortWithStatusJSON(http.StatusConflict, response{Error: msg, Message: msg})
}
6 changes: 6 additions & 0 deletions internal/usecase/profiles/usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,14 @@ func (uc *UseCase) BuildConfigurationObject(profileName string, data *entity.Pro
}
}

var tags []string
if data.Tags != "" {
tags = strings.Split(data.Tags, ",")
}

return config.Configuration{
Name: profileName,
Tags: tags,
Configuration: config.RemoteManagement{
GeneralSettings: config.GeneralSettings{
SharedFQDN: false,
Expand Down
2 changes: 2 additions & 0 deletions internal/usecase/profiles/usecase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ func TestBuildConfigurationObject(t *testing.T) {
name: "successful configuration build",
profile: &entity.Profile{
ProfileName: "test-profile",
Tags: "tag1,tag2,tag3",
DHCPEnabled: true,
IPSyncEnabled: true,
Activation: "acmactivate",
Expand All @@ -887,6 +888,7 @@ func TestBuildConfigurationObject(t *testing.T) {
},
expected: config.Configuration{
Name: "test-profile",
Tags: []string{"tag1", "tag2", "tag3"},
Configuration: config.RemoteManagement{
GeneralSettings: config.GeneralSettings{
SharedFQDN: false,
Expand Down
Loading