diff --git a/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.controller.ts b/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.controller.ts index 83e1b5ce..7cb2520b 100644 --- a/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.controller.ts +++ b/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.controller.ts @@ -74,48 +74,6 @@ export class GhostfolioController { } } - /** - * @deprecated - */ - @Get('dividends/:symbol') - @HasPermission(permissions.enableDataProviderGhostfolio) - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async getDividendsV1( - @Param('symbol') symbol: string, - @Query() query: GetDividendsDto - ): Promise { - const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests(); - - if ( - this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests - ) { - throw new HttpException( - getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS), - StatusCodes.TOO_MANY_REQUESTS - ); - } - - try { - const dividends = await this.ghostfolioService.getDividends({ - symbol, - from: parseDate(query.from), - granularity: query.granularity, - to: parseDate(query.to) - }); - - await this.ghostfolioService.incrementDailyRequests({ - userId: this.request.user.id - }); - - return dividends; - } catch { - throw new HttpException( - getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR), - StatusCodes.INTERNAL_SERVER_ERROR - ); - } - } - @Get('dividends/:symbol') @HasPermission(permissions.enableDataProviderGhostfolio) @UseGuards(AuthGuard('api-key'), HasPermissionGuard) @@ -156,48 +114,6 @@ export class GhostfolioController { } } - /** - * @deprecated - */ - @Get('historical/:symbol') - @HasPermission(permissions.enableDataProviderGhostfolio) - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async getHistoricalV1( - @Param('symbol') symbol: string, - @Query() query: GetHistoricalDto - ): Promise { - const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests(); - - if ( - this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests - ) { - throw new HttpException( - getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS), - StatusCodes.TOO_MANY_REQUESTS - ); - } - - try { - const historicalData = await this.ghostfolioService.getHistorical({ - symbol, - from: parseDate(query.from), - granularity: query.granularity, - to: parseDate(query.to) - }); - - await this.ghostfolioService.incrementDailyRequests({ - userId: this.request.user.id - }); - - return historicalData; - } catch { - throw new HttpException( - getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR), - StatusCodes.INTERNAL_SERVER_ERROR - ); - } - } - @Get('historical/:symbol') @HasPermission(permissions.enableDataProviderGhostfolio) @UseGuards(AuthGuard('api-key'), HasPermissionGuard) @@ -238,47 +154,6 @@ export class GhostfolioController { } } - /** - * @deprecated - */ - @Get('lookup') - @HasPermission(permissions.enableDataProviderGhostfolio) - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async lookupSymbolV1( - @Query('includeIndices') includeIndicesParam = 'false', - @Query('query') query = '' - ): Promise { - const includeIndices = includeIndicesParam === 'true'; - const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests(); - - if ( - this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests - ) { - throw new HttpException( - getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS), - StatusCodes.TOO_MANY_REQUESTS - ); - } - - try { - const result = await this.ghostfolioService.lookup({ - includeIndices, - query: query.toLowerCase() - }); - - await this.ghostfolioService.incrementDailyRequests({ - userId: this.request.user.id - }); - - return result; - } catch { - throw new HttpException( - getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR), - StatusCodes.INTERNAL_SERVER_ERROR - ); - } - } - @Get('lookup') @HasPermission(permissions.enableDataProviderGhostfolio) @UseGuards(AuthGuard('api-key'), HasPermissionGuard) @@ -320,44 +195,6 @@ export class GhostfolioController { } } - /** - * @deprecated - */ - @Get('quotes') - @HasPermission(permissions.enableDataProviderGhostfolio) - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async getQuotesV1( - @Query() query: GetQuotesDto - ): Promise { - const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests(); - - if ( - this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests - ) { - throw new HttpException( - getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS), - StatusCodes.TOO_MANY_REQUESTS - ); - } - - try { - const quotes = await this.ghostfolioService.getQuotes({ - symbols: query.symbols - }); - - await this.ghostfolioService.incrementDailyRequests({ - userId: this.request.user.id - }); - - return quotes; - } catch { - throw new HttpException( - getReasonPhrase(StatusCodes.INTERNAL_SERVER_ERROR), - StatusCodes.INTERNAL_SERVER_ERROR - ); - } - } - @Get('quotes') @HasPermission(permissions.enableDataProviderGhostfolio) @UseGuards(AuthGuard('api-key'), HasPermissionGuard) @@ -394,16 +231,6 @@ export class GhostfolioController { } } - /** - * @deprecated - */ - @Get('status') - @HasPermission(permissions.enableDataProviderGhostfolio) - @UseGuards(AuthGuard('jwt'), HasPermissionGuard) - public async getStatusV1(): Promise { - return this.ghostfolioService.getStatus({ user: this.request.user }); - } - @Get('status') @HasPermission(permissions.enableDataProviderGhostfolio) @UseGuards(AuthGuard('api-key'), HasPermissionGuard)