Skip to content

Commit

Permalink
CID-2744: add nodeId for organisations
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedlajmileanix committed Jul 22, 2024
1 parent 8e1be09 commit dfe956f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.leanix.githubagent.dto

class OrganizationDto(
val id: Int,
val nodeId: String,
val name: String,
val installed: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dfe956f

Please sign in to comment.