(installID uint)
| 661 | } |
| 662 | |
| 663 | func (a *AppInstallService) DeleteCheck(installID uint) ([]dto.AppResource, error) { |
| 664 | var res []dto.AppResource |
| 665 | appInstall, err := appInstallRepo.GetFirst(repo.WithByID(installID)) |
| 666 | if err != nil { |
| 667 | return nil, err |
| 668 | } |
| 669 | websites, _ := websiteRepo.GetBy(websiteRepo.WithAppInstallId(appInstall.ID)) |
| 670 | for _, website := range websites { |
| 671 | res = append(res, dto.AppResource{ |
| 672 | Type: "website", |
| 673 | Name: website.PrimaryDomain, |
| 674 | }) |
| 675 | } |
| 676 | resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithLinkId(appInstall.ID), repo.WithByFrom(constant.AppResourceLocal)) |
| 677 | for _, resource := range resources { |
| 678 | linkInstall, _ := appInstallRepo.GetFirst(repo.WithByID(resource.AppInstallId)) |
| 679 | if linkInstall.ID > 0 { |
| 680 | res = append(res, dto.AppResource{ |
| 681 | Type: "app", |
| 682 | Name: linkInstall.Name, |
| 683 | }) |
| 684 | } else { |
| 685 | _ = appInstallResourceRepo.DeleteBy(context.Background(), appInstallResourceRepo.WithAppInstallId(resource.AppInstallId)) |
| 686 | } |
| 687 | } |
| 688 | return res, nil |
| 689 | } |
| 690 | |
| 691 | func (a *AppInstallService) GetDefaultConfigByKey(key, name string) (string, error) { |
| 692 | baseInfo, err := appInstallRepo.LoadBaseInfo(key, name) |
nothing calls this directly
no test coverage detected