Browse Source

Expose profile data gathering by symbol endpoint

pull/611/head
Thomas 4 years ago
parent
commit
3e729076d8
  1. 23
      apps/api/src/app/admin/admin.controller.ts
  2. 13
      apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
  3. 7
      apps/client/src/app/components/admin-market-data/admin-market-data.html
  4. 13
      apps/client/src/app/services/admin.service.ts

23
apps/api/src/app/admin/admin.controller.ts

@ -96,6 +96,29 @@ export class AdminController {
return; return;
} }
@Post('gather/profile-data/:dataSource/:symbol')
@UseGuards(AuthGuard('jwt'))
public async gatherProfileDataForSymbol(
@Param('dataSource') dataSource: DataSource,
@Param('symbol') symbol: string
): Promise<void> {
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') @Post('gather/:dataSource/:symbol')
@UseGuards(AuthGuard('jwt')) @UseGuards(AuthGuard('jwt'))
public async gatherSymbol( public async gatherSymbol(

13
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(); this.fetchAdminMarketData();
} }
public onGatherProfileDataBySymbol({
dataSource,
symbol
}: {
dataSource: DataSource;
symbol: string;
}) {
this.adminService
.gatherProfileDataBySymbol({ dataSource, symbol })
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(() => {});
}
public onGatherSymbol({ public onGatherSymbol({
dataSource, dataSource,
symbol symbol

7
apps/client/src/app/components/admin-market-data/admin-market-data.html

@ -38,6 +38,13 @@
> >
Gather Data Gather Data
</button> </button>
<button
i18n
mat-menu-item
(click)="onGatherProfileDataBySymbol({dataSource: item.dataSource, symbol: item.symbol})"
>
Gather Profile Data
</button>
</mat-menu> </mat-menu>
</td> </td>
</tr> </tr>

13
apps/client/src/app/services/admin.service.ts

@ -20,6 +20,19 @@ export class AdminService {
return this.http.post<void>(`/api/admin/gather/profile-data`, {}); return this.http.post<void>(`/api/admin/gather/profile-data`, {});
} }
public gatherProfileDataBySymbol({
dataSource,
symbol
}: {
dataSource: DataSource;
symbol: string;
}) {
return this.http.post<void>(
`/api/admin/gather/profile-data/${dataSource}/${symbol}`,
{}
);
}
public gatherSymbol({ public gatherSymbol({
dataSource, dataSource,
date, date,

Loading…
Cancel
Save