diff --git a/CHANGELOG.md b/CHANGELOG.md index 01065cac5..105aa05ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Exposed the profile data gathering by symbol as an endpoint + ### Changed - Improved the portfolio analysis page: show the y-axis and extend the chart in relation to the days in market diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts index ab20df270..e24522444 100644 --- a/apps/api/src/app/admin/admin.controller.ts +++ b/apps/api/src/app/admin/admin.controller.ts @@ -96,6 +96,29 @@ export class AdminController { return; } + @Post('gather/profile-data/:dataSource/:symbol') + @UseGuards(AuthGuard('jwt')) + public async gatherProfileDataForSymbol( + @Param('dataSource') dataSource: DataSource, + @Param('symbol') symbol: string + ): Promise { + if ( + !hasPermission( + this.request.user.permissions, + permissions.accessAdminControl + ) + ) { + throw new HttpException( + getReasonPhrase(StatusCodes.FORBIDDEN), + StatusCodes.FORBIDDEN + ); + } + + this.dataGatheringService.gatherProfileData([{ dataSource, symbol }]); + + return; + } + @Post('gather/:dataSource/:symbol') @UseGuards(AuthGuard('jwt')) public async gatherSymbol( diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts index 87ebfea28..a8d96233a 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts @@ -43,6 +43,19 @@ export class AdminMarketDataComponent implements OnDestroy, OnInit { this.fetchAdminMarketData(); } + public onGatherProfileDataBySymbol({ + dataSource, + symbol + }: { + dataSource: DataSource; + symbol: string; + }) { + this.adminService + .gatherProfileDataBySymbol({ dataSource, symbol }) + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe(() => {}); + } + public onGatherSymbol({ dataSource, symbol diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.html b/apps/client/src/app/components/admin-market-data/admin-market-data.html index b0df54364..3410e99ed 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.html +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.html @@ -38,6 +38,13 @@ > Gather Data + diff --git a/apps/client/src/app/services/admin.service.ts b/apps/client/src/app/services/admin.service.ts index 66488f4ac..b10d3fed0 100644 --- a/apps/client/src/app/services/admin.service.ts +++ b/apps/client/src/app/services/admin.service.ts @@ -20,6 +20,19 @@ export class AdminService { return this.http.post(`/api/admin/gather/profile-data`, {}); } + public gatherProfileDataBySymbol({ + dataSource, + symbol + }: { + dataSource: DataSource; + symbol: string; + }) { + return this.http.post( + `/api/admin/gather/profile-data/${dataSource}/${symbol}`, + {} + ); + } + public gatherSymbol({ dataSource, date,