diff --git a/src/main/java/io/moderne/organizations/DgsConstants.java b/src/main/java/io/moderne/organizations/DgsConstants.java index 8b1c7d8..87fb4a6 100644 --- a/src/main/java/io/moderne/organizations/DgsConstants.java +++ b/src/main/java/io/moderne/organizations/DgsConstants.java @@ -14,8 +14,6 @@ public static class QUERY { public static class ORGANIZATIONS_INPUT_ARGUMENT { public static final String Repository = "repository"; - - public static final String Weight = "weight"; } public static class USERORGANIZATIONS_INPUT_ARGUMENT { diff --git a/src/main/java/io/moderne/organizations/OrganizationDataFetcher.java b/src/main/java/io/moderne/organizations/OrganizationDataFetcher.java index e753f8f..cc70859 100644 --- a/src/main/java/io/moderne/organizations/OrganizationDataFetcher.java +++ b/src/main/java/io/moderne/organizations/OrganizationDataFetcher.java @@ -10,7 +10,6 @@ import io.moderne.organizations.types.RepositoryInput; import io.moderne.organizations.types.User; import org.openrewrite.internal.StringUtils; -import org.openrewrite.internal.lang.Nullable; import reactor.core.publisher.Flux; import java.io.IOException; @@ -36,11 +35,10 @@ public OrganizationDataFetcher(ObjectMapper mapper) throws IOException { } @DgsQuery - Flux organizations(@InputArgument RepositoryInput repository, - @InputArgument @Nullable Integer weight) { + Flux organizations(@InputArgument RepositoryInput repository) { return Flux.fromIterable(ownership) .concatWith(Flux.fromIterable(ownershipJonathanLeitschuh)) - .filter(org -> org.matches(repository) && (org.maxWeight() == null || weight == null || org.maxWeight() >= weight)) + .filter(org -> org.matches(repository)) .map(OrganizationDataFetcher::mapOrganization) .concatWithValues(Organization.newBuilder().id("ALL").name("ALL").commitOptions(List.of(CommitOption.values())).build()); // if you want an "ALL" group } diff --git a/src/main/java/io/moderne/organizations/OrganizationRepositories.java b/src/main/java/io/moderne/organizations/OrganizationRepositories.java index 71f36e8..6ee303a 100644 --- a/src/main/java/io/moderne/organizations/OrganizationRepositories.java +++ b/src/main/java/io/moderne/organizations/OrganizationRepositories.java @@ -10,9 +10,7 @@ * @param name The name of the organization * @param repositories The set of repositories that this organization owns. */ -public record OrganizationRepositories(String name, - @Nullable Long maxWeight, - List repositories, +public record OrganizationRepositories(String name, List repositories, @Nullable List commitOptions) { boolean matches(RepositoryInput toMatchRepositoryInput) { diff --git a/src/main/resources/ownership.json b/src/main/resources/ownership.json index fc14e6c..3836b96 100644 --- a/src/main/resources/ownership.json +++ b/src/main/resources/ownership.json @@ -1,7 +1,6 @@ [ { "name": "Default", - "maxWeight": 700000, "repositories": [ { "origin": "github.com", diff --git a/src/main/resources/schema/moderne-organizations.graphqls b/src/main/resources/schema/moderne-organizations.graphqls index 41df7a0..ae4b94a 100644 --- a/src/main/resources/schema/moderne-organizations.graphqls +++ b/src/main/resources/schema/moderne-organizations.graphqls @@ -1,12 +1,8 @@ type Query { """ The list of organizations that a repository belongs to. - - Weight is nullable only temporarily for backwards compatibility. When it becomes non-nullable, - it may or may not be used to determine organization ownership, but will always be available for that - purpose. """ - organizations(repository: RepositoryInput!, weight: Int): [Organization!]! + organizations(repository: RepositoryInput!): [Organization!]! """ The list of organizations that a user belongs to. If it is possible to diff --git a/src/test/java/io/moderne/organizations/OrganizationDataFetcherTest.java b/src/test/java/io/moderne/organizations/OrganizationDataFetcherTest.java index c57a7bf..a54bce3 100644 --- a/src/test/java/io/moderne/organizations/OrganizationDataFetcherTest.java +++ b/src/test/java/io/moderne/organizations/OrganizationDataFetcherTest.java @@ -20,12 +20,7 @@ public class OrganizationDataFetcherTest { @Test void organizationForThisRepository() { StepVerifier - .create( - organizationDataFetcher.organizations( - new RepositoryInput("moderneinc/moderne-organizations", "github.com", "main"), - 10000 - ) - ) + .create(organizationDataFetcher.organizations(new RepositoryInput("moderneinc/moderne-organizations", "github.com", "main"))) .expectNext( Organization.newBuilder() .id("Moderne")