Feature/connect or create logic for symbol profile (#153)

* Add connectOrCreate logic

* Extend seed

* Update changelog
pull/154/head
Thomas 4 years ago committed by GitHub
parent f74b00446c
commit 9eb25f6c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 country

@ -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.id

@ -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

Loading…
Cancel
Save