Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/improve error handling in delete user endpoint (#2000)
Thomas Kaul1f393e78f68d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 662e1f3cf1..8f465d45bc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Decreased the density of the `@angular/material` tables- Improved the breadcrumb navigation style in the blog post pages for mobile+- Improved the error handling in the delete user endpoint- Improved the style of the _Changelog & License_ button on the about page- Upgraded `ionicons` from version `6.1.2` to `7.1.0`diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.tsindex 56807e10ad..26736e88d8 100644--- a/apps/api/src/app/user/user.service.ts+++ b/apps/api/src/app/user/user.service.ts@@ -304,21 +304,29 @@ export class UserService {}public async deleteUser(where: Prisma.UserWhereUniqueInput): Promise<User> {- await this.prismaService.access.deleteMany({- where: { OR: [{ granteeUserId: where.id }, { userId: where.id }] }- });+ try {+ await this.prismaService.access.deleteMany({+ where: { OR: [{ granteeUserId: where.id }, { userId: where.id }] }+ });+ } catch {}- await this.prismaService.account.deleteMany({- where: { userId: where.id }- });+ try {+ await this.prismaService.account.deleteMany({+ where: { userId: where.id }+ });+ } catch {}- await this.prismaService.analytics.delete({- where: { userId: where.id }- });+ try {+ await this.prismaService.analytics.delete({+ where: { userId: where.id }+ });+ } catch {}- await this.prismaService.order.deleteMany({- where: { userId: where.id }- });+ try {+ await this.prismaService.order.deleteMany({+ where: { userId: where.id }+ });+ } catch {}try {await this.prismaService.settings.delete({