Filter trust center subprocessors server-side
Subprocessor filtering for the compliance portal happens in the backend rather than the client. Add a SubprocessorFilter (query, category, country) to the trust API's subprocessors connection, thread it through the resolver and service, and extend the coredata ThirdParty filter with category equality and country array membership. The connection stores the filter so totalCount reflects the filtered set. Add e2e coverage for the new filtering. On the frontend, convert the page to a refetchable fragment whose filter arguments are driven by URL-persisted, debounced toolbar state (category and region selects plus a search field), populate the dropdowns from an unfiltered facet selection, and offer to clear filters from the empty state. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -23,14 +23,24 @@ type (
|
||||
showOnTrustCenter *bool
|
||||
level *int
|
||||
query *string
|
||||
category *ThirdPartyCategory
|
||||
country *CountryCode
|
||||
}
|
||||
)
|
||||
|
||||
func NewThirdPartyFilter(showOnTrustCenter *bool, level *int, query *string) *ThirdPartyFilter {
|
||||
func NewThirdPartyFilter(
|
||||
showOnTrustCenter *bool,
|
||||
level *int,
|
||||
query *string,
|
||||
category *ThirdPartyCategory,
|
||||
country *CountryCode,
|
||||
) *ThirdPartyFilter {
|
||||
return &ThirdPartyFilter{
|
||||
showOnTrustCenter: showOnTrustCenter,
|
||||
level: level,
|
||||
query: query,
|
||||
category: category,
|
||||
country: country,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +49,8 @@ func (f *ThirdPartyFilter) SQLArguments() pgx.StrictNamedArgs {
|
||||
"show_on_trust_center": nil,
|
||||
"filter_query": nil,
|
||||
"level": nil,
|
||||
"filter_category": nil,
|
||||
"filter_country": nil,
|
||||
}
|
||||
|
||||
if f.showOnTrustCenter != nil {
|
||||
@@ -53,6 +65,14 @@ func (f *ThirdPartyFilter) SQLArguments() pgx.StrictNamedArgs {
|
||||
args["level"] = *f.level
|
||||
}
|
||||
|
||||
if f.category != nil {
|
||||
args["filter_category"] = string(*f.category)
|
||||
}
|
||||
|
||||
if f.country != nil {
|
||||
args["filter_country"] = string(*f.country)
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
@@ -74,5 +94,15 @@ func (f *ThirdPartyFilter) SQLFragment() string {
|
||||
name ILIKE '%' || @filter_query || '%'
|
||||
ELSE TRUE
|
||||
END
|
||||
AND CASE
|
||||
WHEN @filter_category::text IS NOT NULL THEN
|
||||
category = @filter_category::third_party_category
|
||||
ELSE TRUE
|
||||
END
|
||||
AND CASE
|
||||
WHEN @filter_country::text IS NOT NULL THEN
|
||||
@filter_country::country_code = ANY(countries)
|
||||
ELSE TRUE
|
||||
END
|
||||
)`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user