diff --git a/apps/api/src/services/i18n/i18n.service.ts b/apps/api/src/services/i18n/i18n.service.ts index 834b0a65e1..93fd829bf3 100644 --- a/apps/api/src/services/i18n/i18n.service.ts +++ b/apps/api/src/services/i18n/i18n.service.ts @@ -29,7 +29,7 @@ export class I18nService implements OnModuleInit { return routerLink.map((link) => { const match = link.match(I18nService.TRANSLATION_TAGGED_MESSAGE_REGEX); - const segment = match + const segment = match?.groups ? this.getTranslation({ languageCode, id: match.groups.id diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts index fa96b1201c..354b4b3941 100644 --- a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts +++ b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts @@ -104,7 +104,11 @@ export class DataGatheringService { ); for (const assetProfile of Object.values(assetProfiles)) { - const { symbol } = assetProfile; + const { dataSource, symbol } = assetProfile; + + if (!dataSource || !symbol) { + continue; + } const symbolProfile = symbolProfiles.find( ({ symbol: symbolProfileSymbol }) => { @@ -145,7 +149,6 @@ export class DataGatheringService { countries, currency, cusip, - dataSource, figi, figiComposite, figiShareClass, @@ -161,19 +164,19 @@ export class DataGatheringService { create: { assetClass, assetSubClass, - countries, - currency, cusip, dataSource, figi, figiComposite, figiShareClass, - holdings, isin, name, - sectors, symbol, - url + url, + countries: countries ?? undefined, + currency: currency as string, + holdings: holdings ?? undefined, + sectors: sectors ?? undefined }, update: { assetClass, @@ -187,9 +190,11 @@ export class DataGatheringService { name, url, // Keep the stored data if no list is available - countries: isEmpty(countries) ? undefined : countries, - holdings: isEmpty(holdings) ? undefined : holdings, - sectors: isEmpty(sectors) ? undefined : sectors + countries: isEmpty(countries) + ? undefined + : (countries ?? undefined), + holdings: isEmpty(holdings) ? undefined : (holdings ?? undefined), + sectors: isEmpty(sectors) ? undefined : (sectors ?? undefined) }, where: { dataSource_symbol: { @@ -408,7 +413,7 @@ export class DataGatheringService { jobId: `${getAssetProfileIdentifier({ dataSource, symbol - })}-${format(date, DATE_FORMAT, { in: utc })}` + })}-${format(date as Date, DATE_FORMAT, { in: utc })}` } }; }) diff --git a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.mock.ts b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.mock.ts index 11b794dfc8..8d0ea87322 100644 --- a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.mock.ts +++ b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.mock.ts @@ -31,7 +31,9 @@ export const PortfolioSnapshotServiceMock = { } }; - PortfolioSnapshotServiceMock.jobsStore.set(opts?.jobId, mockJob); + if (opts?.jobId) { + PortfolioSnapshotServiceMock.jobsStore.set(opts.jobId, mockJob); + } return Promise.resolve(mockJob as Job); },