(ctx *gin.Context, serviceId string, name string)
| 72 | } |
| 73 | |
| 74 | func (i *imlStrategyController) FilterServiceRemote(ctx *gin.Context, serviceId string, name string) ([]*strategy_dto.Title, []any, int64, string, string, error) { |
| 75 | f, has := strategy_filter.RemoteFilter(name) |
| 76 | if !has { |
| 77 | return nil, nil, 0, "", "", fmt.Errorf("filter not found: %s", name) |
| 78 | } |
| 79 | scopeAllow := false |
| 80 | for _, s := range f.Scopes() { |
| 81 | if s == strategy_filter.ScopeService { |
| 82 | scopeAllow = true |
| 83 | break |
| 84 | } |
| 85 | } |
| 86 | if !scopeAllow { |
| 87 | return nil, nil, 0, "", "", fmt.Errorf("scope not allowed: %s", name) |
| 88 | } |
| 89 | list, total, err := f.RemoteList(ctx, "", map[string]interface{}{"service": serviceId}, -1, -1) |
| 90 | if err != nil { |
| 91 | return nil, nil, 0, "", "", err |
| 92 | } |
| 93 | return utils.SliceToSlice(f.Titles(), func(l strategy_filter.OptionTitle) *strategy_dto.Title { |
| 94 | return &strategy_dto.Title{ |
| 95 | Field: l.Field, |
| 96 | Title: l.Title, |
| 97 | } |
| 98 | }), list, total, f.Key(), "list", nil |
| 99 | |
| 100 | } |
| 101 | |
| 102 | func (i *imlStrategyController) filterOptions(ctx *gin.Context, scope string) ([]*strategy_dto.FilterOption, error) { |
| 103 | m, has := strategy_filter.Options(scope) |
nothing calls this directly
no test coverage detected