-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(search-indexer): Move mapping logic to separate class (#16410)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f560cd2
commit 4a0a50a
Showing
4 changed files
with
128 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { Injectable } from '@nestjs/common' | ||
|
||
import { ArticleSyncService } from './importers/article.service' | ||
import { SubArticleSyncService } from './importers/subArticle.service' | ||
import { AnchorPageSyncService } from './importers/anchorPage.service' | ||
import { LifeEventPageSyncService } from './importers/lifeEventPage.service' | ||
import { ArticleCategorySyncService } from './importers/articleCategory.service' | ||
import { NewsSyncService } from './importers/news.service' | ||
import { AdgerdirPageSyncService } from './importers/adgerdirPage' | ||
import { MenuSyncService } from './importers/menu.service' | ||
import { GroupedMenuSyncService } from './importers/groupedMenu.service' | ||
import { OrganizationPageSyncService } from './importers/organizationPage.service' | ||
import { OrganizationSubpageSyncService } from './importers/organizationSubpage.service' | ||
import { FrontpageSyncService } from './importers/frontpage.service' | ||
import { SupportQNASyncService } from './importers/supportQNA.service' | ||
import { LinkSyncService } from './importers/link.service' | ||
import { ProjectPageSyncService } from './importers/projectPage.service' | ||
import { EnhancedAssetSyncService } from './importers/enhancedAsset.service' | ||
import { VacancySyncService } from './importers/vacancy.service' | ||
import { ServiceWebPageSyncService } from './importers/serviceWebPage.service' | ||
import { EventSyncService } from './importers/event.service' | ||
import { ManualSyncService } from './importers/manual.service' | ||
import { ManualChapterItemSyncService } from './importers/manualChapterItem.service' | ||
import { CustomPageSyncService } from './importers/customPage.service' | ||
import { GenericListItemSyncService } from './importers/genericListItem.service' | ||
import { TeamListSyncService } from './importers/teamList.service' | ||
import type { CmsSyncProvider, processSyncDataInput } from './cmsSync.service' | ||
|
||
@Injectable() | ||
export class MappingService { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
private contentSyncProviders: CmsSyncProvider<any>[] | ||
constructor( | ||
private readonly newsSyncService: NewsSyncService, | ||
private readonly articleCategorySyncService: ArticleCategorySyncService, | ||
private readonly articleSyncService: ArticleSyncService, | ||
private readonly subArticleSyncService: SubArticleSyncService, | ||
private readonly anchorPageSyncService: AnchorPageSyncService, | ||
private readonly lifeEventPageSyncService: LifeEventPageSyncService, | ||
private readonly adgerdirPageSyncService: AdgerdirPageSyncService, | ||
private readonly menuSyncService: MenuSyncService, | ||
private readonly groupedMenuSyncService: GroupedMenuSyncService, | ||
private readonly organizationPageSyncService: OrganizationPageSyncService, | ||
private readonly organizationSubpageSyncService: OrganizationSubpageSyncService, | ||
private readonly projectPageSyncService: ProjectPageSyncService, | ||
private readonly frontpageSyncService: FrontpageSyncService, | ||
private readonly supportQNASyncService: SupportQNASyncService, | ||
private readonly linkSyncService: LinkSyncService, | ||
private readonly enhancedAssetService: EnhancedAssetSyncService, | ||
private readonly vacancyService: VacancySyncService, | ||
private readonly serviceWebPageSyncService: ServiceWebPageSyncService, | ||
private readonly eventSyncService: EventSyncService, | ||
private readonly manualSyncService: ManualSyncService, | ||
private readonly manualChapterItemSyncService: ManualChapterItemSyncService, | ||
private readonly customPageSyncService: CustomPageSyncService, | ||
private readonly genericListItemSyncService: GenericListItemSyncService, | ||
private readonly teamListSyncService: TeamListSyncService, | ||
) { | ||
this.contentSyncProviders = [ | ||
this.articleSyncService, | ||
this.subArticleSyncService, | ||
this.anchorPageSyncService, | ||
this.lifeEventPageSyncService, | ||
this.articleCategorySyncService, | ||
this.newsSyncService, | ||
this.adgerdirPageSyncService, | ||
this.menuSyncService, | ||
this.groupedMenuSyncService, | ||
this.organizationPageSyncService, | ||
this.organizationSubpageSyncService, | ||
this.projectPageSyncService, | ||
this.frontpageSyncService, | ||
this.supportQNASyncService, | ||
this.linkSyncService, | ||
this.enhancedAssetService, | ||
this.vacancyService, | ||
this.serviceWebPageSyncService, | ||
this.eventSyncService, | ||
this.manualSyncService, | ||
this.manualChapterItemSyncService, | ||
this.customPageSyncService, | ||
this.genericListItemSyncService, | ||
this.teamListSyncService, | ||
] | ||
} | ||
|
||
mapData(entries: processSyncDataInput<unknown>) { | ||
return this.contentSyncProviders.map((contentSyncProvider) => { | ||
const data = contentSyncProvider.processSyncData(entries) | ||
return contentSyncProvider.doMapping(data) | ||
}) | ||
} | ||
} |