From 61a8d362557c1787d534024ed2f14e999b785cc3 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Fri, 31 May 2024 03:55:56 -0700 Subject: [feature] Implement Filter API v2 (#2936) * Use correct entity name * We support server-side filters now * Document filter v1 methods that can throw a 409 * Validate v1 filter phrase as filter title * Always check v1 filter API status codes in tests * Document keyword minimum requirement on filter API v1 * Make it possible to specify filter keyword update columns per filter keyword * Implement v2 filter API * Fix lint and tests * Update Swagger spec * Fix filter update test * Update Swagger spec *correctly* * Update actual files Swagger spec was generated from * Remove keywords_attributes and statuses_attributes * Add test for serialization of empty filter * More helpful messages when object is owned by wrong account --- internal/db/filter.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal/db/filter.go') diff --git a/internal/db/filter.go b/internal/db/filter.go index 18943b4f9..eee61a99d 100644 --- a/internal/db/filter.go +++ b/internal/db/filter.go @@ -42,11 +42,13 @@ type Filter interface { // and deletes indicated filter keywords and statuses by ID. // It uses a transaction to ensure no partial updates. // The column lists are optional; if not specified, all columns will be updated. + // The filter keyword columns list is *per keyword*. + // To update all keyword columns, provide a list where every element is an empty list. UpdateFilter( ctx context.Context, filter *gtsmodel.Filter, filterColumns []string, - filterKeywordColumns []string, + filterKeywordColumns [][]string, deleteFilterKeywordIDs []string, deleteFilterStatusIDs []string, ) error -- cgit v1.2.3