(app model.App)
| 973 | } |
| 974 | |
| 975 | func checkLimit(app model.App) error { |
| 976 | if app.Limit > 0 { |
| 977 | installs, err := appInstallRepo.ListBy(context.Background(), appInstallRepo.WithAppId(app.ID)) |
| 978 | if err != nil { |
| 979 | return err |
| 980 | } |
| 981 | if len(installs) >= app.Limit { |
| 982 | return buserr.New("ErrAppLimit") |
| 983 | } |
| 984 | } |
| 985 | return nil |
| 986 | } |
| 987 | |
| 988 | func checkRequiredAndLimit(app model.App) error { |
| 989 | if err := checkLimit(app); err != nil { |
no test coverage detected