adaptic-backend 1.0.159 → 1.0.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/Account.cjs +285 -8
  2. package/Action.cjs +615 -4
  3. package/Alert.cjs +338 -4
  4. package/AlpacaAccount.cjs +771 -4
  5. package/Asset.cjs +642 -0
  6. package/Authenticator.cjs +288 -4
  7. package/Customer.cjs +273 -10
  8. package/NewsArticle.cjs +165 -0
  9. package/NewsArticleAssetSentiment.cjs +256 -8
  10. package/Order.cjs +510 -10
  11. package/Position.cjs +546 -8
  12. package/Session.cjs +288 -4
  13. package/StopLoss.cjs +348 -1
  14. package/TakeProfit.cjs +348 -1
  15. package/Trade.cjs +607 -8
  16. package/User.cjs +261 -0
  17. package/package.json +1 -1
  18. package/server/Account.d.ts.map +1 -1
  19. package/server/Account.js.map +1 -1
  20. package/server/Account.mjs +285 -8
  21. package/server/Action.d.ts.map +1 -1
  22. package/server/Action.js.map +1 -1
  23. package/server/Action.mjs +615 -4
  24. package/server/Alert.d.ts.map +1 -1
  25. package/server/Alert.js.map +1 -1
  26. package/server/Alert.mjs +338 -4
  27. package/server/AlpacaAccount.d.ts.map +1 -1
  28. package/server/AlpacaAccount.js.map +1 -1
  29. package/server/AlpacaAccount.mjs +771 -4
  30. package/server/Asset.d.ts.map +1 -1
  31. package/server/Asset.js.map +1 -1
  32. package/server/Asset.mjs +642 -0
  33. package/server/Authenticator.d.ts.map +1 -1
  34. package/server/Authenticator.js.map +1 -1
  35. package/server/Authenticator.mjs +288 -4
  36. package/server/Customer.d.ts.map +1 -1
  37. package/server/Customer.js.map +1 -1
  38. package/server/Customer.mjs +273 -10
  39. package/server/NewsArticle.d.ts.map +1 -1
  40. package/server/NewsArticle.js.map +1 -1
  41. package/server/NewsArticle.mjs +165 -0
  42. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  43. package/server/NewsArticleAssetSentiment.js.map +1 -1
  44. package/server/NewsArticleAssetSentiment.mjs +256 -8
  45. package/server/Order.d.ts.map +1 -1
  46. package/server/Order.js.map +1 -1
  47. package/server/Order.mjs +510 -10
  48. package/server/Position.d.ts.map +1 -1
  49. package/server/Position.js.map +1 -1
  50. package/server/Position.mjs +546 -8
  51. package/server/Session.d.ts.map +1 -1
  52. package/server/Session.js.map +1 -1
  53. package/server/Session.mjs +288 -4
  54. package/server/StopLoss.d.ts.map +1 -1
  55. package/server/StopLoss.js.map +1 -1
  56. package/server/StopLoss.mjs +348 -1
  57. package/server/TakeProfit.d.ts.map +1 -1
  58. package/server/TakeProfit.js.map +1 -1
  59. package/server/TakeProfit.mjs +348 -1
  60. package/server/Trade.d.ts.map +1 -1
  61. package/server/Trade.js.map +1 -1
  62. package/server/Trade.mjs +607 -8
  63. package/server/User.d.ts.map +1 -1
  64. package/server/User.js.map +1 -1
  65. package/server/User.mjs +261 -0
