adaptic-backend 1.0.159 → 1.0.160

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 (73) hide show
  1. package/Account.cjs +435 -58
  2. package/Action.cjs +966 -121
  3. package/Alert.cjs +593 -89
  4. package/AlpacaAccount.cjs +1161 -134
  5. package/Asset.cjs +1029 -129
  6. package/Authenticator.cjs +438 -54
  7. package/Customer.cjs +435 -64
  8. package/EconomicEvent.cjs +9 -3
  9. package/NewsArticle.cjs +255 -30
  10. package/NewsArticleAssetSentiment.cjs +427 -65
  11. package/Order.cjs +867 -129
  12. package/Position.cjs +945 -141
  13. package/Session.cjs +438 -54
  14. package/StopLoss.cjs +552 -69
  15. package/TakeProfit.cjs +552 -69
  16. package/Trade.cjs +1042 -153
  17. package/User.cjs +480 -73
  18. package/VerificationToken.cjs +9 -3
  19. package/package.json +1 -1
  20. package/server/Account.d.ts.map +1 -1
  21. package/server/Account.js.map +1 -1
  22. package/server/Account.mjs +435 -58
  23. package/server/Action.d.ts.map +1 -1
  24. package/server/Action.js.map +1 -1
  25. package/server/Action.mjs +966 -121
  26. package/server/Alert.d.ts.map +1 -1
  27. package/server/Alert.js.map +1 -1
  28. package/server/Alert.mjs +593 -89
  29. package/server/AlpacaAccount.d.ts.map +1 -1
  30. package/server/AlpacaAccount.js.map +1 -1
  31. package/server/AlpacaAccount.mjs +1161 -134
  32. package/server/Asset.d.ts.map +1 -1
  33. package/server/Asset.js.map +1 -1
  34. package/server/Asset.mjs +1029 -129
  35. package/server/Authenticator.d.ts.map +1 -1
  36. package/server/Authenticator.js.map +1 -1
  37. package/server/Authenticator.mjs +438 -54
  38. package/server/Customer.d.ts.map +1 -1
  39. package/server/Customer.js.map +1 -1
  40. package/server/Customer.mjs +435 -64
  41. package/server/EconomicEvent.d.ts.map +1 -1
  42. package/server/EconomicEvent.js.map +1 -1
  43. package/server/EconomicEvent.mjs +9 -3
  44. package/server/NewsArticle.d.ts.map +1 -1
  45. package/server/NewsArticle.js.map +1 -1
  46. package/server/NewsArticle.mjs +255 -30
  47. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  48. package/server/NewsArticleAssetSentiment.js.map +1 -1
  49. package/server/NewsArticleAssetSentiment.mjs +427 -65
  50. package/server/Order.d.ts.map +1 -1
  51. package/server/Order.js.map +1 -1
  52. package/server/Order.mjs +867 -129
  53. package/server/Position.d.ts.map +1 -1
  54. package/server/Position.js.map +1 -1
  55. package/server/Position.mjs +945 -141
  56. package/server/Session.d.ts.map +1 -1
  57. package/server/Session.js.map +1 -1
  58. package/server/Session.mjs +438 -54
  59. package/server/StopLoss.d.ts.map +1 -1
  60. package/server/StopLoss.js.map +1 -1
  61. package/server/StopLoss.mjs +552 -69
  62. package/server/TakeProfit.d.ts.map +1 -1
  63. package/server/TakeProfit.js.map +1 -1
  64. package/server/TakeProfit.mjs +552 -69
  65. package/server/Trade.d.ts.map +1 -1
  66. package/server/Trade.js.map +1 -1
  67. package/server/Trade.mjs +1042 -153
  68. package/server/User.d.ts.map +1 -1
  69. package/server/User.js.map +1 -1
  70. package/server/User.mjs +480 -73
  71. package/server/VerificationToken.d.ts.map +1 -1
  72. package/server/VerificationToken.js.map +1 -1
  73. package/server/VerificationToken.mjs +9 -3
@@ -226,7 +226,9 @@ export const Position = {
226
226
  }
