diff --git a/src/main/kotlin/net/leanix/githubagent/dto/GitHubResponsesDto.kt b/src/main/kotlin/net/leanix/githubagent/dto/GitHubResponsesDto.kt index 8196e70..31903c3 100644 --- a/src/main/kotlin/net/leanix/githubagent/dto/GitHubResponsesDto.kt +++ b/src/main/kotlin/net/leanix/githubagent/dto/GitHubResponsesDto.kt @@ -26,6 +26,7 @@ data class Account( data class Organization( @JsonProperty("login") val login: String, @JsonProperty("id") val id: Int, + @JsonProperty("node_id") val nodeId: String, ) @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/src/main/kotlin/net/leanix/githubagent/dto/OrganizationDto.kt b/src/main/kotlin/net/leanix/githubagent/dto/OrganizationDto.kt index 4702a06..cb4b653 100644 --- a/src/main/kotlin/net/leanix/githubagent/dto/OrganizationDto.kt +++ b/src/main/kotlin/net/leanix/githubagent/dto/OrganizationDto.kt @@ -2,6 +2,7 @@ package net.leanix.githubagent.dto class OrganizationDto( val id: Int, + val nodeId: String, val name: String, val installed: Boolean ) diff --git a/src/main/kotlin/net/leanix/githubagent/services/GitHubScanningService.kt b/src/main/kotlin/net/leanix/githubagent/services/GitHubScanningService.kt index 6321e7b..2f86686 100644 --- a/src/main/kotlin/net/leanix/githubagent/services/GitHubScanningService.kt +++ b/src/main/kotlin/net/leanix/githubagent/services/GitHubScanningService.kt @@ -55,9 +55,9 @@ class GitHubScanningService( val organizations = gitHubClient.getOrganizations("Bearer $installationToken") .map { organization -> if (installations.find { it.account.login == organization.login } != null) { - OrganizationDto(organization.id, organization.login, true) + OrganizationDto(organization.id, organization.nodeId, organization.login, true) } else { - OrganizationDto(organization.id, organization.login, false) + OrganizationDto(organization.id, organization.nodeId, organization.login, false) } } webSocketService.sendMessage("/app/ghe/organizations", organizations) diff --git a/src/test/kotlin/net/leanix/githubagent/services/GitHubScanningServiceTest.kt b/src/test/kotlin/net/leanix/githubagent/services/GitHubScanningServiceTest.kt index 0391ee5..7f8751e 100644 --- a/src/test/kotlin/net/leanix/githubagent/services/GitHubScanningServiceTest.kt +++ b/src/test/kotlin/net/leanix/githubagent/services/GitHubScanningServiceTest.kt @@ -36,7 +36,7 @@ class GitHubScanningServiceTest { every { gitHubClient.createInstallationToken(1, any()) } returns InstallationTokenResponse("testToken", "2024-01-01T00:00:00Z", mapOf(), "all") every { cachingService.set(any(), any(), any()) } returns Unit - every { gitHubClient.getOrganizations(any()) } returns listOf(Organization("testOrganization", 1)) + every { gitHubClient.getOrganizations(any()) } returns listOf(Organization("testOrganization", 1, "testNodeId")) every { gitHubGraphQLService.getRepositories(any(), any()) } returns PagedRepositories( repositories = emptyList(), hasNextPage = false,