fix(region): auto set provider project id when change account project info (#19433)

This commit is contained in:
屈轩
2024-02-04 11:49:59 +08:00
committed by GitHub
parent b2de0282f6
commit 1456f31d45
+9 -1
View File
@@ -3155,8 +3155,16 @@ func (account *SCloudaccount) PerformProjectMapping(ctx context.Context, userCre
input.ProjectId = t.Id
}
if len(input.ProjectId) > 0 {
changeOwnerInput := apis.PerformChangeProjectOwnerInput{}
changeOwnerInput.ProjectId = input.ProjectId
_, err := account.PerformChangeProject(ctx, userCred, query, changeOwnerInput)
if err != nil {
return nil, errors.Wrapf(err, "PerformChangeProject")
}
}
_, err := db.Update(account, func() error {
account.ProjectId = input.ProjectId
account.AutoCreateProject = input.AutoCreateProject
account.AutoCreateProjectForProvider = input.AutoCreateProjectForProvider
account.ProjectMappingId = input.ProjectMappingId