227
227
  : { connectOrCreate: {
228
228
  where: {
229
- id: props.asset.id !== undefined ? props.asset.id : undefined,
229
+ id: props.asset.id !== undefined ? {
230
+ equals: props.asset.id
231
+ } : undefined,
230
232
  symbol: props.asset.symbol !== undefined ? props.asset.symbol : undefined,
231
233
  name: props.asset.name !== undefined ? props.asset.name : undefined,
232
234
  },
@@ -294,7 +296,15 @@ export const Position = {
294
296
  }
295
297
  : { connectOrCreate: props.asset.trades.map((item) => ({
296
298
  where: {
297
- id: item.id !== undefined ? item.id : undefined,
299
+ id: item.id !== undefined ? {
300
+ equals: item.id
301
+ } : undefined,
302
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
303
+ equals: item.alpacaAccountId
304
+ } : undefined,
305
+ assetId: item.assetId !== undefined ? {
306
+ equals: item.assetId
307
+ } : undefined,
298
308
  },
299
309
  create: {
300
310
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -316,7 +326,12 @@ export const Position = {
316
326
  }
317
327
  : { connectOrCreate: {
318
328
  where: {
319
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
329
+ id: item.alpacaAccount.id !== undefined ? {
330
+ equals: item.alpacaAccount.id
331
+ } : undefined,
332
+ userId: item.alpacaAccount.userId !== undefined ? {
333
+ equals: item.alpacaAccount.userId
334
+ } : undefined,
320
335
  },
321
336
  create: {
322
337
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -339,7 +354,12 @@ export const Position = {
339
354
  }
340
355
  : { connectOrCreate: item.actions.map((item) => ({
341
356
  where: {
342
- id: item.id !== undefined ? item.id : undefined,
357
+ id: item.id !== undefined ? {
358
+ equals: item.id
359
+ } : undefined,
360
+ tradeId: item.tradeId !== undefined ? {
361
+ equals: item.tradeId
362
+ } : undefined,
343
363
  },
344
364
  create: {
345
365
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -361,7 +381,18 @@ export const Position = {
361
381
  }
362
382
  : { connectOrCreate: props.asset.orders.map((item) => ({
363
383
  where: {
364
- id: item.id !== undefined ? item.id : undefined,
384
+ id: item.id !== undefined ? {
385
+ equals: item.id
386
+ } : undefined,
387
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
388
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
389
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
390
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
391
+ equals: item.alpacaAccountId
392
+ } : undefined,
393
+ assetId: item.assetId !== undefined ? {
394
+ equals: item.assetId
395
+ } : undefined,
365
396
  },
366
397
  create: {
367
398
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -394,7 +425,10 @@ export const Position = {
394
425
  }
395
426
  : { connectOrCreate: {
396
427
  where: {
397
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
428
+ id: item.stopLoss.id !== undefined ? {
429
+ equals: item.stopLoss.id
430
+ } : undefined,
431
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
398
432
  },
399
433
  create: {
400
434
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -410,7 +444,10 @@ export const Position = {
410
444
  }
411
445
  : { connectOrCreate: {
412
446
  where: {
413
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
447
+ id: item.takeProfit.id !== undefined ? {
448
+ equals: item.takeProfit.id
449
+ } : undefined,
450
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
414
451
  },
415
452
  create: {
416
453
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -426,7 +463,12 @@ export const Position = {
426
463
  }
427
464
  : { connectOrCreate: {
428
465
  where: {
429
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
466
+ id: item.alpacaAccount.id !== undefined ? {
467
+ equals: item.alpacaAccount.id
468
+ } : undefined,
469
+ userId: item.alpacaAccount.userId !== undefined ? {
470
+ equals: item.alpacaAccount.userId
471
+ } : undefined,
430
472
  },
431
473
  create: {
432
474
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -449,7 +491,12 @@ export const Position = {
449
491
  }
450
492
  : { connectOrCreate: {
451
493
  where: {
452
- id: item.action.id !== undefined ? item.action.id : undefined,
494
+ id: item.action.id !== undefined ? {
495
+ equals: item.action.id
496
+ } : undefined,
497
+ tradeId: item.action.tradeId !== undefined ? {
498
+ equals: item.action.tradeId
499
+ } : undefined,
453
500
  },
454
501
  create: {
455
502
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -471,8 +518,16 @@ export const Position = {
471
518
  }
472
519
  : { connectOrCreate: props.asset.newsMentions.map((item) => ({
473
520
  where: {
474
- id: item.id !== undefined ? item.id : undefined,
521
+ id: item.id !== undefined ? {
522
+ equals: item.id
523
+ } : undefined,
475
524
  url: item.url !== undefined ? item.url : undefined,
525
+ assetId: item.assetId !== undefined ? {
526
+ equals: item.assetId
527
+ } : undefined,
528
+ newsArticleId: item.newsArticleId !== undefined ? {
529
+ equals: item.newsArticleId
530
+ } : undefined,
476
531
  },
477
532
  create: {
478
533
  url: item.url !== undefined ? item.url : undefined,
@@ -487,7 +542,9 @@ export const Position = {
487
542
  }
488
543
  : { connectOrCreate: {
489
544
  where: {
490
- id: item.news.id !== undefined ? item.news.id : undefined,
545
+ id: item.news.id !== undefined ? {
546
+ equals: item.news.id
547
+ } : undefined,
491
548
  url: item.news.url !== undefined ? item.news.url : undefined,
492
549
  title: item.news.title !== undefined ? {
493
550
  equals: item.news.title
@@ -524,7 +581,12 @@ export const Position = {
524
581
  }
525
582
  : { connectOrCreate: {
526
583
  where: {
527
- id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
584
+ id: props.alpacaAccount.id !== undefined ? {
585
+ equals: props.alpacaAccount.id
586
+ } : undefined,
587
+ userId: props.alpacaAccount.userId !== undefined ? {
588
+ equals: props.alpacaAccount.userId
589
+ } : undefined,
528
590
  },
529
591
  create: {
530
592
  type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
@@ -544,7 +606,9 @@ export const Position = {
544
606
  }
545
607
  : { connectOrCreate: {
546
608
  where: {
547
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
609
+ id: props.alpacaAccount.user.id !== undefined ? {
610
+ equals: props.alpacaAccount.user.id
611
+ } : undefined,
548
612
  email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
549
613
  name: props.alpacaAccount.user.name !== undefined ? {
550
614
  equals: props.alpacaAccount.user.name
@@ -570,10 +634,20 @@ export const Position = {
570
634
  }
571
635
  : { connectOrCreate: {
572
636
  where: {
573
- id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
637
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
638
+ equals: props.alpacaAccount.user.customer.id
639
+ } : undefined,
640
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
641
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
642
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
643
+ equals: props.alpacaAccount.user.customer.authUserId
644
+ } : undefined,
574
645
  name: props.alpacaAccount.user.customer.name !== undefined ? {
575
646
  equals: props.alpacaAccount.user.customer.name
576
647
  } : undefined,
648
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
649
+ equals: props.alpacaAccount.user.customer.stripePriceId
650
+ } : undefined,
577
651
  },
578
652
  create: {
579
653
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -594,7 +668,15 @@ export const Position = {
594
668
  }
595
669
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
596
670
  where: {
597
- id: item.id !== undefined ? item.id : undefined,
671
+ id: item.id !== undefined ? {
672
+ equals: item.id
673
+ } : undefined,
674
+ userId: item.userId !== undefined ? {
675
+ equals: item.userId
676
+ } : undefined,
677
+ providerAccountId: item.providerAccountId !== undefined ? {
678
+ equals: item.providerAccountId
679
+ } : undefined,
598
680
  },
599
681
  create: {
600
682
  type: item.type !== undefined ? item.type : undefined,
@@ -618,7 +700,12 @@ export const Position = {
618
700
  }
619
701
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
620
702
  where: {
621
- id: item.id !== undefined ? item.id : undefined,
703
+ id: item.id !== undefined ? {
704
+ equals: item.id
705
+ } : undefined,
706
+ userId: item.userId !== undefined ? {
707
+ equals: item.userId
708
+ } : undefined,
622
709
  },
623
710
  create: {
624
711
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -634,7 +721,12 @@ export const Position = {
634
721
  }
635
722
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
636
723
  where: {
637
- id: item.id !== undefined ? item.id : undefined,
724
+ id: item.id !== undefined ? {
725
+ equals: item.id
726
+ } : undefined,
727
+ userId: item.userId !== undefined ? {
728
+ equals: item.userId
729
+ } : undefined,
638
730
  },
639
731
  create: {
640
732
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -654,7 +746,15 @@ export const Position = {
654
746
  }
655
747
  : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
656
748
  where: {
657
- id: item.id !== undefined ? item.id : undefined,
749
+ id: item.id !== undefined ? {
750
+ equals: item.id
751
+ } : undefined,
752
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
753
+ equals: item.alpacaAccountId
754
+ } : undefined,
755
+ assetId: item.assetId !== undefined ? {
756
+ equals: item.assetId
757
+ } : undefined,
658
758
  },
659
759
  create: {
660
760
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -676,7 +776,9 @@ export const Position = {
676
776
  }
677
777
  : { connectOrCreate: {
678
778
  where: {
679
- id: item.asset.id !== undefined ? item.asset.id : undefined,
779
+ id: item.asset.id !== undefined ? {
780
+ equals: item.asset.id
781
+ } : undefined,
680
782
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
681
783
  name: item.asset.name !== undefined ? item.asset.name : undefined,
682
784
  },
@@ -747,7 +849,12 @@ export const Position = {
747
849
  }
748
850
  : { connectOrCreate: item.actions.map((item) => ({
749
851
  where: {
750
- id: item.id !== undefined ? item.id : undefined,
852
+ id: item.id !== undefined ? {
853
+ equals: item.id
854
+ } : undefined,
855
+ tradeId: item.tradeId !== undefined ? {
856
+ equals: item.tradeId
857
+ } : undefined,
751
858
  },
752
859
  create: {
753
860
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -769,7 +876,18 @@ export const Position = {
769
876
  }
770
877
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
771
878
  where: {
772
- id: item.id !== undefined ? item.id : undefined,
879
+ id: item.id !== undefined ? {
880
+ equals: item.id
881
+ } : undefined,
882
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
883
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
884
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
885
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
886
+ equals: item.alpacaAccountId
887
+ } : undefined,
888
+ assetId: item.assetId !== undefined ? {
889
+ equals: item.assetId
890
+ } : undefined,
773
891
  },
774
892
  create: {
775
893
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -802,7 +920,10 @@ export const Position = {
802
920
  }
803
921
  : { connectOrCreate: {
804
922
  where: {
805
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
923
+ id: item.stopLoss.id !== undefined ? {
924
+ equals: item.stopLoss.id
925
+ } : undefined,
926
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
806
927
  },
807
928
  create: {
808
929
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -818,7 +939,10 @@ export const Position = {
818
939
  }
819
940
  : { connectOrCreate: {
820
941
  where: {
821
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
942
+ id: item.takeProfit.id !== undefined ? {
943
+ equals: item.takeProfit.id
944
+ } : undefined,
945
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
822
946
  },
823
947
  create: {
824
948
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -834,7 +958,12 @@ export const Position = {
834
958
  }
835
959
  : { connectOrCreate: {
836
960
  where: {
837
- id: item.action.id !== undefined ? item.action.id : undefined,
961
+ id: item.action.id !== undefined ? {
962
+ equals: item.action.id
963
+ } : undefined,
964
+ tradeId: item.action.tradeId !== undefined ? {
965
+ equals: item.action.tradeId
966
+ } : undefined,
838
967
  },
839
968
  create: {
840
969
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -853,7 +982,9 @@ export const Position = {
853
982
  }
854
983
  : { connectOrCreate: {
855
984
  where: {
856
- id: item.asset.id !== undefined ? item.asset.id : undefined,
985
+ id: item.asset.id !== undefined ? {
986
+ equals: item.asset.id
987
+ } : undefined,
857
988
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
858
989
  name: item.asset.name !== undefined ? item.asset.name : undefined,
859
990
  },
@@ -927,7 +1058,12 @@ export const Position = {
927
1058
  }
928
1059
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
929
1060
  where: {
930
- id: item.id !== undefined ? item.id : undefined,
1061
+ id: item.id !== undefined ? {
1062
+ equals: item.id
1063
+ } : undefined,
1064
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1065
+ equals: item.alpacaAccountId
1066
+ } : undefined,
931
1067
  },
932
1068
  create: {
933
1069
  message: item.message !== undefined ? item.message : undefined,
@@ -1022,8 +1158,12 @@ export const Position = {
1022
1158
  }`;
1023
1159
  const variables = {
1024
1160
  where: {
1025
- id: props.id !== undefined ? props.id : undefined,
1026
- assetId: props.assetId !== undefined ? props.assetId : undefined,
1161
+ id: props.id !== undefined ? {
1162
+ equals: props.id
1163
+ } : undefined,
1164
+ assetId: props.assetId !== undefined ? {
1165
+ equals: props.assetId
1166
+ } : undefined,
1027
1167
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
1028
1168
  qty: props.qty !== undefined ? props.qty : undefined,
1029
1169
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -1036,7 +1176,9 @@ export const Position = {
1036
1176
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
1037
1177
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
1038
1178
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
1039
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
1179
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
1180
+ equals: props.alpacaAccountId
1181
+ } : undefined,
1040
1182
  },
1041
1183
  data: {
1042
1184
  id: props.id !== undefined ? {
@@ -1266,7 +1408,15 @@ export const Position = {
1266
1408
  trades: props.asset.trades ? {
1267
1409
  upsert: props.asset.trades.map((item) => ({
1268
1410
  where: {
1269
- id: item.id !== undefined ? item.id : undefined,
1411
+ id: item.id !== undefined ? {
1412
+ equals: item.id
1413
+ } : undefined,
1414
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1415
+ equals: item.alpacaAccountId
1416
+ } : undefined,
1417
+ assetId: item.assetId !== undefined ? {
1418
+ equals: item.assetId
1419
+ } : undefined,
1270
1420
  },
1271
1421
  update: {
1272
1422
  id: item.id !== undefined ? {
@@ -1311,6 +1461,9 @@ export const Position = {
1311
1461
  id: item.alpacaAccount.id !== undefined ? {
1312
1462
  equals: item.alpacaAccount.id
1313
1463
  } : undefined,
1464
+ userId: item.alpacaAccount.userId !== undefined ? {
1465
+ equals: item.alpacaAccount.userId
1466
+ } : undefined,
1314
1467
  },
1315
1468
  update: {
1316
1469
  id: item.alpacaAccount.id !== undefined ? {
@@ -1360,7 +1513,12 @@ export const Position = {
1360
1513
  actions: item.actions ? {
1361
1514
  upsert: item.actions.map((item) => ({
1362
1515
  where: {
1363
- id: item.id !== undefined ? item.id : undefined,
1516
+ id: item.id !== undefined ? {
1517
+ equals: item.id
1518
+ } : undefined,
1519
+ tradeId: item.tradeId !== undefined ? {
1520
+ equals: item.tradeId
1521
+ } : undefined,
1364
1522
  },
1365
1523
  update: {
1366
1524
  id: item.id !== undefined ? {
@@ -1412,7 +1570,12 @@ export const Position = {
1412
1570
  }
1413
1571
  : { connectOrCreate: {
1414
1572
  where: {
1415
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1573
+ id: item.alpacaAccount.id !== undefined ? {
1574
+ equals: item.alpacaAccount.id
1575
+ } : undefined,
1576
+ userId: item.alpacaAccount.userId !== undefined ? {
1577
+ equals: item.alpacaAccount.userId
1578
+ } : undefined,
1416
1579
  },
1417
1580
  create: {
1418
1581
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1435,7 +1598,12 @@ export const Position = {
1435
1598
  }
1436
1599
  : { connectOrCreate: item.actions.map((item) => ({
1437
1600
  where: {
1438
- id: item.id !== undefined ? item.id : undefined,
1601
+ id: item.id !== undefined ? {
1602
+ equals: item.id
1603
+ } : undefined,
1604
+ tradeId: item.tradeId !== undefined ? {
1605
+ equals: item.tradeId
1606
+ } : undefined,
1439
1607
  },
1440
1608
  create: {
1441
1609
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1452,7 +1620,18 @@ export const Position = {
1452
1620
  orders: props.asset.orders ? {
1453
1621
  upsert: props.asset.orders.map((item) => ({
1454
1622
  where: {
1455
- id: item.id !== undefined ? item.id : undefined,
1623
+ id: item.id !== undefined ? {
1624
+ equals: item.id
1625
+ } : undefined,
1626
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1627
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1628
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1629
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1630
+ equals: item.alpacaAccountId
1631
+ } : undefined,
1632
+ assetId: item.assetId !== undefined ? {
1633
+ equals: item.assetId
1634
+ } : undefined,
1456
1635
  },
1457
1636
  update: {
1458
1637
  id: item.id !== undefined ? {
@@ -1530,6 +1709,9 @@ export const Position = {
1530
1709
  id: item.stopLoss.id !== undefined ? {
1531
1710
  equals: item.stopLoss.id
1532
1711
  } : undefined,
1712
+ orderId: item.stopLoss.orderId !== undefined ? {
1713
+ equals: item.stopLoss.orderId
1714
+ } : undefined,
1533
1715
  },
1534
1716
  update: {
1535
1717
  id: item.stopLoss.id !== undefined ? {
@@ -1554,6 +1736,9 @@ export const Position = {
1554
1736
  id: item.takeProfit.id !== undefined ? {
1555
1737
  equals: item.takeProfit.id
1556
1738
  } : undefined,
1739
+ orderId: item.takeProfit.orderId !== undefined ? {
1740
+ equals: item.takeProfit.orderId
1741
+ } : undefined,
1557
1742
  },
1558
1743
  update: {
1559
1744
  id: item.takeProfit.id !== undefined ? {
@@ -1578,6 +1763,9 @@ export const Position = {
1578
1763
  id: item.alpacaAccount.id !== undefined ? {
1579
1764
  equals: item.alpacaAccount.id
1580
1765
  } : undefined,
1766
+ userId: item.alpacaAccount.userId !== undefined ? {
1767
+ equals: item.alpacaAccount.userId
1768
+ } : undefined,
1581
1769
  },
1582
1770
  update: {
1583
1771
  id: item.alpacaAccount.id !== undefined ? {
@@ -1630,6 +1818,9 @@ export const Position = {
1630
1818
  id: item.action.id !== undefined ? {
1631
1819
  equals: item.action.id
1632
1820
  } : undefined,
1821
+ tradeId: item.action.tradeId !== undefined ? {
1822
+ equals: item.action.tradeId
1823
+ } : undefined,
1633
1824
  },
1634
1825
  update: {
1635
1826
  id: item.action.id !== undefined ? {
@@ -1692,7 +1883,10 @@ export const Position = {
1692
1883
  }
1693
1884
  : { connectOrCreate: {
1694
1885
  where: {
1695
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1886
+ id: item.stopLoss.id !== undefined ? {
1887
+ equals: item.stopLoss.id
1888
+ } : undefined,
1889
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
1696
1890
  },
1697
1891
  create: {
1698
1892
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -1708,7 +1902,10 @@ export const Position = {
1708
1902
  }
1709
1903
  : { connectOrCreate: {
1710
1904
  where: {
1711
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1905
+ id: item.takeProfit.id !== undefined ? {
1906
+ equals: item.takeProfit.id
1907
+ } : undefined,
1908
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
1712
1909
  },
1713
1910
  create: {
1714
1911
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -1724,7 +1921,12 @@ export const Position = {
1724
1921
  }
1725
1922
  : { connectOrCreate: {
1726
1923
  where: {
1727
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1924
+ id: item.alpacaAccount.id !== undefined ? {
1925
+ equals: item.alpacaAccount.id
1926
+ } : undefined,
1927
+ userId: item.alpacaAccount.userId !== undefined ? {
1928
+ equals: item.alpacaAccount.userId
1929
+ } : undefined,
1728
1930
  },
1729
1931
  create: {
1730
1932
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1747,7 +1949,12 @@ export const Position = {
1747
1949
  }
1748
1950
  : { connectOrCreate: {
1749
1951
  where: {
1750
- id: item.action.id !== undefined ? item.action.id : undefined,
1952
+ id: item.action.id !== undefined ? {
1953
+ equals: item.action.id
1954
+ } : undefined,
1955
+ tradeId: item.action.tradeId !== undefined ? {
1956
+ equals: item.action.tradeId
1957
+ } : undefined,
1751
1958
  },
1752
1959
  create: {
1753
1960
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -1764,8 +1971,16 @@ export const Position = {
1764
1971
  newsMentions: props.asset.newsMentions ? {
1765
1972
  upsert: props.asset.newsMentions.map((item) => ({
1766
1973
  where: {
1767
- id: item.id !== undefined ? item.id : undefined,
1974
+ id: item.id !== undefined ? {
1975
+ equals: item.id
1976
+ } : undefined,
1768
1977
  url: item.url !== undefined ? item.url : undefined,
1978
+ assetId: item.assetId !== undefined ? {
1979
+ equals: item.assetId
1980
+ } : undefined,
1981
+ newsArticleId: item.newsArticleId !== undefined ? {
1982
+ equals: item.newsArticleId
1983
+ } : undefined,
1769
1984
  },
1770
1985
  update: {
1771
1986
  id: item.id !== undefined ? {
@@ -1871,7 +2086,9 @@ export const Position = {
1871
2086
  }
1872
2087
  : { connectOrCreate: {
1873
2088
  where: {
1874
- id: item.news.id !== undefined ? item.news.id : undefined,
2089
+ id: item.news.id !== undefined ? {
2090
+ equals: item.news.id
2091
+ } : undefined,
1875
2092
  url: item.news.url !== undefined ? item.news.url : undefined,
1876
2093
  title: item.news.title !== undefined ? {
1877
2094
  equals: item.news.title
@@ -1962,7 +2179,15 @@ export const Position = {
1962
2179
  }
1963
2180
  : { connectOrCreate: props.asset.trades.map((item) => ({
1964
2181
  where: {
1965
- id: item.id !== undefined ? item.id : undefined,
2182
+ id: item.id !== undefined ? {
2183
+ equals: item.id
2184
+ } : undefined,
2185
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2186
+ equals: item.alpacaAccountId
2187
+ } : undefined,
2188
+ assetId: item.assetId !== undefined ? {
2189
+ equals: item.assetId
2190
+ } : undefined,
1966
2191
  },
1967
2192
  create: {
1968
2193
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1984,7 +2209,12 @@ export const Position = {
1984
2209
  }
1985
2210
  : { connectOrCreate: {
1986
2211
  where: {
1987
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2212
+ id: item.alpacaAccount.id !== undefined ? {
2213
+ equals: item.alpacaAccount.id
2214
+ } : undefined,
2215
+ userId: item.alpacaAccount.userId !== undefined ? {
2216
+ equals: item.alpacaAccount.userId
2217
+ } : undefined,
1988
2218
  },
1989
2219
  create: {
1990
2220
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2007,7 +2237,12 @@ export const Position = {
2007
2237
  }
2008
2238
  : { connectOrCreate: item.actions.map((item) => ({
2009
2239
  where: {
2010
- id: item.id !== undefined ? item.id : undefined,
2240
+ id: item.id !== undefined ? {
2241
+ equals: item.id
2242
+ } : undefined,
2243
+ tradeId: item.tradeId !== undefined ? {
2244
+ equals: item.tradeId
2245
+ } : undefined,
2011
2246
  },
2012
2247
  create: {
2013
2248
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2029,7 +2264,18 @@ export const Position = {
2029
2264
  }
2030
2265
  : { connectOrCreate: props.asset.orders.map((item) => ({
2031
2266
  where: {
2032
- id: item.id !== undefined ? item.id : undefined,
2267
+ id: item.id !== undefined ? {
2268
+ equals: item.id
2269
+ } : undefined,
2270
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2271
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2272
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2273
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2274
+ equals: item.alpacaAccountId
2275
+ } : undefined,
2276
+ assetId: item.assetId !== undefined ? {
2277
+ equals: item.assetId
2278
+ } : undefined,
2033
2279
  },
2034
2280
  create: {
2035
2281
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2062,7 +2308,10 @@ export const Position = {
2062
2308
  }
2063
2309
  : { connectOrCreate: {
2064
2310
  where: {
2065
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2311
+ id: item.stopLoss.id !== undefined ? {
2312
+ equals: item.stopLoss.id
2313
+ } : undefined,
2314
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2066
2315
  },
2067
2316
  create: {
2068
2317
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2078,7 +2327,10 @@ export const Position = {
2078
2327
  }
2079
2328
  : { connectOrCreate: {
2080
2329
  where: {
2081
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2330
+ id: item.takeProfit.id !== undefined ? {
2331
+ equals: item.takeProfit.id
2332
+ } : undefined,
2333
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2082
2334
  },
2083
2335
  create: {
2084
2336
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2094,7 +2346,12 @@ export const Position = {
2094
2346
  }
2095
2347
  : { connectOrCreate: {
2096
2348
  where: {
2097
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2349
+ id: item.alpacaAccount.id !== undefined ? {
2350
+ equals: item.alpacaAccount.id
2351
+ } : undefined,
2352
+ userId: item.alpacaAccount.userId !== undefined ? {
2353
+ equals: item.alpacaAccount.userId
2354
+ } : undefined,
2098
2355
  },
2099
2356
  create: {
2100
2357
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2117,7 +2374,12 @@ export const Position = {
2117
2374
  }
2118
2375
  : { connectOrCreate: {
2119
2376
  where: {
2120
- id: item.action.id !== undefined ? item.action.id : undefined,
2377
+ id: item.action.id !== undefined ? {
2378
+ equals: item.action.id
2379
+ } : undefined,
2380
+ tradeId: item.action.tradeId !== undefined ? {
2381
+ equals: item.action.tradeId
2382
+ } : undefined,
2121
2383
  },
2122
2384
  create: {
2123
2385
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2139,8 +2401,16 @@ export const Position = {
2139
2401
  }
2140
2402
  : { connectOrCreate: props.asset.newsMentions.map((item) => ({
2141
2403
  where: {
2142
- id: item.id !== undefined ? item.id : undefined,
2404
+ id: item.id !== undefined ? {
2405
+ equals: item.id
2406
+ } : undefined,
2143
2407
  url: item.url !== undefined ? item.url : undefined,
2408
+ assetId: item.assetId !== undefined ? {
2409
+ equals: item.assetId
2410
+ } : undefined,
2411
+ newsArticleId: item.newsArticleId !== undefined ? {
2412
+ equals: item.newsArticleId
2413
+ } : undefined,
2144
2414
  },
2145
2415
  create: {
2146
2416
  url: item.url !== undefined ? item.url : undefined,
@@ -2155,7 +2425,9 @@ export const Position = {
2155
2425
  }
2156
2426
  : { connectOrCreate: {
2157
2427
  where: {
2158
- id: item.news.id !== undefined ? item.news.id : undefined,
2428
+ id: item.news.id !== undefined ? {
2429
+ equals: item.news.id
2430
+ } : undefined,
2159
2431
  url: item.news.url !== undefined ? item.news.url : undefined,
2160
2432
  title: item.news.title !== undefined ? {
2161
2433
  equals: item.news.title
@@ -2190,6 +2462,9 @@ export const Position = {
2190
2462
  id: props.alpacaAccount.id !== undefined ? {
2191
2463
  equals: props.alpacaAccount.id
2192
2464
  } : undefined,
2465
+ userId: props.alpacaAccount.userId !== undefined ? {
2466
+ equals: props.alpacaAccount.userId
2467
+ } : undefined,
2193
2468
  },
2194
2469
  update: {
2195
2470
  id: props.alpacaAccount.id !== undefined ? {
@@ -2278,9 +2553,21 @@ export const Position = {
2278
2553
  id: props.alpacaAccount.user.customer.id !== undefined ? {
2279
2554
  equals: props.alpacaAccount.user.customer.id
2280
2555
  } : undefined,
2556
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2557
+ equals: props.alpacaAccount.user.customer.authUserId
2558
+ } : undefined,
2281
2559
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2282
2560
  equals: props.alpacaAccount.user.customer.name
2283
2561
  } : undefined,
2562
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
2563
+ equals: props.alpacaAccount.user.customer.stripeCustomerId
2564
+ } : undefined,
2565
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
2566
+ equals: props.alpacaAccount.user.customer.stripeSubscriptionId
2567
+ } : undefined,
2568
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2569
+ equals: props.alpacaAccount.user.customer.stripePriceId
2570
+ } : undefined,
2284
2571
  },
2285
2572
  update: {
2286
2573
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -2319,7 +2606,15 @@ export const Position = {
2319
2606
  accounts: props.alpacaAccount.user.accounts ? {
2320
2607
  upsert: props.alpacaAccount.user.accounts.map((item) => ({
2321
2608
  where: {
2322
- id: item.id !== undefined ? item.id : undefined,
2609
+ id: item.id !== undefined ? {
2610
+ equals: item.id
2611
+ } : undefined,
2612
+ userId: item.userId !== undefined ? {
2613
+ equals: item.userId
2614
+ } : undefined,
2615
+ providerAccountId: item.providerAccountId !== undefined ? {
2616
+ equals: item.providerAccountId
2617
+ } : undefined,
2323
2618
  },
2324
2619
  update: {
2325
2620
  id: item.id !== undefined ? {
@@ -2373,7 +2668,12 @@ export const Position = {
2373
2668
  sessions: props.alpacaAccount.user.sessions ? {
2374
2669
  upsert: props.alpacaAccount.user.sessions.map((item) => ({
2375
2670
  where: {
2376
- id: item.id !== undefined ? item.id : undefined,
2671
+ id: item.id !== undefined ? {
2672
+ equals: item.id
2673
+ } : undefined,
2674
+ userId: item.userId !== undefined ? {
2675
+ equals: item.userId
2676
+ } : undefined,
2377
2677
  },
2378
2678
  update: {
2379
2679
  id: item.id !== undefined ? {
@@ -2395,7 +2695,12 @@ export const Position = {
2395
2695
  authenticators: props.alpacaAccount.user.authenticators ? {
2396
2696
  upsert: props.alpacaAccount.user.authenticators.map((item) => ({
2397
2697
  where: {
2398
- id: item.id !== undefined ? item.id : undefined,
2698
+ id: item.id !== undefined ? {
2699
+ equals: item.id
2700
+ } : undefined,
2701
+ userId: item.userId !== undefined ? {
2702
+ equals: item.userId
2703
+ } : undefined,
2399
2704
  },
2400
2705
  update: {
2401
2706
  id: item.id !== undefined ? {
@@ -2439,10 +2744,20 @@ export const Position = {
2439
2744
  }
2440
2745
  : { connectOrCreate: {
2441
2746
  where: {
2442
- id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
2747
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
2748
+ equals: props.alpacaAccount.user.customer.id
2749
+ } : undefined,
2750
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2751
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2752
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2753
+ equals: props.alpacaAccount.user.customer.authUserId
2754
+ } : undefined,
2443
2755
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2444
2756
  equals: props.alpacaAccount.user.customer.name
2445
2757
  } : undefined,
2758
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2759
+ equals: props.alpacaAccount.user.customer.stripePriceId
2760
+ } : undefined,
2446
2761
  },
2447
2762
  create: {
2448
2763
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -2463,7 +2778,15 @@ export const Position = {
2463
2778
  }
2464
2779
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
2465
2780
  where: {
2466
- id: item.id !== undefined ? item.id : undefined,
2781
+ id: item.id !== undefined ? {
2782
+ equals: item.id
2783
+ } : undefined,
2784
+ userId: item.userId !== undefined ? {
2785
+ equals: item.userId
2786
+ } : undefined,
2787
+ providerAccountId: item.providerAccountId !== undefined ? {
2788
+ equals: item.providerAccountId
2789
+ } : undefined,
2467
2790
  },
2468
2791
  create: {
2469
2792
  type: item.type !== undefined ? item.type : undefined,
@@ -2487,7 +2810,12 @@ export const Position = {
2487
2810
  }
2488
2811
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
2489
2812
  where: {
2490
- id: item.id !== undefined ? item.id : undefined,
2813
+ id: item.id !== undefined ? {
2814
+ equals: item.id
2815
+ } : undefined,
2816
+ userId: item.userId !== undefined ? {
2817
+ equals: item.userId
2818
+ } : undefined,
2491
2819
  },
2492
2820
  create: {
2493
2821
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -2503,7 +2831,12 @@ export const Position = {
2503
2831
  }
2504
2832
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
2505
2833
  where: {
2506
- id: item.id !== undefined ? item.id : undefined,
2834
+ id: item.id !== undefined ? {
2835
+ equals: item.id
2836
+ } : undefined,
2837
+ userId: item.userId !== undefined ? {
2838
+ equals: item.userId
2839
+ } : undefined,
2507
2840
  },
2508
2841
  create: {
2509
2842
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -2518,7 +2851,15 @@ export const Position = {
2518
2851
  trades: props.alpacaAccount.trades ? {
2519
2852
  upsert: props.alpacaAccount.trades.map((item) => ({
2520
2853
  where: {
2521
- id: item.id !== undefined ? item.id : undefined,
2854
+ id: item.id !== undefined ? {
2855
+ equals: item.id
2856
+ } : undefined,
2857
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2858
+ equals: item.alpacaAccountId
2859
+ } : undefined,
2860
+ assetId: item.assetId !== undefined ? {
2861
+ equals: item.assetId
2862
+ } : undefined,
2522
2863
  },
2523
2864
  update: {
2524
2865
  id: item.id !== undefined ? {
@@ -2802,7 +3143,12 @@ export const Position = {
2802
3143
  actions: item.actions ? {
2803
3144
  upsert: item.actions.map((item) => ({
2804
3145
  where: {
2805
- id: item.id !== undefined ? item.id : undefined,
3146
+ id: item.id !== undefined ? {
3147
+ equals: item.id
3148
+ } : undefined,
3149
+ tradeId: item.tradeId !== undefined ? {
3150
+ equals: item.tradeId
3151
+ } : undefined,
2806
3152
  },
2807
3153
  update: {
2808
3154
  id: item.id !== undefined ? {
@@ -2854,7 +3200,9 @@ export const Position = {
2854
3200
  }
2855
3201
  : { connectOrCreate: {
2856
3202
  where: {
2857
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3203
+ id: item.asset.id !== undefined ? {
3204
+ equals: item.asset.id
3205
+ } : undefined,
2858
3206
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2859
3207
  name: item.asset.name !== undefined ? item.asset.name : undefined,
2860
3208
  },
@@ -2925,7 +3273,12 @@ export const Position = {
2925
3273
  }
2926
3274
  : { connectOrCreate: item.actions.map((item) => ({
2927
3275
  where: {
2928
- id: item.id !== undefined ? item.id : undefined,
3276
+ id: item.id !== undefined ? {
3277
+ equals: item.id
3278
+ } : undefined,
3279
+ tradeId: item.tradeId !== undefined ? {
3280
+ equals: item.tradeId
3281
+ } : undefined,
2929
3282
  },
2930
3283
  create: {
2931
3284
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2942,7 +3295,18 @@ export const Position = {
2942
3295
  orders: props.alpacaAccount.orders ? {
2943
3296
  upsert: props.alpacaAccount.orders.map((item) => ({
2944
3297
  where: {
2945
- id: item.id !== undefined ? item.id : undefined,
3298
+ id: item.id !== undefined ? {
3299
+ equals: item.id
3300
+ } : undefined,
3301
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3302
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3303
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3304
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3305
+ equals: item.alpacaAccountId
3306
+ } : undefined,
3307
+ assetId: item.assetId !== undefined ? {
3308
+ equals: item.assetId
3309
+ } : undefined,
2946
3310
  },
2947
3311
  update: {
2948
3312
  id: item.id !== undefined ? {
@@ -3020,6 +3384,9 @@ export const Position = {
3020
3384
  id: item.stopLoss.id !== undefined ? {
3021
3385
  equals: item.stopLoss.id
3022
3386
  } : undefined,
3387
+ orderId: item.stopLoss.orderId !== undefined ? {
3388
+ equals: item.stopLoss.orderId
3389
+ } : undefined,
3023
3390
  },
3024
3391
  update: {
3025
3392
  id: item.stopLoss.id !== undefined ? {
@@ -3044,6 +3411,9 @@ export const Position = {
3044
3411
  id: item.takeProfit.id !== undefined ? {
3045
3412
  equals: item.takeProfit.id
3046
3413
  } : undefined,
3414
+ orderId: item.takeProfit.orderId !== undefined ? {
3415
+ equals: item.takeProfit.orderId
3416
+ } : undefined,
3047
3417
  },
3048
3418
  update: {
3049
3419
  id: item.takeProfit.id !== undefined ? {
@@ -3068,6 +3438,9 @@ export const Position = {
3068
3438
  id: item.action.id !== undefined ? {
3069
3439
  equals: item.action.id
3070
3440
  } : undefined,
3441
+ tradeId: item.action.tradeId !== undefined ? {
3442
+ equals: item.action.tradeId
3443
+ } : undefined,
3071
3444
  },
3072
3445
  update: {
3073
3446
  id: item.action.id !== undefined ? {
@@ -3372,7 +3745,10 @@ export const Position = {
3372
3745
  }
3373
3746
  : { connectOrCreate: {
3374
3747
  where: {
3375
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3748
+ id: item.stopLoss.id !== undefined ? {
3749
+ equals: item.stopLoss.id
3750
+ } : undefined,
3751
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3376
3752
  },
3377
3753
  create: {
3378
3754
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3388,7 +3764,10 @@ export const Position = {
3388
3764
  }
3389
3765
  : { connectOrCreate: {
3390
3766
  where: {
3391
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3767
+ id: item.takeProfit.id !== undefined ? {
3768
+ equals: item.takeProfit.id
3769
+ } : undefined,
3770
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3392
3771
  },
3393
3772
  create: {
3394
3773
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3404,7 +3783,12 @@ export const Position = {
3404
3783
  }
3405
3784
  : { connectOrCreate: {
3406
3785
  where: {
3407
- id: item.action.id !== undefined ? item.action.id : undefined,
3786
+ id: item.action.id !== undefined ? {
3787
+ equals: item.action.id
3788
+ } : undefined,
3789
+ tradeId: item.action.tradeId !== undefined ? {
3790
+ equals: item.action.tradeId
3791
+ } : undefined,
3408
3792
  },
3409
3793
  create: {
3410
3794
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3423,7 +3807,9 @@ export const Position = {
3423
3807
  }
3424
3808
  : { connectOrCreate: {
3425
3809
  where: {
3426
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3810
+ id: item.asset.id !== undefined ? {
3811
+ equals: item.asset.id
3812
+ } : undefined,
3427
3813
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3428
3814
  name: item.asset.name !== undefined ? item.asset.name : undefined,
3429
3815
  },
@@ -3492,7 +3878,12 @@ export const Position = {
3492
3878
  alerts: props.alpacaAccount.alerts ? {
3493
3879
  upsert: props.alpacaAccount.alerts.map((item) => ({
3494
3880
  where: {
3495
- id: item.id !== undefined ? item.id : undefined,
3881
+ id: item.id !== undefined ? {
3882
+ equals: item.id
3883
+ } : undefined,
3884
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3885
+ equals: item.alpacaAccountId
3886
+ } : undefined,
3496
3887
  },
3497
3888
  update: {
3498
3889
  id: item.id !== undefined ? {
@@ -3534,7 +3925,9 @@ export const Position = {
3534
3925
  }
3535
3926
  : { connectOrCreate: {
3536
3927
  where: {
3537
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
3928
+ id: props.alpacaAccount.user.id !== undefined ? {
3929
+ equals: props.alpacaAccount.user.id
3930
+ } : undefined,
3538
3931
  email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
3539
3932
  name: props.alpacaAccount.user.name !== undefined ? {
3540
3933
  equals: props.alpacaAccount.user.name
@@ -3560,10 +3953,20 @@ export const Position = {
3560
3953
  }
3561
3954
  : { connectOrCreate: {
3562
3955
  where: {
3563
- id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
3956
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
3957
+ equals: props.alpacaAccount.user.customer.id
3958
+ } : undefined,
3959
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
3960
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
3961
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
3962
+ equals: props.alpacaAccount.user.customer.authUserId
3963
+ } : undefined,
3564
3964
  name: props.alpacaAccount.user.customer.name !== undefined ? {
3565
3965
  equals: props.alpacaAccount.user.customer.name
3566
3966
  } : undefined,
3967
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
3968
+ equals: props.alpacaAccount.user.customer.stripePriceId
3969
+ } : undefined,
3567
3970
  },
3568
3971
  create: {
3569
3972
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -3584,7 +3987,15 @@ export const Position = {
3584
3987
  }
3585
3988
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
3586
3989
  where: {
3587
- id: item.id !== undefined ? item.id : undefined,
3990
+ id: item.id !== undefined ? {
3991
+ equals: item.id
3992
+ } : undefined,
3993
+ userId: item.userId !== undefined ? {
3994
+ equals: item.userId
3995
+ } : undefined,
3996
+ providerAccountId: item.providerAccountId !== undefined ? {
3997
+ equals: item.providerAccountId
3998
+ } : undefined,
3588
3999
  },
3589
4000
  create: {
3590
4001
  type: item.type !== undefined ? item.type : undefined,
@@ -3608,7 +4019,12 @@ export const Position = {
3608
4019
  }
3609
4020
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
3610
4021
  where: {
3611
- id: item.id !== undefined ? item.id : undefined,
4022
+ id: item.id !== undefined ? {
4023
+ equals: item.id
4024
+ } : undefined,
4025
+ userId: item.userId !== undefined ? {
4026
+ equals: item.userId
4027
+ } : undefined,
3612
4028
  },
3613
4029
  create: {
3614
4030
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -3624,7 +4040,12 @@ export const Position = {
3624
4040
  }
3625
4041
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
3626
4042
  where: {
3627
- id: item.id !== undefined ? item.id : undefined,
4043
+ id: item.id !== undefined ? {
4044
+ equals: item.id
4045
+ } : undefined,
4046
+ userId: item.userId !== undefined ? {
4047
+ equals: item.userId
4048
+ } : undefined,
3628
4049
  },
3629
4050
  create: {
3630
4051
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -3644,7 +4065,15 @@ export const Position = {
3644
4065
  }
3645
4066
  : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
3646
4067
  where: {
3647
- id: item.id !== undefined ? item.id : undefined,
4068
+ id: item.id !== undefined ? {
4069
+ equals: item.id
4070
+ } : undefined,
4071
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4072
+ equals: item.alpacaAccountId
4073
+ } : undefined,
4074
+ assetId: item.assetId !== undefined ? {
4075
+ equals: item.assetId
4076
+ } : undefined,
3648
4077
  },
3649
4078
  create: {
3650
4079
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -3666,7 +4095,9 @@ export const Position = {
3666
4095
  }
3667
4096
  : { connectOrCreate: {
3668
4097
  where: {
3669
- id: item.asset.id !== undefined ? item.asset.id : undefined,
4098
+ id: item.asset.id !== undefined ? {
4099
+ equals: item.asset.id
4100
+ } : undefined,
3670
4101
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3671
4102
  name: item.asset.name !== undefined ? item.asset.name : undefined,
3672
4103
  },
@@ -3737,7 +4168,12 @@ export const Position = {
3737
4168
  }
3738
4169
  : { connectOrCreate: item.actions.map((item) => ({
3739
4170
  where: {
3740
- id: item.id !== undefined ? item.id : undefined,
4171
+ id: item.id !== undefined ? {
4172
+ equals: item.id
4173
+ } : undefined,
4174
+ tradeId: item.tradeId !== undefined ? {
4175
+ equals: item.tradeId
4176
+ } : undefined,
3741
4177
  },
3742
4178
  create: {
3743
4179
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -3759,7 +4195,18 @@ export const Position = {
3759
4195
  }
3760
4196
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
3761
4197
  where: {
3762
- id: item.id !== undefined ? item.id : undefined,
4198
+ id: item.id !== undefined ? {
4199
+ equals: item.id
4200
+ } : undefined,
4201
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4202
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4203
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4204
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4205
+ equals: item.alpacaAccountId
4206
+ } : undefined,
4207
+ assetId: item.assetId !== undefined ? {
4208
+ equals: item.assetId
4209
+ } : undefined,
3763
4210
  },
3764
4211
  create: {
3765
4212
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3792,7 +4239,10 @@ export const Position = {
3792
4239
  }
3793
4240
  : { connectOrCreate: {
3794
4241
  where: {
3795
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4242
+ id: item.stopLoss.id !== undefined ? {
4243
+ equals: item.stopLoss.id
4244
+ } : undefined,
4245
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3796
4246
  },
3797
4247
  create: {
3798
4248
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3808,7 +4258,10 @@ export const Position = {
3808
4258
  }
3809
4259
  : { connectOrCreate: {
3810
4260
  where: {
3811
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
4261
+ id: item.takeProfit.id !== undefined ? {
4262
+ equals: item.takeProfit.id
4263
+ } : undefined,
4264
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3812
4265
  },
3813
4266
  create: {
3814
4267
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3824,7 +4277,12 @@ export const Position = {
3824
4277
  }
3825
4278
  : { connectOrCreate: {
3826
4279
  where: {
3827
- id: item.action.id !== undefined ? item.action.id : undefined,
4280
+ id: item.action.id !== undefined ? {
4281
+ equals: item.action.id
4282
+ } : undefined,
4283
+ tradeId: item.action.tradeId !== undefined ? {
4284
+ equals: item.action.tradeId
4285
+ } : undefined,
3828
4286
  },
3829
4287
  create: {
3830
4288
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3843,7 +4301,9 @@ export const Position = {
3843
4301
  }
3844
4302
  : { connectOrCreate: {
3845
4303
  where: {
3846
- id: item.asset.id !== undefined ? item.asset.id : undefined,
4304
+ id: item.asset.id !== undefined ? {
4305
+ equals: item.asset.id
4306
+ } : undefined,
3847
4307
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3848
4308
  name: item.asset.name !== undefined ? item.asset.name : undefined,
3849
4309
  },
@@ -3917,7 +4377,12 @@ export const Position = {
3917
4377
  }
3918
4378
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
3919
4379
  where: {
3920
- id: item.id !== undefined ? item.id : undefined,
4380
+ id: item.id !== undefined ? {
4381
+ equals: item.id
4382
+ } : undefined,
4383
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4384
+ equals: item.alpacaAccountId
4385
+ } : undefined,
3921
4386
  },
3922
4387
  create: {
3923
4388
  message: item.message !== undefined ? item.message : undefined,
@@ -3963,8 +4428,12 @@ export const Position = {
3963
4428
  }`;
3964
4429
  const variables = props.map(prop => ({
3965
4430
  where: {
3966
- id: prop.id !== undefined ? prop.id : undefined,
3967
- assetId: prop.assetId !== undefined ? prop.assetId : undefined,
4431
+ id: prop.id !== undefined ? {
4432
+ equals: prop.id
4433
+ } : undefined,
4434
+ assetId: prop.assetId !== undefined ? {
4435
+ equals: prop.assetId
4436
+ } : undefined,
3968
4437
  averageEntryPrice: prop.averageEntryPrice !== undefined ? prop.averageEntryPrice : undefined,
3969
4438
  qty: prop.qty !== undefined ? prop.qty : undefined,
3970
4439
  qtyAvailable: prop.qtyAvailable !== undefined ? prop.qtyAvailable : undefined,
@@ -3977,7 +4446,9 @@ export const Position = {
3977
4446
  currentPrice: prop.currentPrice !== undefined ? prop.currentPrice : undefined,
3978
4447
  lastTradePrice: prop.lastTradePrice !== undefined ? prop.lastTradePrice : undefined,
3979
4448
  changeToday: prop.changeToday !== undefined ? prop.changeToday : undefined,
3980
- alpacaAccountId: prop.alpacaAccountId !== undefined ? prop.alpacaAccountId : undefined,
4449
+ alpacaAccountId: prop.alpacaAccountId !== undefined ? {
4450
+ equals: prop.alpacaAccountId
4451
+ } : undefined,
3981
4452
  },
3982
4453
  data: {
3983
4454
  id: prop.id !== undefined ? {
@@ -4207,7 +4678,15 @@ export const Position = {
4207
4678
  trades: prop.asset.trades ? {
4208
4679
  upsert: prop.asset.trades.map((item) => ({
4209
4680
  where: {
4210
- id: item.id !== undefined ? item.id : undefined,
4681
+ id: item.id !== undefined ? {
4682
+ equals: item.id
4683
+ } : undefined,
4684
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4685
+ equals: item.alpacaAccountId
4686
+ } : undefined,
4687
+ assetId: item.assetId !== undefined ? {
4688
+ equals: item.assetId
4689
+ } : undefined,
4211
4690
  },
4212
4691
  update: {
4213
4692
  id: item.id !== undefined ? {
@@ -4252,6 +4731,9 @@ export const Position = {
4252
4731
  id: item.alpacaAccount.id !== undefined ? {
4253
4732
  equals: item.alpacaAccount.id
4254
4733
  } : undefined,
4734
+ userId: item.alpacaAccount.userId !== undefined ? {
4735
+ equals: item.alpacaAccount.userId
4736
+ } : undefined,
4255
4737
  },
4256
4738
  update: {
4257
4739
  id: item.alpacaAccount.id !== undefined ? {
@@ -4301,7 +4783,12 @@ export const Position = {
4301
4783
  actions: item.actions ? {
4302
4784
  upsert: item.actions.map((item) => ({
4303
4785
  where: {
4304
- id: item.id !== undefined ? item.id : undefined,
4786
+ id: item.id !== undefined ? {
4787
+ equals: item.id
4788
+ } : undefined,
4789
+ tradeId: item.tradeId !== undefined ? {
4790
+ equals: item.tradeId
4791
+ } : undefined,
4305
4792
  },
4306
4793
  update: {
4307
4794
  id: item.id !== undefined ? {
@@ -4353,7 +4840,12 @@ export const Position = {
4353
4840
  }
4354
4841
  : { connectOrCreate: {
4355
4842
  where: {
4356
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4843
+ id: item.alpacaAccount.id !== undefined ? {
4844
+ equals: item.alpacaAccount.id
4845
+ } : undefined,
4846
+ userId: item.alpacaAccount.userId !== undefined ? {
4847
+ equals: item.alpacaAccount.userId
4848
+ } : undefined,
4357
4849
  },
4358
4850
  create: {
4359
4851
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4376,7 +4868,12 @@ export const Position = {
4376
4868
  }
4377
4869
  : { connectOrCreate: item.actions.map((item) => ({
4378
4870
  where: {
4379
- id: item.id !== undefined ? item.id : undefined,
4871
+ id: item.id !== undefined ? {
4872
+ equals: item.id
4873
+ } : undefined,
4874
+ tradeId: item.tradeId !== undefined ? {
4875
+ equals: item.tradeId
4876
+ } : undefined,
4380
4877
  },
4381
4878
  create: {
4382
4879
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4393,7 +4890,18 @@ export const Position = {
4393
4890
  orders: prop.asset.orders ? {
4394
4891
  upsert: prop.asset.orders.map((item) => ({
4395
4892
  where: {
4396
- id: item.id !== undefined ? item.id : undefined,
4893
+ id: item.id !== undefined ? {
4894
+ equals: item.id
4895
+ } : undefined,
4896
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4897
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4898
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4899
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4900
+ equals: item.alpacaAccountId
4901
+ } : undefined,
4902
+ assetId: item.assetId !== undefined ? {
4903
+ equals: item.assetId
4904
+ } : undefined,
4397
4905
  },
4398
4906
  update: {
4399
4907
  id: item.id !== undefined ? {
@@ -4471,6 +4979,9 @@ export const Position = {
4471
4979
  id: item.stopLoss.id !== undefined ? {
4472
4980
  equals: item.stopLoss.id
4473
4981
  } : undefined,
4982
+ orderId: item.stopLoss.orderId !== undefined ? {
4983
+ equals: item.stopLoss.orderId
4984
+ } : undefined,
4474
4985
  },
4475
4986
  update: {
4476
4987
  id: item.stopLoss.id !== undefined ? {
@@ -4495,6 +5006,9 @@ export const Position = {
4495
5006
  id: item.takeProfit.id !== undefined ? {
4496
5007
  equals: item.takeProfit.id
4497
5008
  } : undefined,
5009
+ orderId: item.takeProfit.orderId !== undefined ? {
5010
+ equals: item.takeProfit.orderId
5011
+ } : undefined,
4498
5012
  },
4499
5013
  update: {
4500
5014
  id: item.takeProfit.id !== undefined ? {
@@ -4519,6 +5033,9 @@ export const Position = {
4519
5033
  id: item.alpacaAccount.id !== undefined ? {
4520
5034
  equals: item.alpacaAccount.id
4521
5035
  } : undefined,
5036
+ userId: item.alpacaAccount.userId !== undefined ? {
5037
+ equals: item.alpacaAccount.userId
5038
+ } : undefined,
4522
5039
  },
4523
5040
  update: {
4524
5041
  id: item.alpacaAccount.id !== undefined ? {
@@ -4571,6 +5088,9 @@ export const Position = {
4571
5088
  id: item.action.id !== undefined ? {
4572
5089
  equals: item.action.id
4573
5090
  } : undefined,
5091
+ tradeId: item.action.tradeId !== undefined ? {
5092
+ equals: item.action.tradeId
5093
+ } : undefined,
4574
5094
  },
4575
5095
  update: {
4576
5096
  id: item.action.id !== undefined ? {
@@ -4633,7 +5153,10 @@ export const Position = {
4633
5153
  }
4634
5154
  : { connectOrCreate: {
4635
5155
  where: {
4636
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
5156
+ id: item.stopLoss.id !== undefined ? {
5157
+ equals: item.stopLoss.id
5158
+ } : undefined,
5159
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
4637
5160
  },
4638
5161
  create: {
4639
5162
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -4649,7 +5172,10 @@ export const Position = {
4649
5172
  }
4650
5173
  : { connectOrCreate: {
4651
5174
  where: {
4652
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
5175
+ id: item.takeProfit.id !== undefined ? {
5176
+ equals: item.takeProfit.id
5177
+ } : undefined,
5178
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
4653
5179
  },
4654
5180
  create: {
4655
5181
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -4665,7 +5191,12 @@ export const Position = {
4665
5191
  }
4666
5192
  : { connectOrCreate: {
4667
5193
  where: {
4668
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5194
+ id: item.alpacaAccount.id !== undefined ? {
5195
+ equals: item.alpacaAccount.id
5196
+ } : undefined,
5197
+ userId: item.alpacaAccount.userId !== undefined ? {
5198
+ equals: item.alpacaAccount.userId
5199
+ } : undefined,
4669
5200
  },
4670
5201
  create: {
4671
5202
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4688,7 +5219,12 @@ export const Position = {
4688
5219
  }
4689
5220
  : { connectOrCreate: {
4690
5221
  where: {
4691
- id: item.action.id !== undefined ? item.action.id : undefined,
5222
+ id: item.action.id !== undefined ? {
5223
+ equals: item.action.id
5224
+ } : undefined,
5225
+ tradeId: item.action.tradeId !== undefined ? {
5226
+ equals: item.action.tradeId
5227
+ } : undefined,
4692
5228
  },
4693
5229
  create: {
4694
5230
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -4705,8 +5241,16 @@ export const Position = {
4705
5241
  newsMentions: prop.asset.newsMentions ? {
4706
5242
  upsert: prop.asset.newsMentions.map((item) => ({
4707
5243
  where: {
4708
- id: item.id !== undefined ? item.id : undefined,
5244
+ id: item.id !== undefined ? {
5245
+ equals: item.id
5246
+ } : undefined,
4709
5247
  url: item.url !== undefined ? item.url : undefined,
5248
+ assetId: item.assetId !== undefined ? {
5249
+ equals: item.assetId
5250
+ } : undefined,
5251
+ newsArticleId: item.newsArticleId !== undefined ? {
5252
+ equals: item.newsArticleId
5253
+ } : undefined,
4710
5254
  },
4711
5255
  update: {
4712
5256
  id: item.id !== undefined ? {
@@ -4812,7 +5356,9 @@ export const Position = {
4812
5356
  }
4813
5357
  : { connectOrCreate: {
4814
5358
  where: {
4815
- id: item.news.id !== undefined ? item.news.id : undefined,
5359
+ id: item.news.id !== undefined ? {
5360
+ equals: item.news.id
5361
+ } : undefined,
4816
5362
  url: item.news.url !== undefined ? item.news.url : undefined,
4817
5363
  title: item.news.title !== undefined ? {
4818
5364
  equals: item.news.title
@@ -4903,7 +5449,15 @@ export const Position = {
4903
5449
  }
4904
5450
  : { connectOrCreate: prop.asset.trades.map((item) => ({
4905
5451
  where: {
4906
- id: item.id !== undefined ? item.id : undefined,
5452
+ id: item.id !== undefined ? {
5453
+ equals: item.id
5454
+ } : undefined,
5455
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5456
+ equals: item.alpacaAccountId
5457
+ } : undefined,
5458
+ assetId: item.assetId !== undefined ? {
5459
+ equals: item.assetId
5460
+ } : undefined,
4907
5461
  },
4908
5462
  create: {
4909
5463
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -4925,7 +5479,12 @@ export const Position = {
4925
5479
  }
4926
5480
  : { connectOrCreate: {
4927
5481
  where: {
4928
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5482
+ id: item.alpacaAccount.id !== undefined ? {
5483
+ equals: item.alpacaAccount.id
5484
+ } : undefined,
5485
+ userId: item.alpacaAccount.userId !== undefined ? {
5486
+ equals: item.alpacaAccount.userId
5487
+ } : undefined,
4929
5488
  },
4930
5489
  create: {
4931
5490
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4948,7 +5507,12 @@ export const Position = {
4948
5507
  }
4949
5508
  : { connectOrCreate: item.actions.map((item) => ({
4950
5509
  where: {
4951
- id: item.id !== undefined ? item.id : undefined,
5510
+ id: item.id !== undefined ? {
5511
+ equals: item.id
5512
+ } : undefined,
5513
+ tradeId: item.tradeId !== undefined ? {
5514
+ equals: item.tradeId
5515
+ } : undefined,
4952
5516
  },
4953
5517
  create: {
4954
5518
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4970,7 +5534,18 @@ export const Position = {
4970
5534
  }
4971
5535
  : { connectOrCreate: prop.asset.orders.map((item) => ({
4972
5536
  where: {
4973
- id: item.id !== undefined ? item.id : undefined,
5537
+ id: item.id !== undefined ? {
5538
+ equals: item.id
5539
+ } : undefined,
5540
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5541
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5542
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5543
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5544
+ equals: item.alpacaAccountId
5545
+ } : undefined,
5546
+ assetId: item.assetId !== undefined ? {
5547
+ equals: item.assetId
5548
+ } : undefined,
4974
5549
  },
4975
5550
  create: {
4976
5551
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -5003,7 +5578,10 @@ export const Position = {
5003
5578
  }
5004
5579
  : { connectOrCreate: {
5005
5580
  where: {
5006
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
5581
+ id: item.stopLoss.id !== undefined ? {
5582
+ equals: item.stopLoss.id
5583
+ } : undefined,
5584
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
5007
5585
  },
5008
5586
  create: {
5009
5587
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -5019,7 +5597,10 @@ export const Position = {
5019
5597
  }
5020
5598
  : { connectOrCreate: {
5021
5599
  where: {
5022
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
5600
+ id: item.takeProfit.id !== undefined ? {
5601
+ equals: item.takeProfit.id
5602
+ } : undefined,
5603
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
5023
5604
  },
5024
5605
  create: {
5025
5606
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -5035,7 +5616,12 @@ export const Position = {
5035
5616
  }
5036
5617
  : { connectOrCreate: {
5037
5618
  where: {
5038
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5619
+ id: item.alpacaAccount.id !== undefined ? {
5620
+ equals: item.alpacaAccount.id
5621
+ } : undefined,
5622
+ userId: item.alpacaAccount.userId !== undefined ? {
5623
+ equals: item.alpacaAccount.userId
5624
+ } : undefined,
5039
5625
  },
5040
5626
  create: {
5041
5627
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -5058,7 +5644,12 @@ export const Position = {
5058
5644
  }
5059
5645
  : { connectOrCreate: {
5060
5646
  where: {
5061
- id: item.action.id !== undefined ? item.action.id : undefined,
5647
+ id: item.action.id !== undefined ? {
5648
+ equals: item.action.id
5649
+ } : undefined,
5650
+ tradeId: item.action.tradeId !== undefined ? {
5651
+ equals: item.action.tradeId
5652
+ } : undefined,
5062
5653
  },
5063
5654
  create: {
5064
5655
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -5080,8 +5671,16 @@ export const Position = {
5080
5671
  }
5081
5672
  : { connectOrCreate: prop.asset.newsMentions.map((item) => ({
5082
5673
  where: {
5083
- id: item.id !== undefined ? item.id : undefined,
5674
+ id: item.id !== undefined ? {
5675
+ equals: item.id
5676
+ } : undefined,
5084
5677
  url: item.url !== undefined ? item.url : undefined,
5678
+ assetId: item.assetId !== undefined ? {
5679
+ equals: item.assetId
5680
+ } : undefined,
5681
+ newsArticleId: item.newsArticleId !== undefined ? {
5682
+ equals: item.newsArticleId
5683
+ } : undefined,
5085
5684
  },
5086
5685
  create: {
5087
5686
  url: item.url !== undefined ? item.url : undefined,
@@ -5096,7 +5695,9 @@ export const Position = {
5096
5695
  }
5097
5696
  : { connectOrCreate: {
5098
5697
  where: {
5099
- id: item.news.id !== undefined ? item.news.id : undefined,
5698
+ id: item.news.id !== undefined ? {
5699
+ equals: item.news.id
5700
+ } : undefined,
5100
5701
  url: item.news.url !== undefined ? item.news.url : undefined,
5101
5702
  title: item.news.title !== undefined ? {
5102
5703
  equals: item.news.title
@@ -5131,6 +5732,9 @@ export const Position = {
5131
5732
  id: prop.alpacaAccount.id !== undefined ? {
5132
5733
  equals: prop.alpacaAccount.id
5133
5734
  } : undefined,
5735
+ userId: prop.alpacaAccount.userId !== undefined ? {
5736
+ equals: prop.alpacaAccount.userId
5737
+ } : undefined,
5134
5738
  },
5135
5739
  update: {
5136
5740
  id: prop.alpacaAccount.id !== undefined ? {
@@ -5219,9 +5823,21 @@ export const Position = {
5219
5823
  id: prop.alpacaAccount.user.customer.id !== undefined ? {
5220
5824
  equals: prop.alpacaAccount.user.customer.id
5221
5825
  } : undefined,
5826
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5827
+ equals: prop.alpacaAccount.user.customer.authUserId
5828
+ } : undefined,
5222
5829
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5223
5830
  equals: prop.alpacaAccount.user.customer.name
5224
5831
  } : undefined,
5832
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
5833
+ equals: prop.alpacaAccount.user.customer.stripeCustomerId
5834
+ } : undefined,
5835
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
5836
+ equals: prop.alpacaAccount.user.customer.stripeSubscriptionId
5837
+ } : undefined,
5838
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5839
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5840
+ } : undefined,
5225
5841
  },
5226
5842
  update: {
5227
5843
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -5260,7 +5876,15 @@ export const Position = {
5260
5876
  accounts: prop.alpacaAccount.user.accounts ? {
5261
5877
  upsert: prop.alpacaAccount.user.accounts.map((item) => ({
5262
5878
  where: {
5263
- id: item.id !== undefined ? item.id : undefined,
5879
+ id: item.id !== undefined ? {
5880
+ equals: item.id
5881
+ } : undefined,
5882
+ userId: item.userId !== undefined ? {
5883
+ equals: item.userId
5884
+ } : undefined,
5885
+ providerAccountId: item.providerAccountId !== undefined ? {
5886
+ equals: item.providerAccountId
5887
+ } : undefined,
5264
5888
  },
5265
5889
  update: {
5266
5890
  id: item.id !== undefined ? {
@@ -5314,7 +5938,12 @@ export const Position = {
5314
5938
  sessions: prop.alpacaAccount.user.sessions ? {
5315
5939
  upsert: prop.alpacaAccount.user.sessions.map((item) => ({
5316
5940
  where: {
5317
- id: item.id !== undefined ? item.id : undefined,
5941
+ id: item.id !== undefined ? {
5942
+ equals: item.id
5943
+ } : undefined,
5944
+ userId: item.userId !== undefined ? {
5945
+ equals: item.userId
5946
+ } : undefined,
5318
5947
  },
5319
5948
  update: {
5320
5949
  id: item.id !== undefined ? {
@@ -5336,7 +5965,12 @@ export const Position = {
5336
5965
  authenticators: prop.alpacaAccount.user.authenticators ? {
5337
5966
  upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
5338
5967
  where: {
5339
- id: item.id !== undefined ? item.id : undefined,
5968
+ id: item.id !== undefined ? {
5969
+ equals: item.id
5970
+ } : undefined,
5971
+ userId: item.userId !== undefined ? {
5972
+ equals: item.userId
5973
+ } : undefined,
5340
5974
  },
5341
5975
  update: {
5342
5976
  id: item.id !== undefined ? {
@@ -5380,10 +6014,20 @@ export const Position = {
5380
6014
  }
5381
6015
  : { connectOrCreate: {
5382
6016
  where: {
5383
- id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
6017
+ id: prop.alpacaAccount.user.customer.id !== undefined ? {
6018
+ equals: prop.alpacaAccount.user.customer.id
6019
+ } : undefined,
6020
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
6021
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
6022
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
6023
+ equals: prop.alpacaAccount.user.customer.authUserId
6024
+ } : undefined,
5384
6025
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5385
6026
  equals: prop.alpacaAccount.user.customer.name
5386
6027
  } : undefined,
6028
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
6029
+ equals: prop.alpacaAccount.user.customer.stripePriceId
6030
+ } : undefined,
5387
6031
  },
5388
6032
  create: {
5389
6033
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -5404,7 +6048,15 @@ export const Position = {
5404
6048
  }
5405
6049
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
5406
6050
  where: {
5407
- id: item.id !== undefined ? item.id : undefined,
6051
+ id: item.id !== undefined ? {
6052
+ equals: item.id
6053
+ } : undefined,
6054
+ userId: item.userId !== undefined ? {
6055
+ equals: item.userId
6056
+ } : undefined,
6057
+ providerAccountId: item.providerAccountId !== undefined ? {
6058
+ equals: item.providerAccountId
6059
+ } : undefined,
5408
6060
  },
5409
6061
  create: {
5410
6062
  type: item.type !== undefined ? item.type : undefined,
@@ -5428,7 +6080,12 @@ export const Position = {
5428
6080
  }
5429
6081
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
5430
6082
  where: {
5431
- id: item.id !== undefined ? item.id : undefined,
6083
+ id: item.id !== undefined ? {
6084
+ equals: item.id
6085
+ } : undefined,
6086
+ userId: item.userId !== undefined ? {
6087
+ equals: item.userId
6088
+ } : undefined,
5432
6089
  },
5433
6090
  create: {
5434
6091
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -5444,7 +6101,12 @@ export const Position = {
5444
6101
  }
5445
6102
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
5446
6103
  where: {
5447
- id: item.id !== undefined ? item.id : undefined,
6104
+ id: item.id !== undefined ? {
6105
+ equals: item.id
6106
+ } : undefined,
6107
+ userId: item.userId !== undefined ? {
6108
+ equals: item.userId
6109
+ } : undefined,
5448
6110
  },
5449
6111
  create: {
5450
6112
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -5459,7 +6121,15 @@ export const Position = {
5459
6121
  trades: prop.alpacaAccount.trades ? {
5460
6122
  upsert: prop.alpacaAccount.trades.map((item) => ({
5461
6123
  where: {
5462
- id: item.id !== undefined ? item.id : undefined,
6124
+ id: item.id !== undefined ? {
6125
+ equals: item.id
6126
+ } : undefined,
6127
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6128
+ equals: item.alpacaAccountId
6129
+ } : undefined,
6130
+ assetId: item.assetId !== undefined ? {
6131
+ equals: item.assetId
6132
+ } : undefined,
5463
6133
  },
5464
6134
  update: {
5465
6135
  id: item.id !== undefined ? {
@@ -5743,7 +6413,12 @@ export const Position = {
5743
6413
  actions: item.actions ? {
5744
6414
  upsert: item.actions.map((item) => ({
5745
6415
  where: {
5746
- id: item.id !== undefined ? item.id : undefined,
6416
+ id: item.id !== undefined ? {
6417
+ equals: item.id
6418
+ } : undefined,
6419
+ tradeId: item.tradeId !== undefined ? {
6420
+ equals: item.tradeId
6421
+ } : undefined,
5747
6422
  },
5748
6423
  update: {
5749
6424
  id: item.id !== undefined ? {
@@ -5795,7 +6470,9 @@ export const Position = {
5795
6470
  }
5796
6471
  : { connectOrCreate: {
5797
6472
  where: {
5798
- id: item.asset.id !== undefined ? item.asset.id : undefined,
6473
+ id: item.asset.id !== undefined ? {
6474
+ equals: item.asset.id
6475
+ } : undefined,
5799
6476
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5800
6477
  name: item.asset.name !== undefined ? item.asset.name : undefined,
5801
6478
  },
@@ -5866,7 +6543,12 @@ export const Position = {
5866
6543
  }
5867
6544
  : { connectOrCreate: item.actions.map((item) => ({
5868
6545
  where: {
5869
- id: item.id !== undefined ? item.id : undefined,
6546
+ id: item.id !== undefined ? {
6547
+ equals: item.id
6548
+ } : undefined,
6549
+ tradeId: item.tradeId !== undefined ? {
6550
+ equals: item.tradeId
6551
+ } : undefined,
5870
6552
  },
5871
6553
  create: {
5872
6554
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -5883,7 +6565,18 @@ export const Position = {
5883
6565
  orders: prop.alpacaAccount.orders ? {
5884
6566
  upsert: prop.alpacaAccount.orders.map((item) => ({
5885
6567
  where: {
5886
- id: item.id !== undefined ? item.id : undefined,
6568
+ id: item.id !== undefined ? {
6569
+ equals: item.id
6570
+ } : undefined,
6571
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6572
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6573
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6574
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6575
+ equals: item.alpacaAccountId
6576
+ } : undefined,
6577
+ assetId: item.assetId !== undefined ? {
6578
+ equals: item.assetId
6579
+ } : undefined,
5887
6580
  },
5888
6581
  update: {
5889
6582
  id: item.id !== undefined ? {
@@ -5961,6 +6654,9 @@ export const Position = {
5961
6654
  id: item.stopLoss.id !== undefined ? {
5962
6655
  equals: item.stopLoss.id
5963
6656
  } : undefined,
6657
+ orderId: item.stopLoss.orderId !== undefined ? {
6658
+ equals: item.stopLoss.orderId
6659
+ } : undefined,
5964
6660
  },
5965
6661
  update: {
5966
6662
  id: item.stopLoss.id !== undefined ? {
@@ -5985,6 +6681,9 @@ export const Position = {
5985
6681
  id: item.takeProfit.id !== undefined ? {
5986
6682
  equals: item.takeProfit.id
5987
6683
  } : undefined,
6684
+ orderId: item.takeProfit.orderId !== undefined ? {
6685
+ equals: item.takeProfit.orderId
6686
+ } : undefined,
5988
6687
  },
5989
6688
  update: {
5990
6689
  id: item.takeProfit.id !== undefined ? {
@@ -6009,6 +6708,9 @@ export const Position = {
6009
6708
  id: item.action.id !== undefined ? {
6010
6709
  equals: item.action.id
6011
6710
  } : undefined,
6711
+ tradeId: item.action.tradeId !== undefined ? {
6712
+ equals: item.action.tradeId
6713
+ } : undefined,
6012
6714
  },
6013
6715
  update: {
6014
6716
  id: item.action.id !== undefined ? {
@@ -6313,7 +7015,10 @@ export const Position = {
6313
7015
  }
6314
7016
  : { connectOrCreate: {
6315
7017
  where: {
6316
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7018
+ id: item.stopLoss.id !== undefined ? {
7019
+ equals: item.stopLoss.id
7020
+ } : undefined,
7021
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6317
7022
  },
6318
7023
  create: {
6319
7024
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6329,7 +7034,10 @@ export const Position = {
6329
7034
  }
6330
7035
  : { connectOrCreate: {
6331
7036
  where: {
6332
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7037
+ id: item.takeProfit.id !== undefined ? {
7038
+ equals: item.takeProfit.id
7039
+ } : undefined,
7040
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6333
7041
  },
6334
7042
  create: {
6335
7043
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6345,7 +7053,12 @@ export const Position = {
6345
7053
  }
6346
7054
  : { connectOrCreate: {
6347
7055
  where: {
6348
- id: item.action.id !== undefined ? item.action.id : undefined,
7056
+ id: item.action.id !== undefined ? {
7057
+ equals: item.action.id
7058
+ } : undefined,
7059
+ tradeId: item.action.tradeId !== undefined ? {
7060
+ equals: item.action.tradeId
7061
+ } : undefined,
6349
7062
  },
6350
7063
  create: {
6351
7064
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6364,7 +7077,9 @@ export const Position = {
6364
7077
  }
6365
7078
  : { connectOrCreate: {
6366
7079
  where: {
6367
- id: item.asset.id !== undefined ? item.asset.id : undefined,
7080
+ id: item.asset.id !== undefined ? {
7081
+ equals: item.asset.id
7082
+ } : undefined,
6368
7083
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6369
7084
  name: item.asset.name !== undefined ? item.asset.name : undefined,
6370
7085
  },
@@ -6433,7 +7148,12 @@ export const Position = {
6433
7148
  alerts: prop.alpacaAccount.alerts ? {
6434
7149
  upsert: prop.alpacaAccount.alerts.map((item) => ({
6435
7150
  where: {
6436
- id: item.id !== undefined ? item.id : undefined,
7151
+ id: item.id !== undefined ? {
7152
+ equals: item.id
7153
+ } : undefined,
7154
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7155
+ equals: item.alpacaAccountId
7156
+ } : undefined,
6437
7157
  },
6438
7158
  update: {
6439
7159
  id: item.id !== undefined ? {
@@ -6475,7 +7195,9 @@ export const Position = {
6475
7195
  }
6476
7196
  : { connectOrCreate: {
6477
7197
  where: {
6478
- id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
7198
+ id: prop.alpacaAccount.user.id !== undefined ? {
7199
+ equals: prop.alpacaAccount.user.id
7200
+ } : undefined,
6479
7201
  email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
6480
7202
  name: prop.alpacaAccount.user.name !== undefined ? {
6481
7203
  equals: prop.alpacaAccount.user.name
@@ -6501,10 +7223,20 @@ export const Position = {
6501
7223
  }
6502
7224
  : { connectOrCreate: {
6503
7225
  where: {
6504
- id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
7226
+ id: prop.alpacaAccount.user.customer.id !== undefined ? {
7227
+ equals: prop.alpacaAccount.user.customer.id
7228
+ } : undefined,
7229
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
7230
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
7231
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
7232
+ equals: prop.alpacaAccount.user.customer.authUserId
7233
+ } : undefined,
6505
7234
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
6506
7235
  equals: prop.alpacaAccount.user.customer.name
6507
7236
  } : undefined,
7237
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
7238
+ equals: prop.alpacaAccount.user.customer.stripePriceId
7239
+ } : undefined,
6508
7240
  },
6509
7241
  create: {
6510
7242
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -6525,7 +7257,15 @@ export const Position = {
6525
7257
  }
6526
7258
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
6527
7259
  where: {
6528
- id: item.id !== undefined ? item.id : undefined,
7260
+ id: item.id !== undefined ? {
7261
+ equals: item.id
7262
+ } : undefined,
7263
+ userId: item.userId !== undefined ? {
7264
+ equals: item.userId
7265
+ } : undefined,
7266
+ providerAccountId: item.providerAccountId !== undefined ? {
7267
+ equals: item.providerAccountId
7268
+ } : undefined,
6529
7269
  },
6530
7270
  create: {
6531
7271
  type: item.type !== undefined ? item.type : undefined,
@@ -6549,7 +7289,12 @@ export const Position = {
6549
7289
  }
6550
7290
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
6551
7291
  where: {
6552
- id: item.id !== undefined ? item.id : undefined,
7292
+ id: item.id !== undefined ? {
7293
+ equals: item.id
7294
+ } : undefined,
7295
+ userId: item.userId !== undefined ? {
7296
+ equals: item.userId
7297
+ } : undefined,
6553
7298
  },
6554
7299
  create: {
6555
7300
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -6565,7 +7310,12 @@ export const Position = {
6565
7310
  }
6566
7311
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
6567
7312
  where: {
6568
- id: item.id !== undefined ? item.id : undefined,
7313
+ id: item.id !== undefined ? {
7314
+ equals: item.id
7315
+ } : undefined,
7316
+ userId: item.userId !== undefined ? {
7317
+ equals: item.userId
7318
+ } : undefined,
6569
7319
  },
6570
7320
  create: {
6571
7321
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -6585,7 +7335,15 @@ export const Position = {
6585
7335
  }
6586
7336
  : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
6587
7337
  where: {
6588
- id: item.id !== undefined ? item.id : undefined,
7338
+ id: item.id !== undefined ? {
7339
+ equals: item.id
7340
+ } : undefined,
7341
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7342
+ equals: item.alpacaAccountId
7343
+ } : undefined,
7344
+ assetId: item.assetId !== undefined ? {
7345
+ equals: item.assetId
7346
+ } : undefined,
6589
7347
  },
6590
7348
  create: {
6591
7349
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -6607,7 +7365,9 @@ export const Position = {
6607
7365
  }
6608
7366
  : { connectOrCreate: {
6609
7367
  where: {
6610
- id: item.asset.id !== undefined ? item.asset.id : undefined,
7368
+ id: item.asset.id !== undefined ? {
7369
+ equals: item.asset.id
7370
+ } : undefined,
6611
7371
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6612
7372
  name: item.asset.name !== undefined ? item.asset.name : undefined,
6613
7373
  },
@@ -6678,7 +7438,12 @@ export const Position = {
6678
7438
  }
6679
7439
  : { connectOrCreate: item.actions.map((item) => ({
6680
7440
  where: {
6681
- id: item.id !== undefined ? item.id : undefined,
7441
+ id: item.id !== undefined ? {
7442
+ equals: item.id
7443
+ } : undefined,
7444
+ tradeId: item.tradeId !== undefined ? {
7445
+ equals: item.tradeId
7446
+ } : undefined,
6682
7447
  },
6683
7448
  create: {
6684
7449
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -6700,7 +7465,18 @@ export const Position = {
6700
7465
  }
6701
7466
  : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
6702
7467
  where: {
6703
- id: item.id !== undefined ? item.id : undefined,
7468
+ id: item.id !== undefined ? {
7469
+ equals: item.id
7470
+ } : undefined,
7471
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7472
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7473
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7474
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7475
+ equals: item.alpacaAccountId
7476
+ } : undefined,
7477
+ assetId: item.assetId !== undefined ? {
7478
+ equals: item.assetId
7479
+ } : undefined,
6704
7480
  },
6705
7481
  create: {
6706
7482
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6733,7 +7509,10 @@ export const Position = {
6733
7509
  }
6734
7510
  : { connectOrCreate: {
6735
7511
  where: {
6736
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7512
+ id: item.stopLoss.id !== undefined ? {
7513
+ equals: item.stopLoss.id
7514
+ } : undefined,
7515
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6737
7516
  },
6738
7517
  create: {
6739
7518
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6749,7 +7528,10 @@ export const Position = {
6749
7528
  }
6750
7529
  : { connectOrCreate: {
6751
7530
  where: {
6752
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7531
+ id: item.takeProfit.id !== undefined ? {
7532
+ equals: item.takeProfit.id
7533
+ } : undefined,
7534
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6753
7535
  },
6754
7536
  create: {
6755
7537
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6765,7 +7547,12 @@ export const Position = {
6765
7547
  }
6766
7548
  : { connectOrCreate: {
6767
7549
  where: {
6768
- id: item.action.id !== undefined ? item.action.id : undefined,
7550
+ id: item.action.id !== undefined ? {
7551
+ equals: item.action.id
7552
+ } : undefined,
7553
+ tradeId: item.action.tradeId !== undefined ? {
7554
+ equals: item.action.tradeId
7555
+ } : undefined,
6769
7556
  },
6770
7557
  create: {
6771
7558
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6784,7 +7571,9 @@ export const Position = {
6784
7571
  }
6785
7572
  : { connectOrCreate: {
6786
7573
  where: {
6787
- id: item.asset.id !== undefined ? item.asset.id : undefined,
7574
+ id: item.asset.id !== undefined ? {
7575
+ equals: item.asset.id
7576
+ } : undefined,
6788
7577
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6789
7578
  name: item.asset.name !== undefined ? item.asset.name : undefined,
6790
7579
  },
@@ -6858,7 +7647,12 @@ export const Position = {
6858
7647
  }
6859
7648
  : { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
6860
7649
  where: {
6861
- id: item.id !== undefined ? item.id : undefined,
7650
+ id: item.id !== undefined ? {
7651
+ equals: item.id
7652
+ } : undefined,
7653
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7654
+ equals: item.alpacaAccountId
7655
+ } : undefined,
6862
7656
  },
6863
7657
  create: {
6864
7658
  message: item.message !== undefined ? item.message : undefined,
@@ -6939,8 +7733,12 @@ export const Position = {
6939
7733
  }`;
6940
7734
  const variables = {
6941
7735
  where: {
6942
- id: props.id !== undefined ? props.id : undefined,
6943
- assetId: props.assetId !== undefined ? props.assetId : undefined,
7736
+ id: props.id !== undefined ? {
7737
+ equals: props.id
7738
+ } : undefined,
7739
+ assetId: props.assetId !== undefined ? {
7740
+ equals: props.assetId
7741
+ } : undefined,
6944
7742
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
6945
7743
  qty: props.qty !== undefined ? props.qty : undefined,
6946
7744
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -6953,7 +7751,9 @@ export const Position = {
6953
7751
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
6954
7752
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
6955
7753
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
6956
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
7754
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
7755
+ equals: props.alpacaAccountId
7756
+ } : undefined,
6957
7757
  },
6958
7758
  };
6959
7759
  const filteredVariables = removeUndefinedProps(variables);
@@ -7019,7 +7819,9 @@ export const Position = {
7019
7819
  id: props.id !== undefined ? {
7020
7820
  equals: props.id
7021
7821
  } : undefined,
7022
- assetId: props.assetId !== undefined ? props.assetId : undefined,
7822
+ assetId: props.assetId !== undefined ? {
7823
+ equals: props.assetId
7824
+ } : undefined,
7023
7825
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
7024
7826
  qty: props.qty !== undefined ? props.qty : undefined,
7025
7827
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -7032,7 +7834,9 @@ export const Position = {
7032
7834
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
7033
7835
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
7034
7836
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
7035
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
7837
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
7838
+ equals: props.alpacaAccountId
7839
+ } : undefined,
7036
7840
  },
7037
7841
  };
7038
7842
  const filteredVariables = removeUndefinedProps(variables);