()
| 930 | } |
| 931 | |
| 932 | func deleteCustomApp() { |
| 933 | installs, err := appInstallRepo.ListBy(context.Background()) |
| 934 | if err != nil { |
| 935 | global.LOG.Errorf("[AppStore] deleteCustomApp: failed to list installs, skipping: %v", err) |
| 936 | return |
| 937 | } |
| 938 | var appIDS []uint |
| 939 | for _, install := range installs { |
| 940 | appIDS = append(appIDS, install.AppId) |
| 941 | } |
| 942 | var ops []repo.DBOption |
| 943 | if len(appIDS) > 0 { |
| 944 | ops = append(ops, repo.WithByIDNotIn(appIDS)) |
| 945 | } |
| 946 | apps, err := appRepo.GetBy(ops...) |
| 947 | if err != nil { |
| 948 | global.LOG.Errorf("[AppStore] deleteCustomApp: failed to get apps, skipping: %v", err) |
| 949 | return |
| 950 | } |
| 951 | var deleteIDS []uint |
| 952 | for _, app := range apps { |
| 953 | if app.Resource == constant.AppResourceCustom { |
| 954 | deleteIDS = append(deleteIDS, app.ID) |
| 955 | } |
| 956 | } |
| 957 | if len(deleteIDS) == 0 { |
| 958 | return |
| 959 | } |
| 960 | if err = appRepo.DeleteByIDs(context.Background(), deleteIDS); err != nil { |
| 961 | global.LOG.Errorf("[AppStore] deleteCustomApp: failed to delete apps: %v", err) |
| 962 | } |
| 963 | if err = appDetailRepo.DeleteByAppIds(context.Background(), deleteIDS); err != nil { |
| 964 | global.LOG.Errorf("[AppStore] deleteCustomApp: failed to delete app details: %v", err) |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | func (a AppService) SyncAppListFromRemote(taskID string) (err error) { |
| 969 | if xpack.MultiNodeProvider.IsUseCustomApp() { |
no test coverage detected