Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/connect or create logic for symbol profile (#153)
Thomas9eb25f6c9e6f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bd5deaf0bd..72fcc5e70b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## Unreleased+### Added++- Added a connect or create symbol profile model logic on creating a new transaction+### Changed- Improved the global heat map to visualize investments by countrydiff --git a/apps/api/src/app/order/order.controller.ts b/apps/api/src/app/order/order.controller.tsindex 379eb4c116..a386898a2d 100644--- a/apps/api/src/app/order/order.controller.ts+++ b/apps/api/src/app/order/order.controller.ts@@ -132,12 +132,26 @@ export class OrderController {return this.orderService.createOrder({...data,- date,Account: {connect: {id_userId: { id: accountId, userId: this.request.user.id }}},+ date,+ SymbolProfile: {+ connectOrCreate: {+ where: {+ dataSource_symbol: {+ dataSource: data.dataSource,+ symbol: data.symbol+ }+ },+ create: {+ dataSource: data.dataSource,+ symbol: data.symbol+ }+ }+ },User: { connect: { id: this.request.user.id } }},this.request.user.iddiff --git a/prisma/seed.ts b/prisma/seed.tsindex f445a9ade1..057698875d 100644--- a/prisma/seed.ts+++ b/prisma/seed.ts@@ -144,6 +144,12 @@ async function main() {id: '2bd26362-136e-411c-b578-334084b4cdcc',symbol: 'AMZN'},+ {+ countries: null,+ dataSource: DataSource.YAHOO,+ id: 'fdc42ea6-1321-44f5-9fb0-d7f1f2cf9b1e',+ symbol: 'BTCUSD'+ },{countries: [{ code: 'US', weight: 1 }],dataSource: DataSource.YAHOO,@@ -191,6 +197,7 @@ async function main() {id: 'a1c5d73a-8631-44e5-ac44-356827a5212c',quantity: 0.5614682,symbol: 'BTCUSD',+ symbolProfileId: 'fdc42ea6-1321-44f5-9fb0-d7f1f2cf9b1e',type: Type.BUY,unitPrice: 3562.089535970158,userId: userDemo.id