Skip to content

Commit

Permalink
better accountid mgmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-nettica committed Dec 17, 2023
1 parent 43fd90c commit 7c434ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/v1/device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func createDevice(c *gin.Context) {
data.CreatedBy = account.Email
data.UpdatedBy = account.Email

if data.AccountID == "" {
if !strings.HasPrefix(data.AccountID, "account-") {
data.AccountID = account.Parent
}

Expand Down
2 changes: 1 addition & 1 deletion core/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func UpdateDevice(Id string, device *model.Device, fUpdated bool) (*model.Device
if !fUpdated {
device.Updated = time.Now().UTC()
}
if device.AccountID == "" {
if !strings.HasPrefix(device.AccountID, "account-") {
device.AccountID = current.AccountID
}

Expand Down

0 comments on commit 7c434ef

Please sign in to comment.