(id uint)
| 64 | } |
| 65 | |
| 66 | func (u *GroupService) Delete(id uint) error { |
| 67 | group, _ := groupRepo.Get(repo.WithByID(id)) |
| 68 | if group.ID == 0 { |
| 69 | return buserr.New("ErrRecordNotFound") |
| 70 | } |
| 71 | if group.IsDefault { |
| 72 | return buserr.New("ErrGroupIsDefault") |
| 73 | } |
| 74 | if group.Type == "website" { |
| 75 | websites, _ := websiteRepo.List(websiteRepo.WithGroupID(group.ID)) |
| 76 | if len(websites) > 0 { |
| 77 | return buserr.New("ErrGroupIsInWebsiteUse") |
| 78 | } |
| 79 | } |
| 80 | return groupRepo.Delete(repo.WithByID(id)) |
| 81 | } |
| 82 | |
| 83 | func (u *GroupService) Update(req dto.GroupUpdate) error { |
| 84 | if req.IsDefault { |
nothing calls this directly
no test coverage detected