Skip to content

Commit

Permalink
refactor(repository): create a gn4 provider
Browse files Browse the repository at this point in the history
which should be responsible of gathering all domain interface implementation for the gn4 strategy
  • Loading branch information
fgravin committed Nov 28, 2023
1 parent 8e46984 commit abe5f1b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import {
provideRepositoryUrl,
} from '@geonetwork-ui/api/repository'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { LOGIN_URL } from '@geonetwork-ui/api/repository/gn4'
import { LOGIN_URL, provideGn4 } from '@geonetwork-ui/api/repository/gn4'
import { RecordRelatedRecordsComponent } from './record/record-related-records/record-related-records.component'
import { RecordMetadataComponent } from './record/record-metadata/record-metadata.component'
import { RecordOtherlinksComponent } from './record/record-otherlinks/record-otherlinks.component'
Expand Down Expand Up @@ -148,6 +148,7 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
providers: [
importProvidersFrom(FeatureAuthModule),
provideRepositoryUrl(() => getGlobalConfig().GN4_API_URL),
provideGn4(),
{ provide: RouterService, useClass: DatahubRouterService },
{ provide: GN_UI_VERSION, useValue: environment.version },
{
Expand Down
14 changes: 14 additions & 0 deletions libs/api/repository/src/lib/gn4/gn4.provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Provider } from '@angular/core'
import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface'
import { Gn4PlatformService } from './platform/gn4-platform.service'
import { Gn4PlatformMapper } from './platform/gn4-platform.mapper'

export function provideGn4(): Provider[] {
return [
{
provide: PlatformServiceInterface,
useClass: Gn4PlatformService,
},
Gn4PlatformMapper,
]
}
1 change: 1 addition & 0 deletions libs/api/repository/src/lib/gn4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './settings/gn4-settings.service'
export * from './auth'
export * from './favorites/favorites.service'
export * from './selection/selection.service'
export * from './gn4.provider'

0 comments on commit abe5f1b

Please sign in to comment.