Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/rename Account to account in AccountBalance database schema (#5049)
Thomas Kaul77d3121f0d0d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a4c68125b6..0edf0d5902 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Extended the selector handling of the scraper configuration for more use cases- Changed `node main` to `exec node main` in the `entrypoint.sh` file to improve the container signal handling+- Renamed `Account` to `account` in the `AccountBalance` database schema- Improved the language localization for Catalan (`ca`)- Improved the language localization for Dutch (`nl`)- Improved the language localization for Español (`es`)diff --git a/apps/api/src/app/account-balance/account-balance.service.ts b/apps/api/src/app/account-balance/account-balance.service.tsindex 34d98d2662..10353f4ca1 100644--- a/apps/api/src/app/account-balance/account-balance.service.ts+++ b/apps/api/src/app/account-balance/account-balance.service.ts@@ -30,7 +30,7 @@ export class AccountBalanceService {): Promise<AccountBalance | null> {return this.prismaService.accountBalance.findFirst({include: {- Account: true+ account: true},where: accountBalanceWhereInput});@@ -46,7 +46,7 @@ export class AccountBalanceService {}): Promise<AccountBalance> {const accountBalance = await this.prismaService.accountBalance.upsert({create: {- Account: {+ account: {connect: {id_userId: {userId,@@ -154,7 +154,7 @@ export class AccountBalanceService {}if (withExcludedAccounts === false) {- where.Account = { isExcluded: false };+ where.account = { isExcluded: false };}const balances = await this.prismaService.accountBalance.findMany({@@ -163,7 +163,7 @@ export class AccountBalanceService {date: 'asc'},select: {- Account: true,+ account: true,date: true,id: true,value: true@@ -174,10 +174,10 @@ export class AccountBalanceService {balances: balances.map((balance) => {return {...balance,- accountId: balance.Account.id,+ accountId: balance.account.id,valueInBaseCurrency: this.exchangeRateDataService.toCurrency(balance.value,- balance.Account.currency,+ balance.account.currency,userCurrency)};diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex 3d821987de..b5d1c98141 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -50,6 +50,7 @@ model Account {}model AccountBalance {+ account Account @relation(fields: [accountId, userId], onDelete: Cascade, references: [id, userId])accountId StringcreatedAt DateTime @default(now())date DateTime @default(now())@@ -57,7 +58,6 @@ model AccountBalance {updatedAt DateTime @updatedAtuserId Stringvalue Float- Account Account @relation(fields: [accountId, userId], onDelete: Cascade, references: [id, userId])@@unique([accountId, date])@@index([accountId])