Browse Source

Task/remove deprecated symbol profile in create activity endpoint (#8125)

* Remove deprecated SymbolProfile from create activity endpoint

* Update changelog
pull/8147/head
Thomas Kaul 3 days ago
committed by GitHub
parent
commit
d0b79653cc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 3
      apps/api/src/app/activities/activities.controller.ts
  3. 23
      apps/api/src/helper/object.helper.spec.ts
  4. 4
      apps/api/src/interceptors/transform-data-source-in-response/transform-data-source-in-response.interceptor.ts
  5. 10
      libs/common/src/lib/config.ts
  6. 7
      libs/common/src/lib/interfaces/responses/create-activity-response.interface.ts

1
CHANGELOG.md

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Removed the deprecated `SymbolProfile` field from the endpoint `POST api/v1/activities`
- Upgraded `ai` from version `7.0.114` to `7.0.127`
### Fixed

3
apps/api/src/app/activities/activities.controller.ts

@ -38,6 +38,7 @@ import {
import { Order } from '@prisma/client';
import { parseISO } from 'date-fns';
import { StatusCodes, getReasonPhrase } from 'http-status-codes';
import { omit } from 'lodash-es';
import { ActivitiesFilterDto } from './activities-filter.dto';
import { ActivitiesService } from './activities.service';
@ -314,7 +315,7 @@ export class ActivitiesController {
}
]);
return { ...activity, assetProfile };
return { ...omit(activity, ['SymbolProfile']), assetProfile };
}
@HasPermission(permissions.updateActivity)

23
apps/api/src/helper/object.helper.spec.ts

@ -3121,8 +3121,8 @@ describe('redactAttributes', () => {
});
// The endpoint POST api/v1/activities returns a row of the database with the
// asset profile and the deprecated relation to the symbol profile
it('should redact an activity with the asset profile and the relation to the symbol profile', () => {
// asset profile
it('should redact an activity with the asset profile', () => {
expect(
redactPaths({
object: {
@ -3144,18 +3144,6 @@ describe('redactAttributes', () => {
fee: 19.9,
id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b',
quantity: 50,
SymbolProfile: {
comment: 'Reviewed by the administrator',
name: 'Apple Inc',
scraperConfiguration: {
headers: { Authorization: 'Bearer TOKEN' },
mode: 'lazy',
selector: '.price',
url: 'https://example.org/get_price'
},
symbol: 'AAPL',
symbolMapping: { YAHOO: 'AAPL' }
},
type: 'BUY',
unitPrice: 220.79
},
@ -3175,13 +3163,6 @@ describe('redactAttributes', () => {
fee: null,
id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b',
quantity: null,
SymbolProfile: {
comment: null,
name: 'Apple Inc',
scraperConfiguration: null,
symbol: 'AAPL',
symbolMapping: null
},
type: 'BUY',
unitPrice: 220.79
});

4
apps/api/src/interceptors/transform-data-source-in-response/transform-data-source-in-response.interceptor.ts

@ -94,10 +94,6 @@ export class TransformDataSourceInResponseInterceptor<
'items[*].dataSource',
'latestActivities[*].assetProfile.dataSource',
'settings["filters.dataSource"]',
/* @deprecated */
'SymbolProfile.dataSource',
'watchlist[*].dataSource'
]
});

10
libs/common/src/lib/config.ts

@ -184,16 +184,6 @@ export const DEFAULT_REDACTED_PATHS = [
'settings.emergencyFund',
'settings.projectedTotalAmount',
'settings.savingsRate',
/* @deprecated */
'SymbolProfile.comment',
/* @deprecated */
'SymbolProfile.scraperConfiguration',
/* @deprecated */
'SymbolProfile.symbolMapping',
'totalBalanceInBaseCurrency',
'totalDividendInBaseCurrency',
'totalInterestInBaseCurrency',

7
libs/common/src/lib/interfaces/responses/create-activity-response.interface.ts

@ -1,12 +1,7 @@
import type { Order, SymbolProfile } from '@ghostfolio/prisma/browser';
import type { Order } from '@ghostfolio/prisma/browser';
import { EnhancedAssetProfile } from '../enhanced-asset-profile.interface';
export interface CreateActivityResponse extends Order {
assetProfile: EnhancedAssetProfile;
/**
* @deprecated Use `assetProfile` instead
*/
SymbolProfile: SymbolProfile;
}

Loading…
Cancel
Save