@@ -295,6 +295,12 @@ export const Position = {
295
295
  : { connectOrCreate: props.asset.trades.map((item) => ({
296
296
  where: {
297
297
  id: item.id !== undefined ? item.id : undefined,
298
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
299
+ equals: item.alpacaAccountId
300
+ } : undefined,
301
+ assetId: item.assetId !== undefined ? {
302
+ equals: item.assetId
303
+ } : undefined,
298
304
  },
299
305
  create: {
300
306
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -317,6 +323,9 @@ export const Position = {
317
323
  : { connectOrCreate: {
318
324
  where: {
319
325
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
326
+ userId: item.alpacaAccount.userId !== undefined ? {
327
+ equals: item.alpacaAccount.userId
328
+ } : undefined,
320
329
  },
321
330
  create: {
322
331
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -340,6 +349,9 @@ export const Position = {
340
349
  : { connectOrCreate: item.actions.map((item) => ({
341
350
  where: {
342
351
  id: item.id !== undefined ? item.id : undefined,
352
+ tradeId: item.tradeId !== undefined ? {
353
+ equals: item.tradeId
354
+ } : undefined,
343
355
  },
344
356
  create: {
345
357
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -362,6 +374,15 @@ export const Position = {
362
374
  : { connectOrCreate: props.asset.orders.map((item) => ({
363
375
  where: {
364
376
  id: item.id !== undefined ? item.id : undefined,
377
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
378
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
379
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
380
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
381
+ equals: item.alpacaAccountId
382
+ } : undefined,
383
+ assetId: item.assetId !== undefined ? {
384
+ equals: item.assetId
385
+ } : undefined,
365
386
  },
366
387
  create: {
367
388
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -395,6 +416,7 @@ export const Position = {
395
416
  : { connectOrCreate: {
396
417
  where: {
397
418
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
419
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
398
420
  },
399
421
  create: {
400
422
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -411,6 +433,7 @@ export const Position = {
411
433
  : { connectOrCreate: {
412
434
  where: {
413
435
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
436
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
414
437
  },
415
438
  create: {
416
439
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -427,6 +450,9 @@ export const Position = {
427
450
  : { connectOrCreate: {
428
451
  where: {
429
452
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
453
+ userId: item.alpacaAccount.userId !== undefined ? {
454
+ equals: item.alpacaAccount.userId
455
+ } : undefined,
430
456
  },
431
457
  create: {
432
458
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -450,6 +476,9 @@ export const Position = {
450
476
  : { connectOrCreate: {
451
477
  where: {
452
478
  id: item.action.id !== undefined ? item.action.id : undefined,
479
+ tradeId: item.action.tradeId !== undefined ? {
480
+ equals: item.action.tradeId
481
+ } : undefined,
453
482
  },
454
483
  create: {
455
484
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -473,6 +502,12 @@ export const Position = {
473
502
  where: {
474
503
  id: item.id !== undefined ? item.id : undefined,
475
504
  url: item.url !== undefined ? item.url : undefined,
505
+ assetId: item.assetId !== undefined ? {
506
+ equals: item.assetId
507
+ } : undefined,
508
+ newsArticleId: item.newsArticleId !== undefined ? {
509
+ equals: item.newsArticleId
510
+ } : undefined,
476
511
  },
477
512
  create: {
478
513
  url: item.url !== undefined ? item.url : undefined,
@@ -525,6 +560,9 @@ export const Position = {
525
560
  : { connectOrCreate: {
526
561
  where: {
527
562
  id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
563
+ userId: props.alpacaAccount.userId !== undefined ? {
564
+ equals: props.alpacaAccount.userId
565
+ } : undefined,
528
566
  },
529
567
  create: {
530
568
  type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
@@ -571,9 +609,17 @@ export const Position = {
571
609
  : { connectOrCreate: {
572
610
  where: {
573
611
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
612
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
613
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
614
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
615
+ equals: props.alpacaAccount.user.customer.authUserId
616
+ } : undefined,
574
617
  name: props.alpacaAccount.user.customer.name !== undefined ? {
575
618
  equals: props.alpacaAccount.user.customer.name
576
619
  } : undefined,
620
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
621
+ equals: props.alpacaAccount.user.customer.stripePriceId
622
+ } : undefined,
577
623
  },
578
624
  create: {
579
625
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -595,6 +641,12 @@ export const Position = {
595
641
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
596
642
  where: {
597
643
  id: item.id !== undefined ? item.id : undefined,
644
+ userId: item.userId !== undefined ? {
645
+ equals: item.userId
646
+ } : undefined,
647
+ providerAccountId: item.providerAccountId !== undefined ? {
648
+ equals: item.providerAccountId
649
+ } : undefined,
598
650
  },
599
651
  create: {
600
652
  type: item.type !== undefined ? item.type : undefined,
@@ -619,6 +671,9 @@ export const Position = {
619
671
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
620
672
  where: {
621
673
  id: item.id !== undefined ? item.id : undefined,
674
+ userId: item.userId !== undefined ? {
675
+ equals: item.userId
676
+ } : undefined,
622
677
  },
623
678
  create: {
624
679
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -635,6 +690,9 @@ export const Position = {
635
690
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
636
691
  where: {
637
692
  id: item.id !== undefined ? item.id : undefined,
693
+ userId: item.userId !== undefined ? {
694
+ equals: item.userId
695
+ } : undefined,
638
696
  },
639
697
  create: {
640
698
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -655,6 +713,12 @@ export const Position = {
655
713
  : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
656
714
  where: {
657
715
  id: item.id !== undefined ? item.id : undefined,
716
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
717
+ equals: item.alpacaAccountId
718
+ } : undefined,
719
+ assetId: item.assetId !== undefined ? {
720
+ equals: item.assetId
721
+ } : undefined,
658
722
  },
659
723
  create: {
660
724
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -748,6 +812,9 @@ export const Position = {
748
812
  : { connectOrCreate: item.actions.map((item) => ({
749
813
  where: {
750
814
  id: item.id !== undefined ? item.id : undefined,
815
+ tradeId: item.tradeId !== undefined ? {
816
+ equals: item.tradeId
817
+ } : undefined,
751
818
  },
752
819
  create: {
753
820
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -770,6 +837,15 @@ export const Position = {
770
837
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
771
838
  where: {
772
839
  id: item.id !== undefined ? item.id : undefined,
840
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
841
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
842
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
843
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
844
+ equals: item.alpacaAccountId
845
+ } : undefined,
846
+ assetId: item.assetId !== undefined ? {
847
+ equals: item.assetId
848
+ } : undefined,
773
849
  },
774
850
  create: {
775
851
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -803,6 +879,7 @@ export const Position = {
803
879
  : { connectOrCreate: {
804
880
  where: {
805
881
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
882
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
806
883
  },
807
884
  create: {
808
885
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -819,6 +896,7 @@ export const Position = {
819
896
  : { connectOrCreate: {
820
897
  where: {
821
898
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
899
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
822
900
  },
823
901
  create: {
824
902
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -835,6 +913,9 @@ export const Position = {
835
913
  : { connectOrCreate: {
836
914
  where: {
837
915
  id: item.action.id !== undefined ? item.action.id : undefined,
916
+ tradeId: item.action.tradeId !== undefined ? {
917
+ equals: item.action.tradeId
918
+ } : undefined,
838
919
  },
839
920
  create: {
840
921
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -928,6 +1009,9 @@ export const Position = {
928
1009
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
929
1010
  where: {
930
1011
  id: item.id !== undefined ? item.id : undefined,
1012
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1013
+ equals: item.alpacaAccountId
1014
+ } : undefined,
931
1015
  },
932
1016
  create: {
933
1017
  message: item.message !== undefined ? item.message : undefined,
@@ -1023,7 +1107,9 @@ export const Position = {
1023
1107
  const variables = {
1024
1108
  where: {
1025
1109
  id: props.id !== undefined ? props.id : undefined,
1026
- assetId: props.assetId !== undefined ? props.assetId : undefined,
1110
+ assetId: props.assetId !== undefined ? {
1111
+ equals: props.assetId
1112
+ } : undefined,
1027
1113
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
1028
1114
  qty: props.qty !== undefined ? props.qty : undefined,
1029
1115
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -1036,7 +1122,9 @@ export const Position = {
1036
1122
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
1037
1123
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
1038
1124
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
1039
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
1125
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
1126
+ equals: props.alpacaAccountId
1127
+ } : undefined,
1040
1128
  },
1041
1129
  data: {
1042
1130
  id: props.id !== undefined ? {
@@ -1267,6 +1355,12 @@ export const Position = {
1267
1355
  upsert: props.asset.trades.map((item) => ({
1268
1356
  where: {
1269
1357
  id: item.id !== undefined ? item.id : undefined,
1358
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1359
+ equals: item.alpacaAccountId
1360
+ } : undefined,
1361
+ assetId: item.assetId !== undefined ? {
1362
+ equals: item.assetId
1363
+ } : undefined,
1270
1364
  },
1271
1365
  update: {
1272
1366
  id: item.id !== undefined ? {
@@ -1311,6 +1405,9 @@ export const Position = {
1311
1405
  id: item.alpacaAccount.id !== undefined ? {
1312
1406
  equals: item.alpacaAccount.id
1313
1407
  } : undefined,
1408
+ userId: item.alpacaAccount.userId !== undefined ? {
1409
+ equals: item.alpacaAccount.userId
1410
+ } : undefined,
1314
1411
  },
1315
1412
  update: {
1316
1413
  id: item.alpacaAccount.id !== undefined ? {
@@ -1361,6 +1458,9 @@ export const Position = {
1361
1458
  upsert: item.actions.map((item) => ({
1362
1459
  where: {
1363
1460
  id: item.id !== undefined ? item.id : undefined,
1461
+ tradeId: item.tradeId !== undefined ? {
1462
+ equals: item.tradeId
1463
+ } : undefined,
1364
1464
  },
1365
1465
  update: {
1366
1466
  id: item.id !== undefined ? {
@@ -1413,6 +1513,9 @@ export const Position = {
1413
1513
  : { connectOrCreate: {
1414
1514
  where: {
1415
1515
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1516
+ userId: item.alpacaAccount.userId !== undefined ? {
1517
+ equals: item.alpacaAccount.userId
1518
+ } : undefined,
1416
1519
  },
1417
1520
  create: {
1418
1521
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1436,6 +1539,9 @@ export const Position = {
1436
1539
  : { connectOrCreate: item.actions.map((item) => ({
1437
1540
  where: {
1438
1541
  id: item.id !== undefined ? item.id : undefined,
1542
+ tradeId: item.tradeId !== undefined ? {
1543
+ equals: item.tradeId
1544
+ } : undefined,
1439
1545
  },
1440
1546
  create: {
1441
1547
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1453,6 +1559,15 @@ export const Position = {
1453
1559
  upsert: props.asset.orders.map((item) => ({
1454
1560
  where: {
1455
1561
  id: item.id !== undefined ? item.id : undefined,
1562
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1563
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1564
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1565
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1566
+ equals: item.alpacaAccountId
1567
+ } : undefined,
1568
+ assetId: item.assetId !== undefined ? {
1569
+ equals: item.assetId
1570
+ } : undefined,
1456
1571
  },
1457
1572
  update: {
1458
1573
  id: item.id !== undefined ? {
@@ -1530,6 +1645,9 @@ export const Position = {
1530
1645
  id: item.stopLoss.id !== undefined ? {
1531
1646
  equals: item.stopLoss.id
1532
1647
  } : undefined,
1648
+ orderId: item.stopLoss.orderId !== undefined ? {
1649
+ equals: item.stopLoss.orderId
1650
+ } : undefined,
1533
1651
  },
1534
1652
  update: {
1535
1653
  id: item.stopLoss.id !== undefined ? {
@@ -1554,6 +1672,9 @@ export const Position = {
1554
1672
  id: item.takeProfit.id !== undefined ? {
1555
1673
  equals: item.takeProfit.id
1556
1674
  } : undefined,
1675
+ orderId: item.takeProfit.orderId !== undefined ? {
1676
+ equals: item.takeProfit.orderId
1677
+ } : undefined,
1557
1678
  },
1558
1679
  update: {
1559
1680
  id: item.takeProfit.id !== undefined ? {
@@ -1578,6 +1699,9 @@ export const Position = {
1578
1699
  id: item.alpacaAccount.id !== undefined ? {
1579
1700
  equals: item.alpacaAccount.id
1580
1701
  } : undefined,
1702
+ userId: item.alpacaAccount.userId !== undefined ? {
1703
+ equals: item.alpacaAccount.userId
1704
+ } : undefined,
1581
1705
  },
1582
1706
  update: {
1583
1707
  id: item.alpacaAccount.id !== undefined ? {
@@ -1630,6 +1754,9 @@ export const Position = {
1630
1754
  id: item.action.id !== undefined ? {
1631
1755
  equals: item.action.id
1632
1756
  } : undefined,
1757
+ tradeId: item.action.tradeId !== undefined ? {
1758
+ equals: item.action.tradeId
1759
+ } : undefined,
1633
1760
  },
1634
1761
  update: {
1635
1762
  id: item.action.id !== undefined ? {
@@ -1693,6 +1820,7 @@ export const Position = {
1693
1820
  : { connectOrCreate: {
1694
1821
  where: {
1695
1822
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1823
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
1696
1824
  },
1697
1825
  create: {
1698
1826
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -1709,6 +1837,7 @@ export const Position = {
1709
1837
  : { connectOrCreate: {
1710
1838
  where: {
1711
1839
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1840
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
1712
1841
  },
1713
1842
  create: {
1714
1843
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -1725,6 +1854,9 @@ export const Position = {
1725
1854
  : { connectOrCreate: {
1726
1855
  where: {
1727
1856
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1857
+ userId: item.alpacaAccount.userId !== undefined ? {
1858
+ equals: item.alpacaAccount.userId
1859
+ } : undefined,
1728
1860
  },
1729
1861
  create: {
1730
1862
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1748,6 +1880,9 @@ export const Position = {
1748
1880
  : { connectOrCreate: {
1749
1881
  where: {
1750
1882
  id: item.action.id !== undefined ? item.action.id : undefined,
1883
+ tradeId: item.action.tradeId !== undefined ? {
1884
+ equals: item.action.tradeId
1885
+ } : undefined,
1751
1886
  },
1752
1887
  create: {
1753
1888
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -1766,6 +1901,12 @@ export const Position = {
1766
1901
  where: {
1767
1902
  id: item.id !== undefined ? item.id : undefined,
1768
1903
  url: item.url !== undefined ? item.url : undefined,
1904
+ assetId: item.assetId !== undefined ? {
1905
+ equals: item.assetId
1906
+ } : undefined,
1907
+ newsArticleId: item.newsArticleId !== undefined ? {
1908
+ equals: item.newsArticleId
1909
+ } : undefined,
1769
1910
  },
1770
1911
  update: {
1771
1912
  id: item.id !== undefined ? {
@@ -1963,6 +2104,12 @@ export const Position = {
1963
2104
  : { connectOrCreate: props.asset.trades.map((item) => ({
1964
2105
  where: {
1965
2106
  id: item.id !== undefined ? item.id : undefined,
2107
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2108
+ equals: item.alpacaAccountId
2109
+ } : undefined,
2110
+ assetId: item.assetId !== undefined ? {
2111
+ equals: item.assetId
2112
+ } : undefined,
1966
2113
  },
1967
2114
  create: {
1968
2115
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1985,6 +2132,9 @@ export const Position = {
1985
2132
  : { connectOrCreate: {
1986
2133
  where: {
1987
2134
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2135
+ userId: item.alpacaAccount.userId !== undefined ? {
2136
+ equals: item.alpacaAccount.userId
2137
+ } : undefined,
1988
2138
  },
1989
2139
  create: {
1990
2140
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2008,6 +2158,9 @@ export const Position = {
2008
2158
  : { connectOrCreate: item.actions.map((item) => ({
2009
2159
  where: {
2010
2160
  id: item.id !== undefined ? item.id : undefined,
2161
+ tradeId: item.tradeId !== undefined ? {
2162
+ equals: item.tradeId
2163
+ } : undefined,
2011
2164
  },
2012
2165
  create: {
2013
2166
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2030,6 +2183,15 @@ export const Position = {
2030
2183
  : { connectOrCreate: props.asset.orders.map((item) => ({
2031
2184
  where: {
2032
2185
  id: item.id !== undefined ? item.id : undefined,
2186
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2187
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2188
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2189
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2190
+ equals: item.alpacaAccountId
2191
+ } : undefined,
2192
+ assetId: item.assetId !== undefined ? {
2193
+ equals: item.assetId
2194
+ } : undefined,
2033
2195
  },
2034
2196
  create: {
2035
2197
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2063,6 +2225,7 @@ export const Position = {
2063
2225
  : { connectOrCreate: {
2064
2226
  where: {
2065
2227
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2228
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2066
2229
  },
2067
2230
  create: {
2068
2231
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2079,6 +2242,7 @@ export const Position = {
2079
2242
  : { connectOrCreate: {
2080
2243
  where: {
2081
2244
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2245
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2082
2246
  },
2083
2247
  create: {
2084
2248
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2095,6 +2259,9 @@ export const Position = {
2095
2259
  : { connectOrCreate: {
2096
2260
  where: {
2097
2261
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2262
+ userId: item.alpacaAccount.userId !== undefined ? {
2263
+ equals: item.alpacaAccount.userId
2264
+ } : undefined,
2098
2265
  },
2099
2266
  create: {
2100
2267
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2118,6 +2285,9 @@ export const Position = {
2118
2285
  : { connectOrCreate: {
2119
2286
  where: {
2120
2287
  id: item.action.id !== undefined ? item.action.id : undefined,
2288
+ tradeId: item.action.tradeId !== undefined ? {
2289
+ equals: item.action.tradeId
2290
+ } : undefined,
2121
2291
  },
2122
2292
  create: {
2123
2293
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2141,6 +2311,12 @@ export const Position = {
2141
2311
  where: {
2142
2312
  id: item.id !== undefined ? item.id : undefined,
2143
2313
  url: item.url !== undefined ? item.url : undefined,
2314
+ assetId: item.assetId !== undefined ? {
2315
+ equals: item.assetId
2316
+ } : undefined,
2317
+ newsArticleId: item.newsArticleId !== undefined ? {
2318
+ equals: item.newsArticleId
2319
+ } : undefined,
2144
2320
  },
2145
2321
  create: {
2146
2322
  url: item.url !== undefined ? item.url : undefined,
@@ -2190,6 +2366,9 @@ export const Position = {
2190
2366
  id: props.alpacaAccount.id !== undefined ? {
2191
2367
  equals: props.alpacaAccount.id
2192
2368
  } : undefined,
2369
+ userId: props.alpacaAccount.userId !== undefined ? {
2370
+ equals: props.alpacaAccount.userId
2371
+ } : undefined,
2193
2372
  },
2194
2373
  update: {
2195
2374
  id: props.alpacaAccount.id !== undefined ? {
@@ -2278,9 +2457,21 @@ export const Position = {
2278
2457
  id: props.alpacaAccount.user.customer.id !== undefined ? {
2279
2458
  equals: props.alpacaAccount.user.customer.id
2280
2459
  } : undefined,
2460
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2461
+ equals: props.alpacaAccount.user.customer.authUserId
2462
+ } : undefined,
2281
2463
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2282
2464
  equals: props.alpacaAccount.user.customer.name
2283
2465
  } : undefined,
2466
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
2467
+ equals: props.alpacaAccount.user.customer.stripeCustomerId
2468
+ } : undefined,
2469
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
2470
+ equals: props.alpacaAccount.user.customer.stripeSubscriptionId
2471
+ } : undefined,
2472
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2473
+ equals: props.alpacaAccount.user.customer.stripePriceId
2474
+ } : undefined,
2284
2475
  },
2285
2476
  update: {
2286
2477
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -2320,6 +2511,12 @@ export const Position = {
2320
2511
  upsert: props.alpacaAccount.user.accounts.map((item) => ({
2321
2512
  where: {
2322
2513
  id: item.id !== undefined ? item.id : undefined,
2514
+ userId: item.userId !== undefined ? {
2515
+ equals: item.userId
2516
+ } : undefined,
2517
+ providerAccountId: item.providerAccountId !== undefined ? {
2518
+ equals: item.providerAccountId
2519
+ } : undefined,
2323
2520
  },
2324
2521
  update: {
2325
2522
  id: item.id !== undefined ? {
@@ -2374,6 +2571,9 @@ export const Position = {
2374
2571
  upsert: props.alpacaAccount.user.sessions.map((item) => ({
2375
2572
  where: {
2376
2573
  id: item.id !== undefined ? item.id : undefined,
2574
+ userId: item.userId !== undefined ? {
2575
+ equals: item.userId
2576
+ } : undefined,
2377
2577
  },
2378
2578
  update: {
2379
2579
  id: item.id !== undefined ? {
@@ -2396,6 +2596,9 @@ export const Position = {
2396
2596
  upsert: props.alpacaAccount.user.authenticators.map((item) => ({
2397
2597
  where: {
2398
2598
  id: item.id !== undefined ? item.id : undefined,
2599
+ userId: item.userId !== undefined ? {
2600
+ equals: item.userId
2601
+ } : undefined,
2399
2602
  },
2400
2603
  update: {
2401
2604
  id: item.id !== undefined ? {
@@ -2440,9 +2643,17 @@ export const Position = {
2440
2643
  : { connectOrCreate: {
2441
2644
  where: {
2442
2645
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
2646
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2647
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2648
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2649
+ equals: props.alpacaAccount.user.customer.authUserId
2650
+ } : undefined,
2443
2651
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2444
2652
  equals: props.alpacaAccount.user.customer.name
2445
2653
  } : undefined,
2654
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2655
+ equals: props.alpacaAccount.user.customer.stripePriceId
2656
+ } : undefined,
2446
2657
  },
2447
2658
  create: {
2448
2659
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -2464,6 +2675,12 @@ export const Position = {
2464
2675
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
2465
2676
  where: {
2466
2677
  id: item.id !== undefined ? item.id : undefined,
2678
+ userId: item.userId !== undefined ? {
2679
+ equals: item.userId
2680
+ } : undefined,
2681
+ providerAccountId: item.providerAccountId !== undefined ? {
2682
+ equals: item.providerAccountId
2683
+ } : undefined,
2467
2684
  },
2468
2685
  create: {
2469
2686
  type: item.type !== undefined ? item.type : undefined,
@@ -2488,6 +2705,9 @@ export const Position = {
2488
2705
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
2489
2706
  where: {
2490
2707
  id: item.id !== undefined ? item.id : undefined,
2708
+ userId: item.userId !== undefined ? {
2709
+ equals: item.userId
2710
+ } : undefined,
2491
2711
  },
2492
2712
  create: {
2493
2713
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -2504,6 +2724,9 @@ export const Position = {
2504
2724
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
2505
2725
  where: {
2506
2726
  id: item.id !== undefined ? item.id : undefined,
2727
+ userId: item.userId !== undefined ? {
2728
+ equals: item.userId
2729
+ } : undefined,
2507
2730
  },
2508
2731
  create: {
2509
2732
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -2519,6 +2742,12 @@ export const Position = {
2519
2742
  upsert: props.alpacaAccount.trades.map((item) => ({
2520
2743
  where: {
2521
2744
  id: item.id !== undefined ? item.id : undefined,
2745
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2746
+ equals: item.alpacaAccountId
2747
+ } : undefined,
2748
+ assetId: item.assetId !== undefined ? {
2749
+ equals: item.assetId
2750
+ } : undefined,
2522
2751
  },
2523
2752
  update: {
2524
2753
  id: item.id !== undefined ? {
@@ -2803,6 +3032,9 @@ export const Position = {
2803
3032
  upsert: item.actions.map((item) => ({
2804
3033
  where: {
2805
3034
  id: item.id !== undefined ? item.id : undefined,
3035
+ tradeId: item.tradeId !== undefined ? {
3036
+ equals: item.tradeId
3037
+ } : undefined,
2806
3038
  },
2807
3039
  update: {
2808
3040
  id: item.id !== undefined ? {
@@ -2926,6 +3158,9 @@ export const Position = {
2926
3158
  : { connectOrCreate: item.actions.map((item) => ({
2927
3159
  where: {
2928
3160
  id: item.id !== undefined ? item.id : undefined,
3161
+ tradeId: item.tradeId !== undefined ? {
3162
+ equals: item.tradeId
3163
+ } : undefined,
2929
3164
  },
2930
3165
  create: {
2931
3166
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2943,6 +3178,15 @@ export const Position = {
2943
3178
  upsert: props.alpacaAccount.orders.map((item) => ({
2944
3179
  where: {
2945
3180
  id: item.id !== undefined ? item.id : undefined,
3181
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3182
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3183
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3184
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3185
+ equals: item.alpacaAccountId
3186
+ } : undefined,
3187
+ assetId: item.assetId !== undefined ? {
3188
+ equals: item.assetId
3189
+ } : undefined,
2946
3190
  },
2947
3191
  update: {
2948
3192
  id: item.id !== undefined ? {
@@ -3020,6 +3264,9 @@ export const Position = {
3020
3264
  id: item.stopLoss.id !== undefined ? {
3021
3265
  equals: item.stopLoss.id
3022
3266
  } : undefined,
3267
+ orderId: item.stopLoss.orderId !== undefined ? {
3268
+ equals: item.stopLoss.orderId
3269
+ } : undefined,
3023
3270
  },
3024
3271
  update: {
3025
3272
  id: item.stopLoss.id !== undefined ? {
@@ -3044,6 +3291,9 @@ export const Position = {
3044
3291
  id: item.takeProfit.id !== undefined ? {
3045
3292
  equals: item.takeProfit.id
3046
3293
  } : undefined,
3294
+ orderId: item.takeProfit.orderId !== undefined ? {
3295
+ equals: item.takeProfit.orderId
3296
+ } : undefined,
3047
3297
  },
3048
3298
  update: {
3049
3299
  id: item.takeProfit.id !== undefined ? {
@@ -3068,6 +3318,9 @@ export const Position = {
3068
3318
  id: item.action.id !== undefined ? {
3069
3319
  equals: item.action.id
3070
3320
  } : undefined,
3321
+ tradeId: item.action.tradeId !== undefined ? {
3322
+ equals: item.action.tradeId
3323
+ } : undefined,
3071
3324
  },
3072
3325
  update: {
3073
3326
  id: item.action.id !== undefined ? {
@@ -3373,6 +3626,7 @@ export const Position = {
3373
3626
  : { connectOrCreate: {
3374
3627
  where: {
3375
3628
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3629
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3376
3630
  },
3377
3631
  create: {
3378
3632
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3389,6 +3643,7 @@ export const Position = {
3389
3643
  : { connectOrCreate: {
3390
3644
  where: {
3391
3645
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3646
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3392
3647
  },
3393
3648
  create: {
3394
3649
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3405,6 +3660,9 @@ export const Position = {
3405
3660
  : { connectOrCreate: {
3406
3661
  where: {
3407
3662
  id: item.action.id !== undefined ? item.action.id : undefined,
3663
+ tradeId: item.action.tradeId !== undefined ? {
3664
+ equals: item.action.tradeId
3665
+ } : undefined,
3408
3666
  },
3409
3667
  create: {
3410
3668
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3493,6 +3751,9 @@ export const Position = {
3493
3751
  upsert: props.alpacaAccount.alerts.map((item) => ({
3494
3752
  where: {
3495
3753
  id: item.id !== undefined ? item.id : undefined,
3754
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3755
+ equals: item.alpacaAccountId
3756
+ } : undefined,
3496
3757
  },
3497
3758
  update: {
3498
3759
  id: item.id !== undefined ? {
@@ -3561,9 +3822,17 @@ export const Position = {
3561
3822
  : { connectOrCreate: {
3562
3823
  where: {
3563
3824
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
3825
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
3826
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
3827
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
3828
+ equals: props.alpacaAccount.user.customer.authUserId
3829
+ } : undefined,
3564
3830
  name: props.alpacaAccount.user.customer.name !== undefined ? {
3565
3831
  equals: props.alpacaAccount.user.customer.name
3566
3832
  } : undefined,
3833
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
3834
+ equals: props.alpacaAccount.user.customer.stripePriceId
3835
+ } : undefined,
3567
3836
  },
3568
3837
  create: {
3569
3838
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -3585,6 +3854,12 @@ export const Position = {
3585
3854
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
3586
3855
  where: {
3587
3856
  id: item.id !== undefined ? item.id : undefined,
3857
+ userId: item.userId !== undefined ? {
3858
+ equals: item.userId
3859
+ } : undefined,
3860
+ providerAccountId: item.providerAccountId !== undefined ? {
3861
+ equals: item.providerAccountId
3862
+ } : undefined,
3588
3863
  },
3589
3864
  create: {
3590
3865
  type: item.type !== undefined ? item.type : undefined,
@@ -3609,6 +3884,9 @@ export const Position = {
3609
3884
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
3610
3885
  where: {
3611
3886
  id: item.id !== undefined ? item.id : undefined,
3887
+ userId: item.userId !== undefined ? {
3888
+ equals: item.userId
3889
+ } : undefined,
3612
3890
  },
3613
3891
  create: {
3614
3892
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -3625,6 +3903,9 @@ export const Position = {
3625
3903
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
3626
3904
  where: {
3627
3905
  id: item.id !== undefined ? item.id : undefined,
3906
+ userId: item.userId !== undefined ? {
3907
+ equals: item.userId
3908
+ } : undefined,
3628
3909
  },
3629
3910
  create: {
3630
3911
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -3645,6 +3926,12 @@ export const Position = {
3645
3926
  : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
3646
3927
  where: {
3647
3928
  id: item.id !== undefined ? item.id : undefined,
3929
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3930
+ equals: item.alpacaAccountId
3931
+ } : undefined,
3932
+ assetId: item.assetId !== undefined ? {
3933
+ equals: item.assetId
3934
+ } : undefined,
3648
3935
  },
3649
3936
  create: {
3650
3937
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -3738,6 +4025,9 @@ export const Position = {
3738
4025
  : { connectOrCreate: item.actions.map((item) => ({
3739
4026
  where: {
3740
4027
  id: item.id !== undefined ? item.id : undefined,
4028
+ tradeId: item.tradeId !== undefined ? {
4029
+ equals: item.tradeId
4030
+ } : undefined,
3741
4031
  },
3742
4032
  create: {
3743
4033
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -3760,6 +4050,15 @@ export const Position = {
3760
4050
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
3761
4051
  where: {
3762
4052
  id: item.id !== undefined ? item.id : undefined,
4053
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4054
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4055
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4056
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4057
+ equals: item.alpacaAccountId
4058
+ } : undefined,
4059
+ assetId: item.assetId !== undefined ? {
4060
+ equals: item.assetId
4061
+ } : undefined,
3763
4062
  },
3764
4063
  create: {
3765
4064
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3793,6 +4092,7 @@ export const Position = {
3793
4092
  : { connectOrCreate: {
3794
4093
  where: {
3795
4094
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4095
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3796
4096
  },
3797
4097
  create: {
3798
4098
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3809,6 +4109,7 @@ export const Position = {
3809
4109
  : { connectOrCreate: {
3810
4110
  where: {
3811
4111
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
4112
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3812
4113
  },
3813
4114
  create: {
3814
4115
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3825,6 +4126,9 @@ export const Position = {
3825
4126
  : { connectOrCreate: {
3826
4127
  where: {
3827
4128
  id: item.action.id !== undefined ? item.action.id : undefined,
4129
+ tradeId: item.action.tradeId !== undefined ? {
4130
+ equals: item.action.tradeId
4131
+ } : undefined,
3828
4132
  },
3829
4133
  create: {
3830
4134
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3918,6 +4222,9 @@ export const Position = {
3918
4222
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
3919
4223
  where: {
3920
4224
  id: item.id !== undefined ? item.id : undefined,
4225
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4226
+ equals: item.alpacaAccountId
4227
+ } : undefined,
3921
4228
  },
3922
4229
  create: {
3923
4230
  message: item.message !== undefined ? item.message : undefined,
@@ -3964,7 +4271,9 @@ export const Position = {
3964
4271
  const variables = props.map(prop => ({
3965
4272
  where: {
3966
4273
  id: prop.id !== undefined ? prop.id : undefined,
3967
- assetId: prop.assetId !== undefined ? prop.assetId : undefined,
4274
+ assetId: prop.assetId !== undefined ? {
4275
+ equals: prop.assetId
4276
+ } : undefined,
3968
4277
  averageEntryPrice: prop.averageEntryPrice !== undefined ? prop.averageEntryPrice : undefined,
3969
4278
  qty: prop.qty !== undefined ? prop.qty : undefined,
3970
4279
  qtyAvailable: prop.qtyAvailable !== undefined ? prop.qtyAvailable : undefined,
@@ -3977,7 +4286,9 @@ export const Position = {
3977
4286
  currentPrice: prop.currentPrice !== undefined ? prop.currentPrice : undefined,
3978
4287
  lastTradePrice: prop.lastTradePrice !== undefined ? prop.lastTradePrice : undefined,
3979
4288
  changeToday: prop.changeToday !== undefined ? prop.changeToday : undefined,
3980
- alpacaAccountId: prop.alpacaAccountId !== undefined ? prop.alpacaAccountId : undefined,
4289
+ alpacaAccountId: prop.alpacaAccountId !== undefined ? {
4290
+ equals: prop.alpacaAccountId
4291
+ } : undefined,
3981
4292
  },
3982
4293
  data: {
3983
4294
  id: prop.id !== undefined ? {
@@ -4208,6 +4519,12 @@ export const Position = {
4208
4519
  upsert: prop.asset.trades.map((item) => ({
4209
4520
  where: {
4210
4521
  id: item.id !== undefined ? item.id : undefined,
4522
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4523
+ equals: item.alpacaAccountId
4524
+ } : undefined,
4525
+ assetId: item.assetId !== undefined ? {
4526
+ equals: item.assetId
4527
+ } : undefined,
4211
4528
  },
4212
4529
  update: {
4213
4530
  id: item.id !== undefined ? {
@@ -4252,6 +4569,9 @@ export const Position = {
4252
4569
  id: item.alpacaAccount.id !== undefined ? {
4253
4570
  equals: item.alpacaAccount.id
4254
4571
  } : undefined,
4572
+ userId: item.alpacaAccount.userId !== undefined ? {
4573
+ equals: item.alpacaAccount.userId
4574
+ } : undefined,
4255
4575
  },
4256
4576
  update: {
4257
4577
  id: item.alpacaAccount.id !== undefined ? {
@@ -4302,6 +4622,9 @@ export const Position = {
4302
4622
  upsert: item.actions.map((item) => ({
4303
4623
  where: {
4304
4624
  id: item.id !== undefined ? item.id : undefined,
4625
+ tradeId: item.tradeId !== undefined ? {
4626
+ equals: item.tradeId
4627
+ } : undefined,
4305
4628
  },
4306
4629
  update: {
4307
4630
  id: item.id !== undefined ? {
@@ -4354,6 +4677,9 @@ export const Position = {
4354
4677
  : { connectOrCreate: {
4355
4678
  where: {
4356
4679
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4680
+ userId: item.alpacaAccount.userId !== undefined ? {
4681
+ equals: item.alpacaAccount.userId
4682
+ } : undefined,
4357
4683
  },
4358
4684
  create: {
4359
4685
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4377,6 +4703,9 @@ export const Position = {
4377
4703
  : { connectOrCreate: item.actions.map((item) => ({
4378
4704
  where: {
4379
4705
  id: item.id !== undefined ? item.id : undefined,
4706
+ tradeId: item.tradeId !== undefined ? {
4707
+ equals: item.tradeId
4708
+ } : undefined,
4380
4709
  },
4381
4710
  create: {
4382
4711
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4394,6 +4723,15 @@ export const Position = {
4394
4723
  upsert: prop.asset.orders.map((item) => ({
4395
4724
  where: {
4396
4725
  id: item.id !== undefined ? item.id : undefined,
4726
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4727
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4728
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4729
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4730
+ equals: item.alpacaAccountId
4731
+ } : undefined,
4732
+ assetId: item.assetId !== undefined ? {
4733
+ equals: item.assetId
4734
+ } : undefined,
4397
4735
  },
4398
4736
  update: {
4399
4737
  id: item.id !== undefined ? {
@@ -4471,6 +4809,9 @@ export const Position = {
4471
4809
  id: item.stopLoss.id !== undefined ? {
4472
4810
  equals: item.stopLoss.id
4473
4811
  } : undefined,
4812
+ orderId: item.stopLoss.orderId !== undefined ? {
4813
+ equals: item.stopLoss.orderId
4814
+ } : undefined,
4474
4815
  },
4475
4816
  update: {
4476
4817
  id: item.stopLoss.id !== undefined ? {
@@ -4495,6 +4836,9 @@ export const Position = {
4495
4836
  id: item.takeProfit.id !== undefined ? {
4496
4837
  equals: item.takeProfit.id
4497
4838
  } : undefined,
4839
+ orderId: item.takeProfit.orderId !== undefined ? {
4840
+ equals: item.takeProfit.orderId
4841
+ } : undefined,
4498
4842
  },
4499
4843
  update: {
4500
4844
  id: item.takeProfit.id !== undefined ? {
@@ -4519,6 +4863,9 @@ export const Position = {
4519
4863
  id: item.alpacaAccount.id !== undefined ? {
4520
4864
  equals: item.alpacaAccount.id
4521
4865
  } : undefined,
4866
+ userId: item.alpacaAccount.userId !== undefined ? {
4867
+ equals: item.alpacaAccount.userId
4868
+ } : undefined,
4522
4869
  },
4523
4870
  update: {
4524
4871
  id: item.alpacaAccount.id !== undefined ? {
@@ -4571,6 +4918,9 @@ export const Position = {
4571
4918
  id: item.action.id !== undefined ? {
4572
4919
  equals: item.action.id
4573
4920
  } : undefined,
4921
+ tradeId: item.action.tradeId !== undefined ? {
4922
+ equals: item.action.tradeId
4923
+ } : undefined,
4574
4924
  },
4575
4925
  update: {
4576
4926
  id: item.action.id !== undefined ? {
@@ -4634,6 +4984,7 @@ export const Position = {
4634
4984
  : { connectOrCreate: {
4635
4985
  where: {
4636
4986
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4987
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
4637
4988
  },
4638
4989
  create: {
4639
4990
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -4650,6 +5001,7 @@ export const Position = {
4650
5001
  : { connectOrCreate: {
4651
5002
  where: {
4652
5003
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
5004
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
4653
5005
  },
4654
5006
  create: {
4655
5007
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -4666,6 +5018,9 @@ export const Position = {
4666
5018
  : { connectOrCreate: {
4667
5019
  where: {
4668
5020
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5021
+ userId: item.alpacaAccount.userId !== undefined ? {
5022
+ equals: item.alpacaAccount.userId
5023
+ } : undefined,
4669
5024
  },
4670
5025
  create: {
4671
5026
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4689,6 +5044,9 @@ export const Position = {
4689
5044
  : { connectOrCreate: {
4690
5045
  where: {
4691
5046
  id: item.action.id !== undefined ? item.action.id : undefined,
5047
+ tradeId: item.action.tradeId !== undefined ? {
5048
+ equals: item.action.tradeId
5049
+ } : undefined,
4692
5050
  },
4693
5051
  create: {
4694
5052
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -4707,6 +5065,12 @@ export const Position = {
4707
5065
  where: {
4708
5066
  id: item.id !== undefined ? item.id : undefined,
4709
5067
  url: item.url !== undefined ? item.url : undefined,
5068
+ assetId: item.assetId !== undefined ? {
5069
+ equals: item.assetId
5070
+ } : undefined,
5071
+ newsArticleId: item.newsArticleId !== undefined ? {
5072
+ equals: item.newsArticleId
5073
+ } : undefined,
4710
5074
  },
4711
5075
  update: {
4712
5076
  id: item.id !== undefined ? {
@@ -4904,6 +5268,12 @@ export const Position = {
4904
5268
  : { connectOrCreate: prop.asset.trades.map((item) => ({
4905
5269
  where: {
4906
5270
  id: item.id !== undefined ? item.id : undefined,
5271
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5272
+ equals: item.alpacaAccountId
5273
+ } : undefined,
5274
+ assetId: item.assetId !== undefined ? {
5275
+ equals: item.assetId
5276
+ } : undefined,
4907
5277
  },
4908
5278
  create: {
4909
5279
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -4926,6 +5296,9 @@ export const Position = {
4926
5296
  : { connectOrCreate: {
4927
5297
  where: {
4928
5298
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5299
+ userId: item.alpacaAccount.userId !== undefined ? {
5300
+ equals: item.alpacaAccount.userId
5301
+ } : undefined,
4929
5302
  },
4930
5303
  create: {
4931
5304
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4949,6 +5322,9 @@ export const Position = {
4949
5322
  : { connectOrCreate: item.actions.map((item) => ({
4950
5323
  where: {
4951
5324
  id: item.id !== undefined ? item.id : undefined,
5325
+ tradeId: item.tradeId !== undefined ? {
5326
+ equals: item.tradeId
5327
+ } : undefined,
4952
5328
  },
4953
5329
  create: {
4954
5330
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4971,6 +5347,15 @@ export const Position = {
4971
5347
  : { connectOrCreate: prop.asset.orders.map((item) => ({
4972
5348
  where: {
4973
5349
  id: item.id !== undefined ? item.id : undefined,
5350
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5351
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5352
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5353
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5354
+ equals: item.alpacaAccountId
5355
+ } : undefined,
5356
+ assetId: item.assetId !== undefined ? {
5357
+ equals: item.assetId
5358
+ } : undefined,
4974
5359
  },
4975
5360
  create: {
4976
5361
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -5004,6 +5389,7 @@ export const Position = {
5004
5389
  : { connectOrCreate: {
5005
5390
  where: {
5006
5391
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
5392
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
5007
5393
  },
5008
5394
  create: {
5009
5395
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -5020,6 +5406,7 @@ export const Position = {
5020
5406
  : { connectOrCreate: {
5021
5407
  where: {
5022
5408
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
5409
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
5023
5410
  },
5024
5411
  create: {
5025
5412
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -5036,6 +5423,9 @@ export const Position = {
5036
5423
  : { connectOrCreate: {
5037
5424
  where: {
5038
5425
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5426
+ userId: item.alpacaAccount.userId !== undefined ? {
5427
+ equals: item.alpacaAccount.userId
5428
+ } : undefined,
5039
5429
  },
5040
5430
  create: {
5041
5431
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -5059,6 +5449,9 @@ export const Position = {
5059
5449
  : { connectOrCreate: {
5060
5450
  where: {
5061
5451
  id: item.action.id !== undefined ? item.action.id : undefined,
5452
+ tradeId: item.action.tradeId !== undefined ? {
5453
+ equals: item.action.tradeId
5454
+ } : undefined,
5062
5455
  },
5063
5456
  create: {
5064
5457
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -5082,6 +5475,12 @@ export const Position = {
5082
5475
  where: {
5083
5476
  id: item.id !== undefined ? item.id : undefined,
5084
5477
  url: item.url !== undefined ? item.url : undefined,
5478
+ assetId: item.assetId !== undefined ? {
5479
+ equals: item.assetId
5480
+ } : undefined,
5481
+ newsArticleId: item.newsArticleId !== undefined ? {
5482
+ equals: item.newsArticleId
5483
+ } : undefined,
5085
5484
  },
5086
5485
  create: {
5087
5486
  url: item.url !== undefined ? item.url : undefined,
@@ -5131,6 +5530,9 @@ export const Position = {
5131
5530
  id: prop.alpacaAccount.id !== undefined ? {
5132
5531
  equals: prop.alpacaAccount.id
5133
5532
  } : undefined,
5533
+ userId: prop.alpacaAccount.userId !== undefined ? {
5534
+ equals: prop.alpacaAccount.userId
5535
+ } : undefined,
5134
5536
  },
5135
5537
  update: {
5136
5538
  id: prop.alpacaAccount.id !== undefined ? {
@@ -5219,9 +5621,21 @@ export const Position = {
5219
5621
  id: prop.alpacaAccount.user.customer.id !== undefined ? {
5220
5622
  equals: prop.alpacaAccount.user.customer.id
5221
5623
  } : undefined,
5624
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5625
+ equals: prop.alpacaAccount.user.customer.authUserId
5626
+ } : undefined,
5222
5627
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5223
5628
  equals: prop.alpacaAccount.user.customer.name
5224
5629
  } : undefined,
5630
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
5631
+ equals: prop.alpacaAccount.user.customer.stripeCustomerId
5632
+ } : undefined,
5633
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
5634
+ equals: prop.alpacaAccount.user.customer.stripeSubscriptionId
5635
+ } : undefined,
5636
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5637
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5638
+ } : undefined,
5225
5639
  },
5226
5640
  update: {
5227
5641
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -5261,6 +5675,12 @@ export const Position = {
5261
5675
  upsert: prop.alpacaAccount.user.accounts.map((item) => ({
5262
5676
  where: {
5263
5677
  id: item.id !== undefined ? item.id : undefined,
5678
+ userId: item.userId !== undefined ? {
5679
+ equals: item.userId
5680
+ } : undefined,
5681
+ providerAccountId: item.providerAccountId !== undefined ? {
5682
+ equals: item.providerAccountId
5683
+ } : undefined,
5264
5684
  },
5265
5685
  update: {
5266
5686
  id: item.id !== undefined ? {
@@ -5315,6 +5735,9 @@ export const Position = {
5315
5735
  upsert: prop.alpacaAccount.user.sessions.map((item) => ({
5316
5736
  where: {
5317
5737
  id: item.id !== undefined ? item.id : undefined,
5738
+ userId: item.userId !== undefined ? {
5739
+ equals: item.userId
5740
+ } : undefined,
5318
5741
  },
5319
5742
  update: {
5320
5743
  id: item.id !== undefined ? {
@@ -5337,6 +5760,9 @@ export const Position = {
5337
5760
  upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
5338
5761
  where: {
5339
5762
  id: item.id !== undefined ? item.id : undefined,
5763
+ userId: item.userId !== undefined ? {
5764
+ equals: item.userId
5765
+ } : undefined,
5340
5766
  },
5341
5767
  update: {
5342
5768
  id: item.id !== undefined ? {
@@ -5381,9 +5807,17 @@ export const Position = {
5381
5807
  : { connectOrCreate: {
5382
5808
  where: {
5383
5809
  id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
5810
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
5811
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
5812
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5813
+ equals: prop.alpacaAccount.user.customer.authUserId
5814
+ } : undefined,
5384
5815
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5385
5816
  equals: prop.alpacaAccount.user.customer.name
5386
5817
  } : undefined,
5818
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5819
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5820
+ } : undefined,
5387
5821
  },
5388
5822
  create: {
5389
5823
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -5405,6 +5839,12 @@ export const Position = {
5405
5839
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
5406
5840
  where: {
5407
5841
  id: item.id !== undefined ? item.id : undefined,
5842
+ userId: item.userId !== undefined ? {
5843
+ equals: item.userId
5844
+ } : undefined,
5845
+ providerAccountId: item.providerAccountId !== undefined ? {
5846
+ equals: item.providerAccountId
5847
+ } : undefined,
5408
5848
  },
5409
5849
  create: {
5410
5850
  type: item.type !== undefined ? item.type : undefined,
@@ -5429,6 +5869,9 @@ export const Position = {
5429
5869
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
5430
5870
  where: {
5431
5871
  id: item.id !== undefined ? item.id : undefined,
5872
+ userId: item.userId !== undefined ? {
5873
+ equals: item.userId
5874
+ } : undefined,
5432
5875
  },
5433
5876
  create: {
5434
5877
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -5445,6 +5888,9 @@ export const Position = {
5445
5888
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
5446
5889
  where: {
5447
5890
  id: item.id !== undefined ? item.id : undefined,
5891
+ userId: item.userId !== undefined ? {
5892
+ equals: item.userId
5893
+ } : undefined,
5448
5894
  },
5449
5895
  create: {
5450
5896
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -5460,6 +5906,12 @@ export const Position = {
5460
5906
  upsert: prop.alpacaAccount.trades.map((item) => ({
5461
5907
  where: {
5462
5908
  id: item.id !== undefined ? item.id : undefined,
5909
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5910
+ equals: item.alpacaAccountId
5911
+ } : undefined,
5912
+ assetId: item.assetId !== undefined ? {
5913
+ equals: item.assetId
5914
+ } : undefined,
5463
5915
  },
5464
5916
  update: {
5465
5917
  id: item.id !== undefined ? {
@@ -5744,6 +6196,9 @@ export const Position = {
5744
6196
  upsert: item.actions.map((item) => ({
5745
6197
  where: {
5746
6198
  id: item.id !== undefined ? item.id : undefined,
6199
+ tradeId: item.tradeId !== undefined ? {
6200
+ equals: item.tradeId
6201
+ } : undefined,
5747
6202
  },
5748
6203
  update: {
5749
6204
  id: item.id !== undefined ? {
@@ -5867,6 +6322,9 @@ export const Position = {
5867
6322
  : { connectOrCreate: item.actions.map((item) => ({
5868
6323
  where: {
5869
6324
  id: item.id !== undefined ? item.id : undefined,
6325
+ tradeId: item.tradeId !== undefined ? {
6326
+ equals: item.tradeId
6327
+ } : undefined,
5870
6328
  },
5871
6329
  create: {
5872
6330
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -5884,6 +6342,15 @@ export const Position = {
5884
6342
  upsert: prop.alpacaAccount.orders.map((item) => ({
5885
6343
  where: {
5886
6344
  id: item.id !== undefined ? item.id : undefined,
6345
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6346
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6347
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6348
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6349
+ equals: item.alpacaAccountId
6350
+ } : undefined,
6351
+ assetId: item.assetId !== undefined ? {
6352
+ equals: item.assetId
6353
+ } : undefined,
5887
6354
  },
5888
6355
  update: {
5889
6356
  id: item.id !== undefined ? {
@@ -5961,6 +6428,9 @@ export const Position = {
5961
6428
  id: item.stopLoss.id !== undefined ? {
5962
6429
  equals: item.stopLoss.id
5963
6430
  } : undefined,
6431
+ orderId: item.stopLoss.orderId !== undefined ? {
6432
+ equals: item.stopLoss.orderId
6433
+ } : undefined,
5964
6434
  },
5965
6435
  update: {
5966
6436
  id: item.stopLoss.id !== undefined ? {
@@ -5985,6 +6455,9 @@ export const Position = {
5985
6455
  id: item.takeProfit.id !== undefined ? {
5986
6456
  equals: item.takeProfit.id
5987
6457
  } : undefined,
6458
+ orderId: item.takeProfit.orderId !== undefined ? {
6459
+ equals: item.takeProfit.orderId
6460
+ } : undefined,
5988
6461
  },
5989
6462
  update: {
5990
6463
  id: item.takeProfit.id !== undefined ? {
@@ -6009,6 +6482,9 @@ export const Position = {
6009
6482
  id: item.action.id !== undefined ? {
6010
6483
  equals: item.action.id
6011
6484
  } : undefined,
6485
+ tradeId: item.action.tradeId !== undefined ? {
6486
+ equals: item.action.tradeId
6487
+ } : undefined,
6012
6488
  },
6013
6489
  update: {
6014
6490
  id: item.action.id !== undefined ? {
@@ -6314,6 +6790,7 @@ export const Position = {
6314
6790
  : { connectOrCreate: {
6315
6791
  where: {
6316
6792
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
6793
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6317
6794
  },
6318
6795
  create: {
6319
6796
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6330,6 +6807,7 @@ export const Position = {
6330
6807
  : { connectOrCreate: {
6331
6808
  where: {
6332
6809
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
6810
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6333
6811
  },
6334
6812
  create: {
6335
6813
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6346,6 +6824,9 @@ export const Position = {
6346
6824
  : { connectOrCreate: {
6347
6825
  where: {
6348
6826
  id: item.action.id !== undefined ? item.action.id : undefined,
6827
+ tradeId: item.action.tradeId !== undefined ? {
6828
+ equals: item.action.tradeId
6829
+ } : undefined,
6349
6830
  },
6350
6831
  create: {
6351
6832
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6434,6 +6915,9 @@ export const Position = {
6434
6915
  upsert: prop.alpacaAccount.alerts.map((item) => ({
6435
6916
  where: {
6436
6917
  id: item.id !== undefined ? item.id : undefined,
6918
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6919
+ equals: item.alpacaAccountId
6920
+ } : undefined,
6437
6921
  },
6438
6922
  update: {
6439
6923
  id: item.id !== undefined ? {
@@ -6502,9 +6986,17 @@ export const Position = {
6502
6986
  : { connectOrCreate: {
6503
6987
  where: {
6504
6988
  id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
6989
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
6990
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
6991
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
6992
+ equals: prop.alpacaAccount.user.customer.authUserId
6993
+ } : undefined,
6505
6994
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
6506
6995
  equals: prop.alpacaAccount.user.customer.name
6507
6996
  } : undefined,
6997
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
6998
+ equals: prop.alpacaAccount.user.customer.stripePriceId
6999
+ } : undefined,
6508
7000
  },
6509
7001
  create: {
6510
7002
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -6526,6 +7018,12 @@ export const Position = {
6526
7018
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
6527
7019
  where: {
6528
7020
  id: item.id !== undefined ? item.id : undefined,
7021
+ userId: item.userId !== undefined ? {
7022
+ equals: item.userId
7023
+ } : undefined,
7024
+ providerAccountId: item.providerAccountId !== undefined ? {
7025
+ equals: item.providerAccountId
7026
+ } : undefined,
6529
7027
  },
6530
7028
  create: {
6531
7029
  type: item.type !== undefined ? item.type : undefined,
@@ -6550,6 +7048,9 @@ export const Position = {
6550
7048
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
6551
7049
  where: {
6552
7050
  id: item.id !== undefined ? item.id : undefined,
7051
+ userId: item.userId !== undefined ? {
7052
+ equals: item.userId
7053
+ } : undefined,
6553
7054
  },
6554
7055
  create: {
6555
7056
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -6566,6 +7067,9 @@ export const Position = {
6566
7067
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
6567
7068
  where: {
6568
7069
  id: item.id !== undefined ? item.id : undefined,
7070
+ userId: item.userId !== undefined ? {
7071
+ equals: item.userId
7072
+ } : undefined,
6569
7073
  },
6570
7074
  create: {
6571
7075
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -6586,6 +7090,12 @@ export const Position = {
6586
7090
  : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
6587
7091
  where: {
6588
7092
  id: item.id !== undefined ? item.id : undefined,
7093
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7094
+ equals: item.alpacaAccountId
7095
+ } : undefined,
7096
+ assetId: item.assetId !== undefined ? {
7097
+ equals: item.assetId
7098
+ } : undefined,
6589
7099
  },
6590
7100
  create: {
6591
7101
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -6679,6 +7189,9 @@ export const Position = {
6679
7189
  : { connectOrCreate: item.actions.map((item) => ({
6680
7190
  where: {
6681
7191
  id: item.id !== undefined ? item.id : undefined,
7192
+ tradeId: item.tradeId !== undefined ? {
7193
+ equals: item.tradeId
7194
+ } : undefined,
6682
7195
  },
6683
7196
  create: {
6684
7197
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -6701,6 +7214,15 @@ export const Position = {
6701
7214
  : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
6702
7215
  where: {
6703
7216
  id: item.id !== undefined ? item.id : undefined,
7217
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7218
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7219
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7220
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7221
+ equals: item.alpacaAccountId
7222
+ } : undefined,
7223
+ assetId: item.assetId !== undefined ? {
7224
+ equals: item.assetId
7225
+ } : undefined,
6704
7226
  },
6705
7227
  create: {
6706
7228
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6734,6 +7256,7 @@ export const Position = {
6734
7256
  : { connectOrCreate: {
6735
7257
  where: {
6736
7258
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7259
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6737
7260
  },
6738
7261
  create: {
6739
7262
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6750,6 +7273,7 @@ export const Position = {
6750
7273
  : { connectOrCreate: {
6751
7274
  where: {
6752
7275
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7276
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6753
7277
  },
6754
7278
  create: {
6755
7279
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6766,6 +7290,9 @@ export const Position = {
6766
7290
  : { connectOrCreate: {
6767
7291
  where: {
6768
7292
  id: item.action.id !== undefined ? item.action.id : undefined,
7293
+ tradeId: item.action.tradeId !== undefined ? {
7294
+ equals: item.action.tradeId
7295
+ } : undefined,
6769
7296
  },
6770
7297
  create: {
6771
7298
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6859,6 +7386,9 @@ export const Position = {
6859
7386
  : { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
6860
7387
  where: {
6861
7388
  id: item.id !== undefined ? item.id : undefined,
7389
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7390
+ equals: item.alpacaAccountId
7391
+ } : undefined,
6862
7392
  },
6863
7393
  create: {
6864
7394
  message: item.message !== undefined ? item.message : undefined,
@@ -6940,7 +7470,9 @@ export const Position = {
6940
7470
  const variables = {
6941
7471
  where: {
6942
7472
  id: props.id !== undefined ? props.id : undefined,
6943
- assetId: props.assetId !== undefined ? props.assetId : undefined,
7473
+ assetId: props.assetId !== undefined ? {
7474
+ equals: props.assetId
7475
+ } : undefined,
6944
7476
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
6945
7477
  qty: props.qty !== undefined ? props.qty : undefined,
6946
7478
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -6953,7 +7485,9 @@ export const Position = {
6953
7485
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
6954
7486
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
6955
7487
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
6956
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
7488
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
7489
+ equals: props.alpacaAccountId
7490
+ } : undefined,
6957
7491
  },
6958
7492
  };
6959
7493
  const filteredVariables = removeUndefinedProps(variables);
@@ -7019,7 +7553,9 @@ export const Position = {
7019
7553
  id: props.id !== undefined ? {
7020
7554
  equals: props.id
7021
7555
  } : undefined,
7022
- assetId: props.assetId !== undefined ? props.assetId : undefined,
7556
+ assetId: props.assetId !== undefined ? {
7557
+ equals: props.assetId
7558
+ } : undefined,
7023
7559
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
7024
7560
  qty: props.qty !== undefined ? props.qty : undefined,
7025
7561
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -7032,7 +7568,9 @@ export const Position = {
7032
7568
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
7033
7569
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
7034
7570
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
7035
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
7571
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
7572
+ equals: props.alpacaAccountId
7573
+ } : undefined,
7036
7574
  },
7037
7575
  };
7038
7576
  const filteredVariables = removeUndefinedProps(variables);