Browse Source

Address PR #5670 review feedback

pull/5670/head
Sven Günther 1 month ago
committed by Thomas Kaul
parent
commit
c8afec7319
  1. 1
      CHANGELOG.md
  2. 16
      apps/api/src/app/import/import.service.ts

1
CHANGELOG.md

@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed an issue where importing custom asset profiles failed due to validation errors
- Handled an exception in the get asset profile functionality of the _Financial Modeling Prep_ service - Handled an exception in the get asset profile functionality of the _Financial Modeling Prep_ service
- Added the missing `CommonModule` import in the import activities dialog - Added the missing `CommonModule` import in the import activities dialog

16
apps/api/src/app/import/import.service.ts

@ -373,7 +373,7 @@ export class ImportService {
const assetProfiles = await this.validateActivities({ const assetProfiles = await this.validateActivities({
activitiesDto, activitiesDto,
assetProfilesWithMarketDataDto, assetProfileWithMarketDataDto: assetProfilesWithMarketDataDto,
maxActivitiesToImport, maxActivitiesToImport,
user user
}); });
@ -699,12 +699,12 @@ export class ImportService {
private async validateActivities({ private async validateActivities({
activitiesDto, activitiesDto,
assetProfilesWithMarketDataDto, assetProfileWithMarketDataDto,
maxActivitiesToImport, maxActivitiesToImport,
user user
}: { }: {
activitiesDto: Partial<CreateOrderDto>[]; activitiesDto: Partial<CreateOrderDto>[];
assetProfilesWithMarketDataDto: ImportDataDto['assetProfiles']; assetProfileWithMarketDataDto: ImportDataDto['assetProfiles'];
maxActivitiesToImport: number; maxActivitiesToImport: number;
user: UserWithSettings; user: UserWithSettings;
}) { }) {
@ -753,18 +753,20 @@ export class ImportService {
}; };
if (!assetProfile?.name) { if (!assetProfile?.name) {
const assetProfileInImport = assetProfilesWithMarketDataDto?.find( const assetProfileInImport = assetProfileWithMarketDataDto?.find(
(profile) => (profile) => {
profile.dataSource === dataSource && profile.symbol === symbol return profile.dataSource === dataSource && profile.symbol === symbol;
}
); );
if (assetProfileInImport) { if (assetProfileInImport) {
// Merge all fields of custom asset profiles into the validation object
Object.assign(assetProfile, { Object.assign(assetProfile, {
assetClass: assetProfileInImport.assetClass, assetClass: assetProfileInImport.assetClass,
assetSubClass: assetProfileInImport.assetSubClass, assetSubClass: assetProfileInImport.assetSubClass,
comment: assetProfileInImport.comment, comment: assetProfileInImport.comment,
countries: assetProfileInImport.countries, countries: assetProfileInImport.countries,
currency: assetProfileInImport.currency ?? assetProfile.currency, currency: assetProfileInImport.currency,
cusip: assetProfileInImport.cusip, cusip: assetProfileInImport.cusip,
dataSource: assetProfileInImport.dataSource, dataSource: assetProfileInImport.dataSource,
figi: assetProfileInImport.figi, figi: assetProfileInImport.figi,

Loading…
Cancel
Save