Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/daily requests check in Ghostfolio data provider (#7485)
Thomas Kaul0a01d4234a94
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.tsindex 5d6979acce..6e5f48d635 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@@ -51,7 +51,7 @@ export class GhostfolioController {const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests();if (- this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests+ this.request.user.dataProviderGhostfolioDailyRequests >= maxDailyRequests) {throw new HttpException(getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS),@@ -95,7 +95,7 @@ export class GhostfolioController {const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests();if (- this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests+ this.request.user.dataProviderGhostfolioDailyRequests >= maxDailyRequests) {throw new HttpException(getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS),@@ -135,7 +135,7 @@ export class GhostfolioController {const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests();if (- this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests+ this.request.user.dataProviderGhostfolioDailyRequests >= maxDailyRequests) {throw new HttpException(getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS),@@ -176,7 +176,7 @@ export class GhostfolioController {const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests();if (- this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests+ this.request.user.dataProviderGhostfolioDailyRequests >= maxDailyRequests) {throw new HttpException(getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS),@@ -215,7 +215,7 @@ export class GhostfolioController {const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests();if (- this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests+ this.request.user.dataProviderGhostfolioDailyRequests >= maxDailyRequests) {throw new HttpException(getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS),@@ -252,7 +252,7 @@ export class GhostfolioController {const maxDailyRequests = await this.ghostfolioService.getMaxDailyRequests();if (- this.request.user.dataProviderGhostfolioDailyRequests > maxDailyRequests+ this.request.user.dataProviderGhostfolioDailyRequests >= maxDailyRequests) {throw new HttpException(getReasonPhrase(StatusCodes.TOO_MANY_REQUESTS),diff --git a/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts b/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.tsindex 2c22f0c10f..31d20b99e2 100644--- a/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts+++ b/apps/api/src/app/endpoints/data-providers/ghostfolio/ghostfolio.service.ts@@ -326,8 +326,12 @@ export class GhostfolioService {}public async incrementDailyRequests({ userId }: { userId: string }) {- await this.prismaService.analytics.update({- data: {+ await this.prismaService.analytics.upsert({+ create: {+ dataProviderGhostfolioDailyRequests: 1,+ user: { connect: { id: userId } }+ },+ update: {dataProviderGhostfolioDailyRequests: { increment: 1 }},where: { userId }diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.tsindex febc967d23..b706e47023 100644--- a/apps/api/src/app/user/user.service.ts+++ b/apps/api/src/app/user/user.service.ts@@ -326,7 +326,7 @@ export class UserService {updatedAt,activityCount: analytics?.activityCount,dataProviderGhostfolioDailyRequests:- analytics?.dataProviderGhostfolioDailyRequests+ analytics?.dataProviderGhostfolioDailyRequests ?? 0};if (user.settings) {