From 057a8ae215e162347a3e754b26baf465e3e3087f Mon Sep 17 00:00:00 2001
From: Martin Lowe <martin.lowe@eclipse-foundation.org>
Date: Tue, 27 May 2025 13:38:12 -0400
Subject: [PATCH] fix: Remove type filter from relations that breaks prod use
 case

In production, the WGCR relation is in a different group than the other
relations. As we already filter out the unneeded data, we're safe to
just remove the filter, as the relations data isn't a large data set.
This happened due to a bug fix that revealed the weirdness between the
relations
---
 .../java/org/eclipsefoundation/wg/api/FoundationDbAPI.java    | 3 +--
 .../wg/services/impl/DefaultWorkingGroupsService.java         | 2 +-
 .../eclipsefoundation/wg/test/api/MockFoundationDbAPI.java    | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/eclipsefoundation/wg/api/FoundationDbAPI.java b/src/main/java/org/eclipsefoundation/wg/api/FoundationDbAPI.java
index 9f24239..eb4c4cd 100644
--- a/src/main/java/org/eclipsefoundation/wg/api/FoundationDbAPI.java
+++ b/src/main/java/org/eclipsefoundation/wg/api/FoundationDbAPI.java
@@ -39,13 +39,12 @@ public interface FoundationDbAPI {
    * Fetches all system relations filtered by the given type.
    * 
    * @param baseParams Base request paramters used for pagination.
-   * @param type The given relation type filter.
    * @return A Response containing the filtered relations
    */
   @GET
   @Compressed
   @Path("/sys/relations")
-  RestResponse<List<SysRelationData>> getRelations(@BeanParam BaseAPIParameters baseParams, @QueryParam("type") String type);
+  RestResponse<List<SysRelationData>> getRelations(@BeanParam BaseAPIParameters baseParams);
 
   /**
    * Fetches all Full org contacts containing Person, Org, and SysRelation entities. Filtered by document ids.
diff --git a/src/main/java/org/eclipsefoundation/wg/services/impl/DefaultWorkingGroupsService.java b/src/main/java/org/eclipsefoundation/wg/services/impl/DefaultWorkingGroupsService.java
index babf27a..63113a9 100644
--- a/src/main/java/org/eclipsefoundation/wg/services/impl/DefaultWorkingGroupsService.java
+++ b/src/main/java/org/eclipsefoundation/wg/services/impl/DefaultWorkingGroupsService.java
@@ -276,7 +276,7 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
     Optional<List<SysRelationData>> relations = cache
         .get(relationType, new MultivaluedHashMap<>(), SysRelationData.class,
             () -> middleware
-                .getAll(params -> fdbAPI.getRelations(params, relationType))
+                .getAll(params -> fdbAPI.getRelations(params))
                 .stream()
                 .filter(relation -> WorkingGroupsHelper.filterRelationsByPrefix(relation.relation(), groupPrefix))
                 .toList())
diff --git a/src/test/java/org/eclipsefoundation/wg/test/api/MockFoundationDbAPI.java b/src/test/java/org/eclipsefoundation/wg/test/api/MockFoundationDbAPI.java
index e6bf31c..4bd3010 100644
--- a/src/test/java/org/eclipsefoundation/wg/test/api/MockFoundationDbAPI.java
+++ b/src/test/java/org/eclipsefoundation/wg/test/api/MockFoundationDbAPI.java
@@ -79,8 +79,8 @@ public class MockFoundationDbAPI implements FoundationDbAPI {
   }
 
   @Override
-  public RestResponse<List<SysRelationData>> getRelations(BaseAPIParameters baseParams, String type) {
-    return MockDataPaginationHandler.paginateData(baseParams, relations.stream().filter(r -> r.type().equalsIgnoreCase(type)).toList());
+  public RestResponse<List<SysRelationData>> getRelations(BaseAPIParameters baseParams) {
+    return MockDataPaginationHandler.paginateData(baseParams, relations);
   }
 
   @Override
-- 
GitLab