From c0f22bae43c95932e85f8829357a7488f0df16c3 Mon Sep 17 00:00:00 2001 From: Corey Gaspard Date: Wed, 2 Oct 2024 19:49:09 -0500 Subject: [PATCH] feat: better handling of organization.AccountItems on init_data import (#3263) * Better handling of accountitems on init_data import. * Removed commented code. * Update init_data.go * Update init_data.go --------- Co-authored-by: Yang Luo --- object/init_data.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/object/init_data.go b/object/init_data.go index a7d4004a..3cf1111d 100644 --- a/object/init_data.go +++ b/object/init_data.go @@ -182,6 +182,9 @@ func readInitDataFromFile(filePath string) (*InitData, error) { if organization.Tags == nil { organization.Tags = []string{} } + if organization.AccountItems == nil { + organization.AccountItems = []*AccountItem{} + } } for _, application := range data.Applications { if application.Providers == nil { @@ -275,7 +278,9 @@ func initDefinedOrganization(organization *Organization) { } } organization.CreatedTime = util.GetCurrentTime() - organization.AccountItems = getBuiltInAccountItems() + if len(organization.AccountItems) == 0 { + organization.AccountItems = getBuiltInAccountItems() + } _, err = AddOrganization(organization) if err != nil {