Skip to content

Commit 875289f

Browse files
committed
refactor(server-nestjs): migrate package managers to NestJS
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
1 parent 9e21f18 commit 875289f

18 files changed

Lines changed: 1969 additions & 0 deletions

apps/server-nestjs/src/cpin-module/infrastructure/health/health.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { HealthCheck, HealthCheckService } from '@nestjs/terminus'
33
import { ArgoCDHealthService } from '../../../modules/argocd/argocd-health.service'
44
import { GitlabHealthService } from '../../../modules/gitlab/gitlab-health.service'
55
import { KeycloakHealthService } from '../../../modules/keycloak/keycloak-health.service'
6+
import { NexusHealthService } from '../../../modules/nexus/nexus-health.service'
7+
import { RegistryHealthService } from '../../../modules/registry/registry-health.service'
68
import { VaultHealthService } from '../../../modules/vault/vault-health.service'
79
import { DatabaseHealthService } from '../database/database-health.service'
810

@@ -14,6 +16,8 @@ export class HealthController {
1416
@Inject(KeycloakHealthService) private readonly keycloak: KeycloakHealthService,
1517
@Inject(GitlabHealthService) private readonly gitlab: GitlabHealthService,
1618
@Inject(VaultHealthService) private readonly vault: VaultHealthService,
19+
@Inject(NexusHealthService) private readonly nexus: NexusHealthService,
20+
@Inject(RegistryHealthService) private readonly registry: RegistryHealthService,
1721
@Inject(ArgoCDHealthService) private readonly argocd: ArgoCDHealthService,
1822
) {}
1923

@@ -25,6 +29,8 @@ export class HealthController {
2529
() => this.keycloak.check('keycloak'),
2630
() => this.gitlab.check('gitlab'),
2731
() => this.vault.check('vault'),
32+
() => this.nexus.check('nexus'),
33+
() => this.registry.check('registry'),
2834
() => this.argocd.check('argocd'),
2935
])
3036
}

apps/server-nestjs/src/cpin-module/infrastructure/health/health.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { TerminusModule } from '@nestjs/terminus'
33
import { ArgoCDModule } from '../../../modules/argocd/argocd.module'
44
import { GitlabModule } from '../../../modules/gitlab/gitlab.module'
55
import { KeycloakModule } from '../../../modules/keycloak/keycloak.module'
6+
import { NexusModule } from '../../../modules/nexus/nexus.module'
7+
import { RegistryModule } from '../../../modules/registry/registry.module'
68
import { VaultModule } from '../../../modules/vault/vault.module'
79
import { DatabaseHealthService } from '../database/database-health.service'
810
import { HealthController } from './health.controller'
@@ -14,6 +16,8 @@ import { HealthController } from './health.controller'
1416
KeycloakModule,
1517
GitlabModule,
1618
VaultModule,
19+
NexusModule,
20+
RegistryModule,
1721
ArgoCDModule,
1822
],
1923
controllers: [HealthController],
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { TestingModule } from '@nestjs/testing'
2+
import { Test } from '@nestjs/testing'
3+
import { beforeEach, describe, expect, it } from 'vitest'
4+
import { ConfigurationService } from '../../cpin-module/infrastructure/configuration/configuration.service'
5+
import { NexusClientService } from './nexus-client.service'
6+
7+
function createNexusServiceTestingModule() {
8+
return Test.createTestingModule({
9+
providers: [
10+
NexusClientService,
11+
{
12+
provide: ConfigurationService,
13+
useValue: {
14+
nexusSecretExposedUrl: 'https://nexus.example',
15+
projectRootPath: 'forge',
16+
} satisfies Partial<ConfigurationService>,
17+
},
18+
],
19+
})
20+
}
21+
22+
describe('nexusClientService', () => {
23+
let service: NexusClientService
24+
25+
beforeEach(async () => {
26+
const module: TestingModule = await createNexusServiceTestingModule().compile()
27+
service = module.get(NexusClientService)
28+
})
29+
30+
it('should be defined', () => {
31+
expect(service).toBeDefined()
32+
})
33+
})

0 commit comments

Comments
 (0)