Bugfix/fix data source transformation in dividends import (#1985)
* Fix data source transformation * Update changelog
This commit is contained in:
parent
4d700e3b83
commit
136c4bf50b
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Improved the _Select all_ activities checkbox state after importing activities including a duplicate
|
- Improved the _Select all_ activities checkbox state after importing activities including a duplicate
|
||||||
|
- Fixed an issue with the data source transformation in the import dividends dialog
|
||||||
- Fixed the _Storybook_ setup
|
- Fixed the _Storybook_ setup
|
||||||
|
|
||||||
## 1.269.0 - 2023-05-11
|
## 1.269.0 - 2023-05-11
|
||||||
|
@ -35,6 +35,8 @@ export class ImportController {
|
|||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
|
@UseInterceptors(TransformDataSourceInRequestInterceptor)
|
||||||
|
@UseInterceptors(TransformDataSourceInResponseInterceptor)
|
||||||
public async import(
|
public async import(
|
||||||
@Body() importData: ImportDataDto,
|
@Body() importData: ImportDataDto,
|
||||||
@Query('dryRun') isDryRun?: boolean
|
@Query('dryRun') isDryRun?: boolean
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
Injectable,
|
Injectable,
|
||||||
NestInterceptor
|
NestInterceptor
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
|
import { DataSource } from '@prisma/client';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -24,11 +25,24 @@ export class TransformDataSourceInRequestInterceptor<T>
|
|||||||
const request = http.getRequest();
|
const request = http.getRequest();
|
||||||
|
|
||||||
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
|
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
|
||||||
if (request.body.dataSource) {
|
if (request.body.activities) {
|
||||||
|
request.body.activities = request.body.activities.map((activity) => {
|
||||||
|
if (DataSource[activity.dataSource]) {
|
||||||
|
return activity;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
...activity,
|
||||||
|
dataSource: decodeDataSource(activity.dataSource)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.body.dataSource && !DataSource[request.body.dataSource]) {
|
||||||
request.body.dataSource = decodeDataSource(request.body.dataSource);
|
request.body.dataSource = decodeDataSource(request.body.dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.params.dataSource) {
|
if (request.params.dataSource && !DataSource[request.params.dataSource]) {
|
||||||
request.params.dataSource = decodeDataSource(request.params.dataSource);
|
request.params.dataSource = decodeDataSource(request.params.dataSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user