Browse Source

Fix missing symbol profile data connection in import

pull/630/head
Thomas 4 years ago
parent
commit
9fae7a7df2
  1. 24
      apps/api/src/app/import/import.service.ts
  2. 10
      apps/api/src/app/order/order.controller.ts

24
apps/api/src/app/import/import.service.ts

@ -34,11 +34,6 @@ export class ImportService {
unitPrice
} of orders) {
await this.orderService.createOrder({
Account: {
connect: {
id_userId: { userId, id: accountId }
}
},
currency,
dataSource,
fee,
@ -46,7 +41,26 @@ export class ImportService {
symbol,
type,
unitPrice,
Account: {
connect: {
id_userId: { userId, id: accountId }
}
},
date: parseISO(<string>(<unknown>date)),
SymbolProfile: {
connectOrCreate: {
create: {
dataSource,
symbol
},
where: {
dataSource_symbol: {
dataSource,
symbol
}
}
}
},
User: { connect: { id: userId } }
});
}

10
apps/api/src/app/order/order.controller.ts

@ -116,25 +116,25 @@ 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: {
create: {
dataSource: data.dataSource,
symbol: data.symbol
}
},
create: {
where: {
dataSource_symbol: {
dataSource: data.dataSource,
symbol: data.symbol
}
}
}
},
User: { connect: { id: this.request.user.id } }
});

Loading…
Cancel
Save