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
package/Asset.cjs CHANGED
@@ -306,7 +306,15 @@ exports.Asset = {
306
306
  }
307
307
  : { connectOrCreate: props.trades.map((item) => ({
308
308
  where: {
309
- id: item.id !== undefined ? item.id : undefined,
309
+ id: item.id !== undefined ? {
310
+ equals: item.id
311
+ } : undefined,
312
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
313
+ equals: item.alpacaAccountId
314
+ } : undefined,
315
+ assetId: item.assetId !== undefined ? {
316
+ equals: item.assetId
317
+ } : undefined,
310
318
  },
311
319
  create: {
312
320
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -328,7 +336,12 @@ exports.Asset = {
328
336
  }
329
337
  : { connectOrCreate: {
330
338
  where: {
331
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
339
+ id: item.alpacaAccount.id !== undefined ? {
340
+ equals: item.alpacaAccount.id
341
+ } : undefined,
342
+ userId: item.alpacaAccount.userId !== undefined ? {
343
+ equals: item.alpacaAccount.userId
344
+ } : undefined,
332
345
  },
333
346
  create: {
334
347
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -348,7 +361,9 @@ exports.Asset = {
348
361
  }
349
362
  : { connectOrCreate: {
350
363
  where: {
351
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
364
+ id: item.alpacaAccount.user.id !== undefined ? {
365
+ equals: item.alpacaAccount.user.id
366
+ } : undefined,
352
367
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
353
368
  name: item.alpacaAccount.user.name !== undefined ? {
354
369
  equals: item.alpacaAccount.user.name
@@ -377,7 +392,18 @@ exports.Asset = {
377
392
  }
378
393
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
379
394
  where: {
380
- id: item.id !== undefined ? item.id : undefined,
395
+ id: item.id !== undefined ? {
396
+ equals: item.id
397
+ } : undefined,
398
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
399
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
400
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
401
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
402
+ equals: item.alpacaAccountId
403
+ } : undefined,
404
+ assetId: item.assetId !== undefined ? {
405
+ equals: item.assetId
406
+ } : undefined,
381
407
  },
382
408
  create: {
383
409
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -413,7 +439,15 @@ exports.Asset = {
413
439
  }
414
440
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
415
441
  where: {
416
- id: item.id !== undefined ? item.id : undefined,
442
+ id: item.id !== undefined ? {
443
+ equals: item.id
444
+ } : undefined,
445
+ assetId: item.assetId !== undefined ? {
446
+ equals: item.assetId
447
+ } : undefined,
448
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
449
+ equals: item.alpacaAccountId
450
+ } : undefined,
417
451
  },
418
452
  create: {
419
453
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -440,7 +474,12 @@ exports.Asset = {
440
474
  }
441
475
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
442
476
  where: {
443
- id: item.id !== undefined ? item.id : undefined,
477
+ id: item.id !== undefined ? {
478
+ equals: item.id
479
+ } : undefined,
480
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
481
+ equals: item.alpacaAccountId
482
+ } : undefined,
444
483
  },
445
484
  create: {
446
485
  message: item.message !== undefined ? item.message : undefined,
@@ -460,7 +499,12 @@ exports.Asset = {
460
499
  }
461
500
  : { connectOrCreate: item.actions.map((item) => ({
462
501
  where: {
463
- id: item.id !== undefined ? item.id : undefined,
502
+ id: item.id !== undefined ? {
503
+ equals: item.id
504
+ } : undefined,
505
+ tradeId: item.tradeId !== undefined ? {
506
+ equals: item.tradeId
507
+ } : undefined,
464
508
  },
465
509
  create: {
466
510
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -476,7 +520,18 @@ exports.Asset = {
476
520
  }
477
521
  : { connectOrCreate: {
478
522
  where: {
479
- id: item.order.id !== undefined ? item.order.id : undefined,
523
+ id: item.order.id !== undefined ? {
524
+ equals: item.order.id
525
+ } : undefined,
526
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
527
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
528
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
529
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
530
+ equals: item.order.alpacaAccountId
531
+ } : undefined,
532
+ assetId: item.order.assetId !== undefined ? {
533
+ equals: item.order.assetId
534
+ } : undefined,
480
535
  },
481
536
  create: {
482
537
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -518,7 +573,18 @@ exports.Asset = {
518
573
  }
519
574
  : { connectOrCreate: props.orders.map((item) => ({
520
575
  where: {
521
- id: item.id !== undefined ? item.id : undefined,
576
+ id: item.id !== undefined ? {
577
+ equals: item.id
578
+ } : undefined,
579
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
580
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
581
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
582
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
583
+ equals: item.alpacaAccountId
584
+ } : undefined,
585
+ assetId: item.assetId !== undefined ? {
586
+ equals: item.assetId
587
+ } : undefined,
522
588
  },
523
589
  create: {
524
590
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -551,7 +617,10 @@ exports.Asset = {
551
617
  }
552
618
  : { connectOrCreate: {
553
619
  where: {
554
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
620
+ id: item.stopLoss.id !== undefined ? {
621
+ equals: item.stopLoss.id
622
+ } : undefined,
623
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
555
624
  },
556
625
  create: {
557
626
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -567,7 +636,10 @@ exports.Asset = {
567
636
  }
568
637
  : { connectOrCreate: {
569
638
  where: {
570
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
639
+ id: item.takeProfit.id !== undefined ? {
640
+ equals: item.takeProfit.id
641
+ } : undefined,
642
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
571
643
  },
572
644
  create: {
573
645
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -583,7 +655,12 @@ exports.Asset = {
583
655
  }
584
656
  : { connectOrCreate: {
585
657
  where: {
586
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
658
+ id: item.alpacaAccount.id !== undefined ? {
659
+ equals: item.alpacaAccount.id
660
+ } : undefined,
661
+ userId: item.alpacaAccount.userId !== undefined ? {
662
+ equals: item.alpacaAccount.userId
663
+ } : undefined,
587
664
  },
588
665
  create: {
589
666
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -603,7 +680,9 @@ exports.Asset = {
603
680
  }
604
681
  : { connectOrCreate: {
605
682
  where: {
606
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
683
+ id: item.alpacaAccount.user.id !== undefined ? {
684
+ equals: item.alpacaAccount.user.id
685
+ } : undefined,
607
686
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
608
687
  name: item.alpacaAccount.user.name !== undefined ? {
609
688
  equals: item.alpacaAccount.user.name
@@ -632,7 +711,15 @@ exports.Asset = {
632
711
  }
633
712
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
634
713
  where: {
635
- id: item.id !== undefined ? item.id : undefined,
714
+ id: item.id !== undefined ? {
715
+ equals: item.id
716
+ } : undefined,
717
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
718
+ equals: item.alpacaAccountId
719
+ } : undefined,
720
+ assetId: item.assetId !== undefined ? {
721
+ equals: item.assetId
722
+ } : undefined,
636
723
  },
637
724
  create: {
638
725
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -657,7 +744,15 @@ exports.Asset = {
657
744
  }
658
745
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
659
746
  where: {
660
- id: item.id !== undefined ? item.id : undefined,
747
+ id: item.id !== undefined ? {
748
+ equals: item.id
749
+ } : undefined,
750
+ assetId: item.assetId !== undefined ? {
751
+ equals: item.assetId
752
+ } : undefined,
753
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
754
+ equals: item.alpacaAccountId
755
+ } : undefined,
661
756
  },
662
757
  create: {
663
758
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -684,7 +779,12 @@ exports.Asset = {
684
779
  }
685
780
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
686
781
  where: {
687
- id: item.id !== undefined ? item.id : undefined,
782
+ id: item.id !== undefined ? {
783
+ equals: item.id
784
+ } : undefined,
785
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
786
+ equals: item.alpacaAccountId
787
+ } : undefined,
688
788
  },
689
789
  create: {
690
790
  message: item.message !== undefined ? item.message : undefined,
@@ -704,7 +804,12 @@ exports.Asset = {
704
804
  }
705
805
  : { connectOrCreate: {
706
806
  where: {
707
- id: item.action.id !== undefined ? item.action.id : undefined,
807
+ id: item.action.id !== undefined ? {
808
+ equals: item.action.id
809
+ } : undefined,
810
+ tradeId: item.action.tradeId !== undefined ? {
811
+ equals: item.action.tradeId
812
+ } : undefined,
708
813
  },
709
814
  create: {
710
815
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -720,7 +825,15 @@ exports.Asset = {
720
825
  }
721
826
  : { connectOrCreate: {
722
827
  where: {
723
- id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
828
+ id: item.action.trade.id !== undefined ? {
829
+ equals: item.action.trade.id
830
+ } : undefined,
831
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
832
+ equals: item.action.trade.alpacaAccountId
833
+ } : undefined,
834
+ assetId: item.action.trade.assetId !== undefined ? {
835
+ equals: item.action.trade.assetId
836
+ } : undefined,
724
837
  },
725
838
  create: {
726
839
  qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
@@ -751,7 +864,15 @@ exports.Asset = {
751
864
  }
752
865
  : { connectOrCreate: props.positions.map((item) => ({
753
866
  where: {
754
- id: item.id !== undefined ? item.id : undefined,
867
+ id: item.id !== undefined ? {
868
+ equals: item.id
869
+ } : undefined,
870
+ assetId: item.assetId !== undefined ? {
871
+ equals: item.assetId
872
+ } : undefined,
873
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
874
+ equals: item.alpacaAccountId
875
+ } : undefined,
755
876
  },
756
877
  create: {
757
878
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -775,7 +896,12 @@ exports.Asset = {
775
896
  }
776
897
  : { connectOrCreate: {
777
898
  where: {
778
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
899
+ id: item.alpacaAccount.id !== undefined ? {
900
+ equals: item.alpacaAccount.id
901
+ } : undefined,
902
+ userId: item.alpacaAccount.userId !== undefined ? {
903
+ equals: item.alpacaAccount.userId
904
+ } : undefined,
779
905
  },
780
906
  create: {
781
907
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -795,7 +921,9 @@ exports.Asset = {
795
921
  }
796
922
  : { connectOrCreate: {
797
923
  where: {
798
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
924
+ id: item.alpacaAccount.user.id !== undefined ? {
925
+ equals: item.alpacaAccount.user.id
926
+ } : undefined,
799
927
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
800
928
  name: item.alpacaAccount.user.name !== undefined ? {
801
929
  equals: item.alpacaAccount.user.name
@@ -824,7 +952,15 @@ exports.Asset = {
824
952
  }
825
953
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
826
954
  where: {
827
- id: item.id !== undefined ? item.id : undefined,
955
+ id: item.id !== undefined ? {
956
+ equals: item.id
957
+ } : undefined,
958
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
959
+ equals: item.alpacaAccountId
960
+ } : undefined,
961
+ assetId: item.assetId !== undefined ? {
962
+ equals: item.assetId
963
+ } : undefined,
828
964
  },
829
965
  create: {
830
966
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -849,7 +985,18 @@ exports.Asset = {
849
985
  }
850
986
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
851
987
  where: {
852
- id: item.id !== undefined ? item.id : undefined,
988
+ id: item.id !== undefined ? {
989
+ equals: item.id
990
+ } : undefined,
991
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
992
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
993
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
994
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
995
+ equals: item.alpacaAccountId
996
+ } : undefined,
997
+ assetId: item.assetId !== undefined ? {
998
+ equals: item.assetId
999
+ } : undefined,
853
1000
  },
854
1001
  create: {
855
1002
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -885,7 +1032,12 @@ exports.Asset = {
885
1032
  }
886
1033
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
887
1034
  where: {
888
- id: item.id !== undefined ? item.id : undefined,
1035
+ id: item.id !== undefined ? {
1036
+ equals: item.id
1037
+ } : undefined,
1038
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1039
+ equals: item.alpacaAccountId
1040
+ } : undefined,
889
1041
  },
890
1042
  create: {
891
1043
  message: item.message !== undefined ? item.message : undefined,
@@ -908,8 +1060,16 @@ exports.Asset = {
908
1060
  }
909
1061
  : { connectOrCreate: props.newsMentions.map((item) => ({
910
1062
  where: {
911
- id: item.id !== undefined ? item.id : undefined,
1063
+ id: item.id !== undefined ? {
1064
+ equals: item.id
1065
+ } : undefined,
912
1066
  url: item.url !== undefined ? item.url : undefined,
1067
+ assetId: item.assetId !== undefined ? {
1068
+ equals: item.assetId
1069
+ } : undefined,
1070
+ newsArticleId: item.newsArticleId !== undefined ? {
1071
+ equals: item.newsArticleId
1072
+ } : undefined,
913
1073
  },
914
1074
  create: {
915
1075
  url: item.url !== undefined ? item.url : undefined,
@@ -924,7 +1084,9 @@ exports.Asset = {
924
1084
  }
925
1085
  : { connectOrCreate: {
926
1086
  where: {
927
- id: item.news.id !== undefined ? item.news.id : undefined,
1087
+ id: item.news.id !== undefined ? {
1088
+ equals: item.news.id
1089
+ } : undefined,
928
1090
  url: item.news.url !== undefined ? item.news.url : undefined,
929
1091
  title: item.news.title !== undefined ? {
930
1092
  equals: item.news.title
@@ -1073,7 +1235,9 @@ exports.Asset = {
1073
1235
  }`;
1074
1236
  const variables = {
1075
1237
  where: {
1076
- id: props.id !== undefined ? props.id : undefined,
1238
+ id: props.id !== undefined ? {
1239
+ equals: props.id
1240
+ } : undefined,
1077
1241
  symbol: props.symbol !== undefined ? props.symbol : undefined,
1078
1242
  name: props.name !== undefined ? props.name : undefined,
1079
1243
  type: props.type !== undefined ? props.type : undefined,
@@ -1308,7 +1472,15 @@ exports.Asset = {
1308
1472
  trades: props.trades ? {
1309
1473
  upsert: props.trades.map((item) => ({
1310
1474
  where: {
1311
- id: item.id !== undefined ? item.id : undefined,
1475
+ id: item.id !== undefined ? {
1476
+ equals: item.id
1477
+ } : undefined,
1478
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1479
+ equals: item.alpacaAccountId
1480
+ } : undefined,
1481
+ assetId: item.assetId !== undefined ? {
1482
+ equals: item.assetId
1483
+ } : undefined,
1312
1484
  },
1313
1485
  update: {
1314
1486
  id: item.id !== undefined ? {
@@ -1353,6 +1525,9 @@ exports.Asset = {
1353
1525
  id: item.alpacaAccount.id !== undefined ? {
1354
1526
  equals: item.alpacaAccount.id
1355
1527
  } : undefined,
1528
+ userId: item.alpacaAccount.userId !== undefined ? {
1529
+ equals: item.alpacaAccount.userId
1530
+ } : undefined,
1356
1531
  },
1357
1532
  update: {
1358
1533
  id: item.alpacaAccount.id !== undefined ? {
@@ -1454,7 +1629,18 @@ exports.Asset = {
1454
1629
  orders: item.alpacaAccount.orders ? {
1455
1630
  upsert: item.alpacaAccount.orders.map((item) => ({
1456
1631
  where: {
1457
- id: item.id !== undefined ? item.id : undefined,
1632
+ id: item.id !== undefined ? {
1633
+ equals: item.id
1634
+ } : undefined,
1635
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1636
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1637
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1638
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1639
+ equals: item.alpacaAccountId
1640
+ } : undefined,
1641
+ assetId: item.assetId !== undefined ? {
1642
+ equals: item.assetId
1643
+ } : undefined,
1458
1644
  },
1459
1645
  update: {
1460
1646
  id: item.id !== undefined ? {
@@ -1556,7 +1742,15 @@ exports.Asset = {
1556
1742
  positions: item.alpacaAccount.positions ? {
1557
1743
  upsert: item.alpacaAccount.positions.map((item) => ({
1558
1744
  where: {
1559
- id: item.id !== undefined ? item.id : undefined,
1745
+ id: item.id !== undefined ? {
1746
+ equals: item.id
1747
+ } : undefined,
1748
+ assetId: item.assetId !== undefined ? {
1749
+ equals: item.assetId
1750
+ } : undefined,
1751
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1752
+ equals: item.alpacaAccountId
1753
+ } : undefined,
1560
1754
  },
1561
1755
  update: {
1562
1756
  id: item.id !== undefined ? {
@@ -1622,7 +1816,12 @@ exports.Asset = {
1622
1816
  alerts: item.alpacaAccount.alerts ? {
1623
1817
  upsert: item.alpacaAccount.alerts.map((item) => ({
1624
1818
  where: {
1625
- id: item.id !== undefined ? item.id : undefined,
1819
+ id: item.id !== undefined ? {
1820
+ equals: item.id
1821
+ } : undefined,
1822
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1823
+ equals: item.alpacaAccountId
1824
+ } : undefined,
1626
1825
  },
1627
1826
  update: {
1628
1827
  id: item.id !== undefined ? {
@@ -1664,7 +1863,9 @@ exports.Asset = {
1664
1863
  }
1665
1864
  : { connectOrCreate: {
1666
1865
  where: {
1667
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
1866
+ id: item.alpacaAccount.user.id !== undefined ? {
1867
+ equals: item.alpacaAccount.user.id
1868
+ } : undefined,
1668
1869
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
1669
1870
  name: item.alpacaAccount.user.name !== undefined ? {
1670
1871
  equals: item.alpacaAccount.user.name
@@ -1693,7 +1894,18 @@ exports.Asset = {
1693
1894
  }
1694
1895
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
1695
1896
  where: {
1696
- id: item.id !== undefined ? item.id : undefined,
1897
+ id: item.id !== undefined ? {
1898
+ equals: item.id
1899
+ } : undefined,
1900
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1901
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1902
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1903
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1904
+ equals: item.alpacaAccountId
1905
+ } : undefined,
1906
+ assetId: item.assetId !== undefined ? {
1907
+ equals: item.assetId
1908
+ } : undefined,
1697
1909
  },
1698
1910
  create: {
1699
1911
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -1729,7 +1941,15 @@ exports.Asset = {
1729
1941
  }
1730
1942
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
1731
1943
  where: {
1732
- id: item.id !== undefined ? item.id : undefined,
1944
+ id: item.id !== undefined ? {
1945
+ equals: item.id
1946
+ } : undefined,
1947
+ assetId: item.assetId !== undefined ? {
1948
+ equals: item.assetId
1949
+ } : undefined,
1950
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1951
+ equals: item.alpacaAccountId
1952
+ } : undefined,
1733
1953
  },
1734
1954
  create: {
1735
1955
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -1756,7 +1976,12 @@ exports.Asset = {
1756
1976
  }
1757
1977
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
1758
1978
  where: {
1759
- id: item.id !== undefined ? item.id : undefined,
1979
+ id: item.id !== undefined ? {
1980
+ equals: item.id
1981
+ } : undefined,
1982
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1983
+ equals: item.alpacaAccountId
1984
+ } : undefined,
1760
1985
  },
1761
1986
  create: {
1762
1987
  message: item.message !== undefined ? item.message : undefined,
@@ -1771,7 +1996,12 @@ exports.Asset = {
1771
1996
  actions: item.actions ? {
1772
1997
  upsert: item.actions.map((item) => ({
1773
1998
  where: {
1774
- id: item.id !== undefined ? item.id : undefined,
1999
+ id: item.id !== undefined ? {
2000
+ equals: item.id
2001
+ } : undefined,
2002
+ tradeId: item.tradeId !== undefined ? {
2003
+ equals: item.tradeId
2004
+ } : undefined,
1775
2005
  },
1776
2006
  update: {
1777
2007
  id: item.id !== undefined ? {
@@ -1798,6 +2028,18 @@ exports.Asset = {
1798
2028
  id: item.order.id !== undefined ? {
1799
2029
  equals: item.order.id
1800
2030
  } : undefined,
2031
+ clientOrderId: item.order.clientOrderId !== undefined ? {
2032
+ equals: item.order.clientOrderId
2033
+ } : undefined,
2034
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
2035
+ equals: item.order.alpacaAccountId
2036
+ } : undefined,
2037
+ assetId: item.order.assetId !== undefined ? {
2038
+ equals: item.order.assetId
2039
+ } : undefined,
2040
+ actionId: item.order.actionId !== undefined ? {
2041
+ equals: item.order.actionId
2042
+ } : undefined,
1801
2043
  },
1802
2044
  update: {
1803
2045
  id: item.order.id !== undefined ? {
@@ -1911,7 +2153,18 @@ exports.Asset = {
1911
2153
  }
1912
2154
  : { connectOrCreate: {
1913
2155
  where: {
1914
- id: item.order.id !== undefined ? item.order.id : undefined,
2156
+ id: item.order.id !== undefined ? {
2157
+ equals: item.order.id
2158
+ } : undefined,
2159
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
2160
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
2161
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
2162
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
2163
+ equals: item.order.alpacaAccountId
2164
+ } : undefined,
2165
+ assetId: item.order.assetId !== undefined ? {
2166
+ equals: item.order.assetId
2167
+ } : undefined,
1915
2168
  },
1916
2169
  create: {
1917
2170
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -1963,7 +2216,12 @@ exports.Asset = {
1963
2216
  }
1964
2217
  : { connectOrCreate: {
1965
2218
  where: {
1966
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2219
+ id: item.alpacaAccount.id !== undefined ? {
2220
+ equals: item.alpacaAccount.id
2221
+ } : undefined,
2222
+ userId: item.alpacaAccount.userId !== undefined ? {
2223
+ equals: item.alpacaAccount.userId
2224
+ } : undefined,
1967
2225
  },
1968
2226
  create: {
1969
2227
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1983,7 +2241,9 @@ exports.Asset = {
1983
2241
  }
1984
2242
  : { connectOrCreate: {
1985
2243
  where: {
1986
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
2244
+ id: item.alpacaAccount.user.id !== undefined ? {
2245
+ equals: item.alpacaAccount.user.id
2246
+ } : undefined,
1987
2247
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
1988
2248
  name: item.alpacaAccount.user.name !== undefined ? {
1989
2249
  equals: item.alpacaAccount.user.name
@@ -2012,7 +2272,18 @@ exports.Asset = {
2012
2272
  }
2013
2273
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
2014
2274
  where: {
2015
- id: item.id !== undefined ? item.id : undefined,
2275
+ id: item.id !== undefined ? {
2276
+ equals: item.id
2277
+ } : undefined,
2278
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2279
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2280
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2281
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2282
+ equals: item.alpacaAccountId
2283
+ } : undefined,
2284
+ assetId: item.assetId !== undefined ? {
2285
+ equals: item.assetId
2286
+ } : undefined,
2016
2287
  },
2017
2288
  create: {
2018
2289
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2048,7 +2319,15 @@ exports.Asset = {
2048
2319
  }
2049
2320
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
2050
2321
  where: {
2051
- id: item.id !== undefined ? item.id : undefined,
2322
+ id: item.id !== undefined ? {
2323
+ equals: item.id
2324
+ } : undefined,
2325
+ assetId: item.assetId !== undefined ? {
2326
+ equals: item.assetId
2327
+ } : undefined,
2328
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2329
+ equals: item.alpacaAccountId
2330
+ } : undefined,
2052
2331
  },
2053
2332
  create: {
2054
2333
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -2075,7 +2354,12 @@ exports.Asset = {
2075
2354
  }
2076
2355
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
2077
2356
  where: {
2078
- id: item.id !== undefined ? item.id : undefined,
2357
+ id: item.id !== undefined ? {
2358
+ equals: item.id
2359
+ } : undefined,
2360
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2361
+ equals: item.alpacaAccountId
2362
+ } : undefined,
2079
2363
  },
2080
2364
  create: {
2081
2365
  message: item.message !== undefined ? item.message : undefined,
@@ -2095,7 +2379,12 @@ exports.Asset = {
2095
2379
  }
2096
2380
  : { connectOrCreate: item.actions.map((item) => ({
2097
2381
  where: {
2098
- id: item.id !== undefined ? item.id : undefined,
2382
+ id: item.id !== undefined ? {
2383
+ equals: item.id
2384
+ } : undefined,
2385
+ tradeId: item.tradeId !== undefined ? {
2386
+ equals: item.tradeId
2387
+ } : undefined,
2099
2388
  },
2100
2389
  create: {
2101
2390
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2111,7 +2400,18 @@ exports.Asset = {
2111
2400
  }
2112
2401
  : { connectOrCreate: {
2113
2402
  where: {
2114
- id: item.order.id !== undefined ? item.order.id : undefined,
2403
+ id: item.order.id !== undefined ? {
2404
+ equals: item.order.id
2405
+ } : undefined,
2406
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
2407
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
2408
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
2409
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
2410
+ equals: item.order.alpacaAccountId
2411
+ } : undefined,
2412
+ assetId: item.order.assetId !== undefined ? {
2413
+ equals: item.order.assetId
2414
+ } : undefined,
2115
2415
  },
2116
2416
  create: {
2117
2417
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -2148,7 +2448,18 @@ exports.Asset = {
2148
2448
  orders: props.orders ? {
2149
2449
  upsert: props.orders.map((item) => ({
2150
2450
  where: {
2151
- id: item.id !== undefined ? item.id : undefined,
2451
+ id: item.id !== undefined ? {
2452
+ equals: item.id
2453
+ } : undefined,
2454
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2455
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2456
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2457
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2458
+ equals: item.alpacaAccountId
2459
+ } : undefined,
2460
+ assetId: item.assetId !== undefined ? {
2461
+ equals: item.assetId
2462
+ } : undefined,
2152
2463
  },
2153
2464
  update: {
2154
2465
  id: item.id !== undefined ? {
@@ -2226,6 +2537,9 @@ exports.Asset = {
2226
2537
  id: item.stopLoss.id !== undefined ? {
2227
2538
  equals: item.stopLoss.id
2228
2539
  } : undefined,
2540
+ orderId: item.stopLoss.orderId !== undefined ? {
2541
+ equals: item.stopLoss.orderId
2542
+ } : undefined,
2229
2543
  },
2230
2544
  update: {
2231
2545
  id: item.stopLoss.id !== undefined ? {
@@ -2250,6 +2564,9 @@ exports.Asset = {
2250
2564
  id: item.takeProfit.id !== undefined ? {
2251
2565
  equals: item.takeProfit.id
2252
2566
  } : undefined,
2567
+ orderId: item.takeProfit.orderId !== undefined ? {
2568
+ equals: item.takeProfit.orderId
2569
+ } : undefined,
2253
2570
  },
2254
2571
  update: {
2255
2572
  id: item.takeProfit.id !== undefined ? {
@@ -2274,6 +2591,9 @@ exports.Asset = {
2274
2591
  id: item.alpacaAccount.id !== undefined ? {
2275
2592
  equals: item.alpacaAccount.id
2276
2593
  } : undefined,
2594
+ userId: item.alpacaAccount.userId !== undefined ? {
2595
+ equals: item.alpacaAccount.userId
2596
+ } : undefined,
2277
2597
  },
2278
2598
  update: {
2279
2599
  id: item.alpacaAccount.id !== undefined ? {
@@ -2375,7 +2695,15 @@ exports.Asset = {
2375
2695
  trades: item.alpacaAccount.trades ? {
2376
2696
  upsert: item.alpacaAccount.trades.map((item) => ({
2377
2697
  where: {
2378
- id: item.id !== undefined ? item.id : undefined,
2698
+ id: item.id !== undefined ? {
2699
+ equals: item.id
2700
+ } : undefined,
2701
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2702
+ equals: item.alpacaAccountId
2703
+ } : undefined,
2704
+ assetId: item.assetId !== undefined ? {
2705
+ equals: item.assetId
2706
+ } : undefined,
2379
2707
  },
2380
2708
  update: {
2381
2709
  id: item.id !== undefined ? {
@@ -2433,7 +2761,15 @@ exports.Asset = {
2433
2761
  positions: item.alpacaAccount.positions ? {
2434
2762
  upsert: item.alpacaAccount.positions.map((item) => ({
2435
2763
  where: {
2436
- id: item.id !== undefined ? item.id : undefined,
2764
+ id: item.id !== undefined ? {
2765
+ equals: item.id
2766
+ } : undefined,
2767
+ assetId: item.assetId !== undefined ? {
2768
+ equals: item.assetId
2769
+ } : undefined,
2770
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2771
+ equals: item.alpacaAccountId
2772
+ } : undefined,
2437
2773
  },
2438
2774
  update: {
2439
2775
  id: item.id !== undefined ? {
@@ -2499,7 +2835,12 @@ exports.Asset = {
2499
2835
  alerts: item.alpacaAccount.alerts ? {
2500
2836
  upsert: item.alpacaAccount.alerts.map((item) => ({
2501
2837
  where: {
2502
- id: item.id !== undefined ? item.id : undefined,
2838
+ id: item.id !== undefined ? {
2839
+ equals: item.id
2840
+ } : undefined,
2841
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2842
+ equals: item.alpacaAccountId
2843
+ } : undefined,
2503
2844
  },
2504
2845
  update: {
2505
2846
  id: item.id !== undefined ? {
@@ -2541,7 +2882,9 @@ exports.Asset = {
2541
2882
  }
2542
2883
  : { connectOrCreate: {
2543
2884
  where: {
2544
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
2885
+ id: item.alpacaAccount.user.id !== undefined ? {
2886
+ equals: item.alpacaAccount.user.id
2887
+ } : undefined,
2545
2888
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2546
2889
  name: item.alpacaAccount.user.name !== undefined ? {
2547
2890
  equals: item.alpacaAccount.user.name
@@ -2570,7 +2913,15 @@ exports.Asset = {
2570
2913
  }
2571
2914
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
2572
2915
  where: {
2573
- id: item.id !== undefined ? item.id : undefined,
2916
+ id: item.id !== undefined ? {
2917
+ equals: item.id
2918
+ } : undefined,
2919
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2920
+ equals: item.alpacaAccountId
2921
+ } : undefined,
2922
+ assetId: item.assetId !== undefined ? {
2923
+ equals: item.assetId
2924
+ } : undefined,
2574
2925
  },
2575
2926
  create: {
2576
2927
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -2595,7 +2946,15 @@ exports.Asset = {
2595
2946
  }
2596
2947
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
2597
2948
  where: {
2598
- id: item.id !== undefined ? item.id : undefined,
2949
+ id: item.id !== undefined ? {
2950
+ equals: item.id
2951
+ } : undefined,
2952
+ assetId: item.assetId !== undefined ? {
2953
+ equals: item.assetId
2954
+ } : undefined,
2955
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2956
+ equals: item.alpacaAccountId
2957
+ } : undefined,
2599
2958
  },
2600
2959
  create: {
2601
2960
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -2622,7 +2981,12 @@ exports.Asset = {
2622
2981
  }
2623
2982
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
2624
2983
  where: {
2625
- id: item.id !== undefined ? item.id : undefined,
2984
+ id: item.id !== undefined ? {
2985
+ equals: item.id
2986
+ } : undefined,
2987
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2988
+ equals: item.alpacaAccountId
2989
+ } : undefined,
2626
2990
  },
2627
2991
  create: {
2628
2992
  message: item.message !== undefined ? item.message : undefined,
@@ -2640,6 +3004,9 @@ exports.Asset = {
2640
3004
  id: item.action.id !== undefined ? {
2641
3005
  equals: item.action.id
2642
3006
  } : undefined,
3007
+ tradeId: item.action.tradeId !== undefined ? {
3008
+ equals: item.action.tradeId
3009
+ } : undefined,
2643
3010
  },
2644
3011
  update: {
2645
3012
  id: item.action.id !== undefined ? {
@@ -2666,6 +3033,12 @@ exports.Asset = {
2666
3033
  id: item.action.trade.id !== undefined ? {
2667
3034
  equals: item.action.trade.id
2668
3035
  } : undefined,
3036
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
3037
+ equals: item.action.trade.alpacaAccountId
3038
+ } : undefined,
3039
+ assetId: item.action.trade.assetId !== undefined ? {
3040
+ equals: item.action.trade.assetId
3041
+ } : undefined,
2669
3042
  },
2670
3043
  update: {
2671
3044
  id: item.action.trade.id !== undefined ? {
@@ -2735,7 +3108,15 @@ exports.Asset = {
2735
3108
  }
2736
3109
  : { connectOrCreate: {
2737
3110
  where: {
2738
- id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
3111
+ id: item.action.trade.id !== undefined ? {
3112
+ equals: item.action.trade.id
3113
+ } : undefined,
3114
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
3115
+ equals: item.action.trade.alpacaAccountId
3116
+ } : undefined,
3117
+ assetId: item.action.trade.assetId !== undefined ? {
3118
+ equals: item.action.trade.assetId
3119
+ } : undefined,
2739
3120
  },
2740
3121
  create: {
2741
3122
  qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
@@ -2787,7 +3168,10 @@ exports.Asset = {
2787
3168
  }
2788
3169
  : { connectOrCreate: {
2789
3170
  where: {
2790
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3171
+ id: item.stopLoss.id !== undefined ? {
3172
+ equals: item.stopLoss.id
3173
+ } : undefined,
3174
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2791
3175
  },
2792
3176
  create: {
2793
3177
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2803,7 +3187,10 @@ exports.Asset = {
2803
3187
  }
2804
3188
  : { connectOrCreate: {
2805
3189
  where: {
2806
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3190
+ id: item.takeProfit.id !== undefined ? {
3191
+ equals: item.takeProfit.id
3192
+ } : undefined,
3193
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2807
3194
  },
2808
3195
  create: {
2809
3196
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2819,7 +3206,12 @@ exports.Asset = {
2819
3206
  }
2820
3207
  : { connectOrCreate: {
2821
3208
  where: {
2822
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3209
+ id: item.alpacaAccount.id !== undefined ? {
3210
+ equals: item.alpacaAccount.id
3211
+ } : undefined,
3212
+ userId: item.alpacaAccount.userId !== undefined ? {
3213
+ equals: item.alpacaAccount.userId
3214
+ } : undefined,
2823
3215
  },
2824
3216
  create: {
2825
3217
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2839,7 +3231,9 @@ exports.Asset = {
2839
3231
  }
2840
3232
  : { connectOrCreate: {
2841
3233
  where: {
2842
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
3234
+ id: item.alpacaAccount.user.id !== undefined ? {
3235
+ equals: item.alpacaAccount.user.id
3236
+ } : undefined,
2843
3237
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2844
3238
  name: item.alpacaAccount.user.name !== undefined ? {
2845
3239
  equals: item.alpacaAccount.user.name
@@ -2868,7 +3262,15 @@ exports.Asset = {
2868
3262
  }
2869
3263
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
2870
3264
  where: {
2871
- id: item.id !== undefined ? item.id : undefined,
3265
+ id: item.id !== undefined ? {
3266
+ equals: item.id
3267
+ } : undefined,
3268
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3269
+ equals: item.alpacaAccountId
3270
+ } : undefined,
3271
+ assetId: item.assetId !== undefined ? {
3272
+ equals: item.assetId
3273
+ } : undefined,
2872
3274
  },
2873
3275
  create: {
2874
3276
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -2893,7 +3295,15 @@ exports.Asset = {
2893
3295
  }
2894
3296
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
2895
3297
  where: {
2896
- id: item.id !== undefined ? item.id : undefined,
3298
+ id: item.id !== undefined ? {
3299
+ equals: item.id
3300
+ } : undefined,
3301
+ assetId: item.assetId !== undefined ? {
3302
+ equals: item.assetId
3303
+ } : undefined,
3304
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3305
+ equals: item.alpacaAccountId
3306
+ } : undefined,
2897
3307
  },
2898
3308
  create: {
2899
3309
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -2920,7 +3330,12 @@ exports.Asset = {
2920
3330
  }
2921
3331
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
2922
3332
  where: {
2923
- id: item.id !== undefined ? item.id : undefined,
3333
+ id: item.id !== undefined ? {
3334
+ equals: item.id
3335
+ } : undefined,
3336
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3337
+ equals: item.alpacaAccountId
3338
+ } : undefined,
2924
3339
  },
2925
3340
  create: {
2926
3341
  message: item.message !== undefined ? item.message : undefined,
@@ -2940,7 +3355,12 @@ exports.Asset = {
2940
3355
  }
2941
3356
  : { connectOrCreate: {
2942
3357
  where: {
2943
- id: item.action.id !== undefined ? item.action.id : undefined,
3358
+ id: item.action.id !== undefined ? {
3359
+ equals: item.action.id
3360
+ } : undefined,
3361
+ tradeId: item.action.tradeId !== undefined ? {
3362
+ equals: item.action.tradeId
3363
+ } : undefined,
2944
3364
  },
2945
3365
  create: {
2946
3366
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2956,7 +3376,15 @@ exports.Asset = {
2956
3376
  }
2957
3377
  : { connectOrCreate: {
2958
3378
  where: {
2959
- id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
3379
+ id: item.action.trade.id !== undefined ? {
3380
+ equals: item.action.trade.id
3381
+ } : undefined,
3382
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
3383
+ equals: item.action.trade.alpacaAccountId
3384
+ } : undefined,
3385
+ assetId: item.action.trade.assetId !== undefined ? {
3386
+ equals: item.action.trade.assetId
3387
+ } : undefined,
2960
3388
  },
2961
3389
  create: {
2962
3390
  qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
@@ -2982,7 +3410,15 @@ exports.Asset = {
2982
3410
  positions: props.positions ? {
2983
3411
  upsert: props.positions.map((item) => ({
2984
3412
  where: {
2985
- id: item.id !== undefined ? item.id : undefined,
3413
+ id: item.id !== undefined ? {
3414
+ equals: item.id
3415
+ } : undefined,
3416
+ assetId: item.assetId !== undefined ? {
3417
+ equals: item.assetId
3418
+ } : undefined,
3419
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3420
+ equals: item.alpacaAccountId
3421
+ } : undefined,
2986
3422
  },
2987
3423
  update: {
2988
3424
  id: item.id !== undefined ? {
@@ -3033,6 +3469,9 @@ exports.Asset = {
3033
3469
  id: item.alpacaAccount.id !== undefined ? {
3034
3470
  equals: item.alpacaAccount.id
3035
3471
  } : undefined,
3472
+ userId: item.alpacaAccount.userId !== undefined ? {
3473
+ equals: item.alpacaAccount.userId
3474
+ } : undefined,
3036
3475
  },
3037
3476
  update: {
3038
3477
  id: item.alpacaAccount.id !== undefined ? {
@@ -3134,7 +3573,15 @@ exports.Asset = {
3134
3573
  trades: item.alpacaAccount.trades ? {
3135
3574
  upsert: item.alpacaAccount.trades.map((item) => ({
3136
3575
  where: {
3137
- id: item.id !== undefined ? item.id : undefined,
3576
+ id: item.id !== undefined ? {
3577
+ equals: item.id
3578
+ } : undefined,
3579
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3580
+ equals: item.alpacaAccountId
3581
+ } : undefined,
3582
+ assetId: item.assetId !== undefined ? {
3583
+ equals: item.assetId
3584
+ } : undefined,
3138
3585
  },
3139
3586
  update: {
3140
3587
  id: item.id !== undefined ? {
@@ -3192,7 +3639,18 @@ exports.Asset = {
3192
3639
  orders: item.alpacaAccount.orders ? {
3193
3640
  upsert: item.alpacaAccount.orders.map((item) => ({
3194
3641
  where: {
3195
- id: item.id !== undefined ? item.id : undefined,
3642
+ id: item.id !== undefined ? {
3643
+ equals: item.id
3644
+ } : undefined,
3645
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3646
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3647
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3648
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3649
+ equals: item.alpacaAccountId
3650
+ } : undefined,
3651
+ assetId: item.assetId !== undefined ? {
3652
+ equals: item.assetId
3653
+ } : undefined,
3196
3654
  },
3197
3655
  update: {
3198
3656
  id: item.id !== undefined ? {
@@ -3294,7 +3752,12 @@ exports.Asset = {
3294
3752
  alerts: item.alpacaAccount.alerts ? {
3295
3753
  upsert: item.alpacaAccount.alerts.map((item) => ({
3296
3754
  where: {
3297
- id: item.id !== undefined ? item.id : undefined,
3755
+ id: item.id !== undefined ? {
3756
+ equals: item.id
3757
+ } : undefined,
3758
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3759
+ equals: item.alpacaAccountId
3760
+ } : undefined,
3298
3761
  },
3299
3762
  update: {
3300
3763
  id: item.id !== undefined ? {
@@ -3336,7 +3799,9 @@ exports.Asset = {
3336
3799
  }
3337
3800
  : { connectOrCreate: {
3338
3801
  where: {
3339
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
3802
+ id: item.alpacaAccount.user.id !== undefined ? {
3803
+ equals: item.alpacaAccount.user.id
3804
+ } : undefined,
3340
3805
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3341
3806
  name: item.alpacaAccount.user.name !== undefined ? {
3342
3807
  equals: item.alpacaAccount.user.name
@@ -3365,7 +3830,15 @@ exports.Asset = {
3365
3830
  }
3366
3831
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
3367
3832
  where: {
3368
- id: item.id !== undefined ? item.id : undefined,
3833
+ id: item.id !== undefined ? {
3834
+ equals: item.id
3835
+ } : undefined,
3836
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3837
+ equals: item.alpacaAccountId
3838
+ } : undefined,
3839
+ assetId: item.assetId !== undefined ? {
3840
+ equals: item.assetId
3841
+ } : undefined,
3369
3842
  },
3370
3843
  create: {
3371
3844
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -3390,7 +3863,18 @@ exports.Asset = {
3390
3863
  }
3391
3864
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
3392
3865
  where: {
3393
- id: item.id !== undefined ? item.id : undefined,
3866
+ id: item.id !== undefined ? {
3867
+ equals: item.id
3868
+ } : undefined,
3869
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3870
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3871
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3872
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3873
+ equals: item.alpacaAccountId
3874
+ } : undefined,
3875
+ assetId: item.assetId !== undefined ? {
3876
+ equals: item.assetId
3877
+ } : undefined,
3394
3878
  },
3395
3879
  create: {
3396
3880
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3426,7 +3910,12 @@ exports.Asset = {
3426
3910
  }
3427
3911
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
3428
3912
  where: {
3429
- id: item.id !== undefined ? item.id : undefined,
3913
+ id: item.id !== undefined ? {
3914
+ equals: item.id
3915
+ } : undefined,
3916
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3917
+ equals: item.alpacaAccountId
3918
+ } : undefined,
3430
3919
  },
3431
3920
  create: {
3432
3921
  message: item.message !== undefined ? item.message : undefined,
@@ -3461,7 +3950,12 @@ exports.Asset = {
3461
3950
  }
3462
3951
  : { connectOrCreate: {
3463
3952
  where: {
3464
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3953
+ id: item.alpacaAccount.id !== undefined ? {
3954
+ equals: item.alpacaAccount.id
3955
+ } : undefined,
3956
+ userId: item.alpacaAccount.userId !== undefined ? {
3957
+ equals: item.alpacaAccount.userId
3958
+ } : undefined,
3465
3959
  },
3466
3960
  create: {
3467
3961
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3481,7 +3975,9 @@ exports.Asset = {
3481
3975
  }
3482
3976
  : { connectOrCreate: {
3483
3977
  where: {
3484
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
3978
+ id: item.alpacaAccount.user.id !== undefined ? {
3979
+ equals: item.alpacaAccount.user.id
3980
+ } : undefined,
3485
3981
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3486
3982
  name: item.alpacaAccount.user.name !== undefined ? {
3487
3983
  equals: item.alpacaAccount.user.name
@@ -3510,7 +4006,15 @@ exports.Asset = {
3510
4006
  }
3511
4007
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
3512
4008
  where: {
3513
- id: item.id !== undefined ? item.id : undefined,
4009
+ id: item.id !== undefined ? {
4010
+ equals: item.id
4011
+ } : undefined,
4012
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4013
+ equals: item.alpacaAccountId
4014
+ } : undefined,
4015
+ assetId: item.assetId !== undefined ? {
4016
+ equals: item.assetId
4017
+ } : undefined,
3514
4018
  },
3515
4019
  create: {
3516
4020
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -3535,7 +4039,18 @@ exports.Asset = {
3535
4039
  }
3536
4040
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
3537
4041
  where: {
3538
- id: item.id !== undefined ? item.id : undefined,
4042
+ id: item.id !== undefined ? {
4043
+ equals: item.id
4044
+ } : undefined,
4045
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4046
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4047
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4048
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4049
+ equals: item.alpacaAccountId
4050
+ } : undefined,
4051
+ assetId: item.assetId !== undefined ? {
4052
+ equals: item.assetId
4053
+ } : undefined,
3539
4054
  },
3540
4055
  create: {
3541
4056
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3571,7 +4086,12 @@ exports.Asset = {
3571
4086
  }
3572
4087
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
3573
4088
  where: {
3574
- id: item.id !== undefined ? item.id : undefined,
4089
+ id: item.id !== undefined ? {
4090
+ equals: item.id
4091
+ } : undefined,
4092
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4093
+ equals: item.alpacaAccountId
4094
+ } : undefined,
3575
4095
  },
3576
4096
  create: {
3577
4097
  message: item.message !== undefined ? item.message : undefined,
@@ -3589,8 +4109,16 @@ exports.Asset = {
3589
4109
  newsMentions: props.newsMentions ? {
3590
4110
  upsert: props.newsMentions.map((item) => ({
3591
4111
  where: {
3592
- id: item.id !== undefined ? item.id : undefined,
4112
+ id: item.id !== undefined ? {
4113
+ equals: item.id
4114
+ } : undefined,
3593
4115
  url: item.url !== undefined ? item.url : undefined,
4116
+ assetId: item.assetId !== undefined ? {
4117
+ equals: item.assetId
4118
+ } : undefined,
4119
+ newsArticleId: item.newsArticleId !== undefined ? {
4120
+ equals: item.newsArticleId
4121
+ } : undefined,
3594
4122
  },
3595
4123
  update: {
3596
4124
  id: item.id !== undefined ? {
@@ -3696,7 +4224,9 @@ exports.Asset = {
3696
4224
  }
3697
4225
  : { connectOrCreate: {
3698
4226
  where: {
3699
- id: item.news.id !== undefined ? item.news.id : undefined,
4227
+ id: item.news.id !== undefined ? {
4228
+ equals: item.news.id
4229
+ } : undefined,
3700
4230
  url: item.news.url !== undefined ? item.news.url : undefined,
3701
4231
  title: item.news.title !== undefined ? {
3702
4232
  equals: item.news.title
@@ -3756,7 +4286,9 @@ exports.Asset = {
3756
4286
  }`;
3757
4287
  const variables = props.map(prop => ({
3758
4288
  where: {
3759
- id: prop.id !== undefined ? prop.id : undefined,
4289
+ id: prop.id !== undefined ? {
4290
+ equals: prop.id
4291
+ } : undefined,
3760
4292
  symbol: prop.symbol !== undefined ? prop.symbol : undefined,
3761
4293
  name: prop.name !== undefined ? prop.name : undefined,
3762
4294
  type: prop.type !== undefined ? prop.type : undefined,
@@ -3991,7 +4523,15 @@ exports.Asset = {
3991
4523
  trades: prop.trades ? {
3992
4524
  upsert: prop.trades.map((item) => ({
3993
4525
  where: {
3994
- id: item.id !== undefined ? item.id : undefined,
4526
+ id: item.id !== undefined ? {
4527
+ equals: item.id
4528
+ } : undefined,
4529
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4530
+ equals: item.alpacaAccountId
4531
+ } : undefined,
4532
+ assetId: item.assetId !== undefined ? {
4533
+ equals: item.assetId
4534
+ } : undefined,
3995
4535
  },
3996
4536
  update: {
3997
4537
  id: item.id !== undefined ? {
@@ -4036,6 +4576,9 @@ exports.Asset = {
4036
4576
  id: item.alpacaAccount.id !== undefined ? {
4037
4577
  equals: item.alpacaAccount.id
4038
4578
  } : undefined,
4579
+ userId: item.alpacaAccount.userId !== undefined ? {
4580
+ equals: item.alpacaAccount.userId
4581
+ } : undefined,
4039
4582
  },
4040
4583
  update: {
4041
4584
  id: item.alpacaAccount.id !== undefined ? {
@@ -4137,7 +4680,18 @@ exports.Asset = {
4137
4680
  orders: item.alpacaAccount.orders ? {
4138
4681
  upsert: item.alpacaAccount.orders.map((item) => ({
4139
4682
  where: {
4140
- id: item.id !== undefined ? item.id : undefined,
4683
+ id: item.id !== undefined ? {
4684
+ equals: item.id
4685
+ } : undefined,
4686
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4687
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4688
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4689
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4690
+ equals: item.alpacaAccountId
4691
+ } : undefined,
4692
+ assetId: item.assetId !== undefined ? {
4693
+ equals: item.assetId
4694
+ } : undefined,
4141
4695
  },
4142
4696
  update: {
4143
4697
  id: item.id !== undefined ? {
@@ -4239,7 +4793,15 @@ exports.Asset = {
4239
4793
  positions: item.alpacaAccount.positions ? {
4240
4794
  upsert: item.alpacaAccount.positions.map((item) => ({
4241
4795
  where: {
4242
- id: item.id !== undefined ? item.id : undefined,
4796
+ id: item.id !== undefined ? {
4797
+ equals: item.id
4798
+ } : undefined,
4799
+ assetId: item.assetId !== undefined ? {
4800
+ equals: item.assetId
4801
+ } : undefined,
4802
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4803
+ equals: item.alpacaAccountId
4804
+ } : undefined,
4243
4805
  },
4244
4806
  update: {
4245
4807
  id: item.id !== undefined ? {
@@ -4305,7 +4867,12 @@ exports.Asset = {
4305
4867
  alerts: item.alpacaAccount.alerts ? {
4306
4868
  upsert: item.alpacaAccount.alerts.map((item) => ({
4307
4869
  where: {
4308
- id: item.id !== undefined ? item.id : undefined,
4870
+ id: item.id !== undefined ? {
4871
+ equals: item.id
4872
+ } : undefined,
4873
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4874
+ equals: item.alpacaAccountId
4875
+ } : undefined,
4309
4876
  },
4310
4877
  update: {
4311
4878
  id: item.id !== undefined ? {
@@ -4347,7 +4914,9 @@ exports.Asset = {
4347
4914
  }
4348
4915
  : { connectOrCreate: {
4349
4916
  where: {
4350
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
4917
+ id: item.alpacaAccount.user.id !== undefined ? {
4918
+ equals: item.alpacaAccount.user.id
4919
+ } : undefined,
4351
4920
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4352
4921
  name: item.alpacaAccount.user.name !== undefined ? {
4353
4922
  equals: item.alpacaAccount.user.name
@@ -4376,7 +4945,18 @@ exports.Asset = {
4376
4945
  }
4377
4946
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
4378
4947
  where: {
4379
- id: item.id !== undefined ? item.id : undefined,
4948
+ id: item.id !== undefined ? {
4949
+ equals: item.id
4950
+ } : undefined,
4951
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4952
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4953
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4954
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4955
+ equals: item.alpacaAccountId
4956
+ } : undefined,
4957
+ assetId: item.assetId !== undefined ? {
4958
+ equals: item.assetId
4959
+ } : undefined,
4380
4960
  },
4381
4961
  create: {
4382
4962
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -4412,7 +4992,15 @@ exports.Asset = {
4412
4992
  }
4413
4993
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
4414
4994
  where: {
4415
- id: item.id !== undefined ? item.id : undefined,
4995
+ id: item.id !== undefined ? {
4996
+ equals: item.id
4997
+ } : undefined,
4998
+ assetId: item.assetId !== undefined ? {
4999
+ equals: item.assetId
5000
+ } : undefined,
5001
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5002
+ equals: item.alpacaAccountId
5003
+ } : undefined,
4416
5004
  },
4417
5005
  create: {
4418
5006
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -4439,7 +5027,12 @@ exports.Asset = {
4439
5027
  }
4440
5028
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
4441
5029
  where: {
4442
- id: item.id !== undefined ? item.id : undefined,
5030
+ id: item.id !== undefined ? {
5031
+ equals: item.id
5032
+ } : undefined,
5033
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5034
+ equals: item.alpacaAccountId
5035
+ } : undefined,
4443
5036
  },
4444
5037
  create: {
4445
5038
  message: item.message !== undefined ? item.message : undefined,
@@ -4454,7 +5047,12 @@ exports.Asset = {
4454
5047
  actions: item.actions ? {
4455
5048
  upsert: item.actions.map((item) => ({
4456
5049
  where: {
4457
- id: item.id !== undefined ? item.id : undefined,
5050
+ id: item.id !== undefined ? {
5051
+ equals: item.id
5052
+ } : undefined,
5053
+ tradeId: item.tradeId !== undefined ? {
5054
+ equals: item.tradeId
5055
+ } : undefined,
4458
5056
  },
4459
5057
  update: {
4460
5058
  id: item.id !== undefined ? {
@@ -4481,6 +5079,18 @@ exports.Asset = {
4481
5079
  id: item.order.id !== undefined ? {
4482
5080
  equals: item.order.id
4483
5081
  } : undefined,
5082
+ clientOrderId: item.order.clientOrderId !== undefined ? {
5083
+ equals: item.order.clientOrderId
5084
+ } : undefined,
5085
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
5086
+ equals: item.order.alpacaAccountId
5087
+ } : undefined,
5088
+ assetId: item.order.assetId !== undefined ? {
5089
+ equals: item.order.assetId
5090
+ } : undefined,
5091
+ actionId: item.order.actionId !== undefined ? {
5092
+ equals: item.order.actionId
5093
+ } : undefined,
4484
5094
  },
4485
5095
  update: {
4486
5096
  id: item.order.id !== undefined ? {
@@ -4594,7 +5204,18 @@ exports.Asset = {
4594
5204
  }
4595
5205
  : { connectOrCreate: {
4596
5206
  where: {
4597
- id: item.order.id !== undefined ? item.order.id : undefined,
5207
+ id: item.order.id !== undefined ? {
5208
+ equals: item.order.id
5209
+ } : undefined,
5210
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
5211
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
5212
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
5213
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
5214
+ equals: item.order.alpacaAccountId
5215
+ } : undefined,
5216
+ assetId: item.order.assetId !== undefined ? {
5217
+ equals: item.order.assetId
5218
+ } : undefined,
4598
5219
  },
4599
5220
  create: {
4600
5221
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -4646,7 +5267,12 @@ exports.Asset = {
4646
5267
  }
4647
5268
  : { connectOrCreate: {
4648
5269
  where: {
4649
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5270
+ id: item.alpacaAccount.id !== undefined ? {
5271
+ equals: item.alpacaAccount.id
5272
+ } : undefined,
5273
+ userId: item.alpacaAccount.userId !== undefined ? {
5274
+ equals: item.alpacaAccount.userId
5275
+ } : undefined,
4650
5276
  },
4651
5277
  create: {
4652
5278
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4666,7 +5292,9 @@ exports.Asset = {
4666
5292
  }
4667
5293
  : { connectOrCreate: {
4668
5294
  where: {
4669
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
5295
+ id: item.alpacaAccount.user.id !== undefined ? {
5296
+ equals: item.alpacaAccount.user.id
5297
+ } : undefined,
4670
5298
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4671
5299
  name: item.alpacaAccount.user.name !== undefined ? {
4672
5300
  equals: item.alpacaAccount.user.name
@@ -4695,7 +5323,18 @@ exports.Asset = {
4695
5323
  }
4696
5324
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
4697
5325
  where: {
4698
- id: item.id !== undefined ? item.id : undefined,
5326
+ id: item.id !== undefined ? {
5327
+ equals: item.id
5328
+ } : undefined,
5329
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5330
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5331
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5332
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5333
+ equals: item.alpacaAccountId
5334
+ } : undefined,
5335
+ assetId: item.assetId !== undefined ? {
5336
+ equals: item.assetId
5337
+ } : undefined,
4699
5338
  },
4700
5339
  create: {
4701
5340
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -4731,7 +5370,15 @@ exports.Asset = {
4731
5370
  }
4732
5371
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
4733
5372
  where: {
4734
- id: item.id !== undefined ? item.id : undefined,
5373
+ id: item.id !== undefined ? {
5374
+ equals: item.id
5375
+ } : undefined,
5376
+ assetId: item.assetId !== undefined ? {
5377
+ equals: item.assetId
5378
+ } : undefined,
5379
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5380
+ equals: item.alpacaAccountId
5381
+ } : undefined,
4735
5382
  },
4736
5383
  create: {
4737
5384
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -4758,7 +5405,12 @@ exports.Asset = {
4758
5405
  }
4759
5406
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
4760
5407
  where: {
4761
- id: item.id !== undefined ? item.id : undefined,
5408
+ id: item.id !== undefined ? {
5409
+ equals: item.id
5410
+ } : undefined,
5411
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5412
+ equals: item.alpacaAccountId
5413
+ } : undefined,
4762
5414
  },
4763
5415
  create: {
4764
5416
  message: item.message !== undefined ? item.message : undefined,
@@ -4778,7 +5430,12 @@ exports.Asset = {
4778
5430
  }
4779
5431
  : { connectOrCreate: item.actions.map((item) => ({
4780
5432
  where: {
4781
- id: item.id !== undefined ? item.id : undefined,
5433
+ id: item.id !== undefined ? {
5434
+ equals: item.id
5435
+ } : undefined,
5436
+ tradeId: item.tradeId !== undefined ? {
5437
+ equals: item.tradeId
5438
+ } : undefined,
4782
5439
  },
4783
5440
  create: {
4784
5441
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4794,7 +5451,18 @@ exports.Asset = {
4794
5451
  }
4795
5452
  : { connectOrCreate: {
4796
5453
  where: {
4797
- id: item.order.id !== undefined ? item.order.id : undefined,
5454
+ id: item.order.id !== undefined ? {
5455
+ equals: item.order.id
5456
+ } : undefined,
5457
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
5458
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
5459
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
5460
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
5461
+ equals: item.order.alpacaAccountId
5462
+ } : undefined,
5463
+ assetId: item.order.assetId !== undefined ? {
5464
+ equals: item.order.assetId
5465
+ } : undefined,
4798
5466
  },
4799
5467
  create: {
4800
5468
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -4831,7 +5499,18 @@ exports.Asset = {
4831
5499
  orders: prop.orders ? {
4832
5500
  upsert: prop.orders.map((item) => ({
4833
5501
  where: {
4834
- id: item.id !== undefined ? item.id : undefined,
5502
+ id: item.id !== undefined ? {
5503
+ equals: item.id
5504
+ } : undefined,
5505
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5506
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5507
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5508
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5509
+ equals: item.alpacaAccountId
5510
+ } : undefined,
5511
+ assetId: item.assetId !== undefined ? {
5512
+ equals: item.assetId
5513
+ } : undefined,
4835
5514
  },
4836
5515
  update: {
4837
5516
  id: item.id !== undefined ? {
@@ -4909,6 +5588,9 @@ exports.Asset = {
4909
5588
  id: item.stopLoss.id !== undefined ? {
4910
5589
  equals: item.stopLoss.id
4911
5590
  } : undefined,
5591
+ orderId: item.stopLoss.orderId !== undefined ? {
5592
+ equals: item.stopLoss.orderId
5593
+ } : undefined,
4912
5594
  },
4913
5595
  update: {
4914
5596
  id: item.stopLoss.id !== undefined ? {
@@ -4933,6 +5615,9 @@ exports.Asset = {
4933
5615
  id: item.takeProfit.id !== undefined ? {
4934
5616
  equals: item.takeProfit.id
4935
5617
  } : undefined,
5618
+ orderId: item.takeProfit.orderId !== undefined ? {
5619
+ equals: item.takeProfit.orderId
5620
+ } : undefined,
4936
5621
  },
4937
5622
  update: {
4938
5623
  id: item.takeProfit.id !== undefined ? {
@@ -4957,6 +5642,9 @@ exports.Asset = {
4957
5642
  id: item.alpacaAccount.id !== undefined ? {
4958
5643
  equals: item.alpacaAccount.id
4959
5644
  } : undefined,
5645
+ userId: item.alpacaAccount.userId !== undefined ? {
5646
+ equals: item.alpacaAccount.userId
5647
+ } : undefined,
4960
5648
  },
4961
5649
  update: {
4962
5650
  id: item.alpacaAccount.id !== undefined ? {
@@ -5058,7 +5746,15 @@ exports.Asset = {
5058
5746
  trades: item.alpacaAccount.trades ? {
5059
5747
  upsert: item.alpacaAccount.trades.map((item) => ({
5060
5748
  where: {
5061
- id: item.id !== undefined ? item.id : undefined,
5749
+ id: item.id !== undefined ? {
5750
+ equals: item.id
5751
+ } : undefined,
5752
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5753
+ equals: item.alpacaAccountId
5754
+ } : undefined,
5755
+ assetId: item.assetId !== undefined ? {
5756
+ equals: item.assetId
5757
+ } : undefined,
5062
5758
  },
5063
5759
  update: {
5064
5760
  id: item.id !== undefined ? {
@@ -5116,7 +5812,15 @@ exports.Asset = {
5116
5812
  positions: item.alpacaAccount.positions ? {
5117
5813
  upsert: item.alpacaAccount.positions.map((item) => ({
5118
5814
  where: {
5119
- id: item.id !== undefined ? item.id : undefined,
5815
+ id: item.id !== undefined ? {
5816
+ equals: item.id
5817
+ } : undefined,
5818
+ assetId: item.assetId !== undefined ? {
5819
+ equals: item.assetId
5820
+ } : undefined,
5821
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5822
+ equals: item.alpacaAccountId
5823
+ } : undefined,
5120
5824
  },
5121
5825
  update: {
5122
5826
  id: item.id !== undefined ? {
@@ -5182,7 +5886,12 @@ exports.Asset = {
5182
5886
  alerts: item.alpacaAccount.alerts ? {
5183
5887
  upsert: item.alpacaAccount.alerts.map((item) => ({
5184
5888
  where: {
5185
- id: item.id !== undefined ? item.id : undefined,
5889
+ id: item.id !== undefined ? {
5890
+ equals: item.id
5891
+ } : undefined,
5892
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5893
+ equals: item.alpacaAccountId
5894
+ } : undefined,
5186
5895
  },
5187
5896
  update: {
5188
5897
  id: item.id !== undefined ? {
@@ -5224,7 +5933,9 @@ exports.Asset = {
5224
5933
  }
5225
5934
  : { connectOrCreate: {
5226
5935
  where: {
5227
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
5936
+ id: item.alpacaAccount.user.id !== undefined ? {
5937
+ equals: item.alpacaAccount.user.id
5938
+ } : undefined,
5228
5939
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5229
5940
  name: item.alpacaAccount.user.name !== undefined ? {
5230
5941
  equals: item.alpacaAccount.user.name
@@ -5253,7 +5964,15 @@ exports.Asset = {
5253
5964
  }
5254
5965
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
5255
5966
  where: {
5256
- id: item.id !== undefined ? item.id : undefined,
5967
+ id: item.id !== undefined ? {
5968
+ equals: item.id
5969
+ } : undefined,
5970
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5971
+ equals: item.alpacaAccountId
5972
+ } : undefined,
5973
+ assetId: item.assetId !== undefined ? {
5974
+ equals: item.assetId
5975
+ } : undefined,
5257
5976
  },
5258
5977
  create: {
5259
5978
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -5278,7 +5997,15 @@ exports.Asset = {
5278
5997
  }
5279
5998
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
5280
5999
  where: {
5281
- id: item.id !== undefined ? item.id : undefined,
6000
+ id: item.id !== undefined ? {
6001
+ equals: item.id
6002
+ } : undefined,
6003
+ assetId: item.assetId !== undefined ? {
6004
+ equals: item.assetId
6005
+ } : undefined,
6006
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6007
+ equals: item.alpacaAccountId
6008
+ } : undefined,
5282
6009
  },
5283
6010
  create: {
5284
6011
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -5305,7 +6032,12 @@ exports.Asset = {
5305
6032
  }
5306
6033
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
5307
6034
  where: {
5308
- id: item.id !== undefined ? item.id : undefined,
6035
+ id: item.id !== undefined ? {
6036
+ equals: item.id
6037
+ } : undefined,
6038
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6039
+ equals: item.alpacaAccountId
6040
+ } : undefined,
5309
6041
  },
5310
6042
  create: {
5311
6043
  message: item.message !== undefined ? item.message : undefined,
@@ -5323,6 +6055,9 @@ exports.Asset = {
5323
6055
  id: item.action.id !== undefined ? {
5324
6056
  equals: item.action.id
5325
6057
  } : undefined,
6058
+ tradeId: item.action.tradeId !== undefined ? {
6059
+ equals: item.action.tradeId
6060
+ } : undefined,
5326
6061
  },
5327
6062
  update: {
5328
6063
  id: item.action.id !== undefined ? {
@@ -5349,6 +6084,12 @@ exports.Asset = {
5349
6084
  id: item.action.trade.id !== undefined ? {
5350
6085
  equals: item.action.trade.id
5351
6086
  } : undefined,
6087
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
6088
+ equals: item.action.trade.alpacaAccountId
6089
+ } : undefined,
6090
+ assetId: item.action.trade.assetId !== undefined ? {
6091
+ equals: item.action.trade.assetId
6092
+ } : undefined,
5352
6093
  },
5353
6094
  update: {
5354
6095
  id: item.action.trade.id !== undefined ? {
@@ -5418,7 +6159,15 @@ exports.Asset = {
5418
6159
  }
5419
6160
  : { connectOrCreate: {
5420
6161
  where: {
5421
- id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
6162
+ id: item.action.trade.id !== undefined ? {
6163
+ equals: item.action.trade.id
6164
+ } : undefined,
6165
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
6166
+ equals: item.action.trade.alpacaAccountId
6167
+ } : undefined,
6168
+ assetId: item.action.trade.assetId !== undefined ? {
6169
+ equals: item.action.trade.assetId
6170
+ } : undefined,
5422
6171
  },
5423
6172
  create: {
5424
6173
  qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
@@ -5470,7 +6219,10 @@ exports.Asset = {
5470
6219
  }
5471
6220
  : { connectOrCreate: {
5472
6221
  where: {
5473
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
6222
+ id: item.stopLoss.id !== undefined ? {
6223
+ equals: item.stopLoss.id
6224
+ } : undefined,
6225
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
5474
6226
  },
5475
6227
  create: {
5476
6228
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -5486,7 +6238,10 @@ exports.Asset = {
5486
6238
  }
5487
6239
  : { connectOrCreate: {
5488
6240
  where: {
5489
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
6241
+ id: item.takeProfit.id !== undefined ? {
6242
+ equals: item.takeProfit.id
6243
+ } : undefined,
6244
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
5490
6245
  },
5491
6246
  create: {
5492
6247
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -5502,7 +6257,12 @@ exports.Asset = {
5502
6257
  }
5503
6258
  : { connectOrCreate: {
5504
6259
  where: {
5505
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
6260
+ id: item.alpacaAccount.id !== undefined ? {
6261
+ equals: item.alpacaAccount.id
6262
+ } : undefined,
6263
+ userId: item.alpacaAccount.userId !== undefined ? {
6264
+ equals: item.alpacaAccount.userId
6265
+ } : undefined,
5506
6266
  },
5507
6267
  create: {
5508
6268
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -5522,7 +6282,9 @@ exports.Asset = {
5522
6282
  }
5523
6283
  : { connectOrCreate: {
5524
6284
  where: {
5525
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
6285
+ id: item.alpacaAccount.user.id !== undefined ? {
6286
+ equals: item.alpacaAccount.user.id
6287
+ } : undefined,
5526
6288
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5527
6289
  name: item.alpacaAccount.user.name !== undefined ? {
5528
6290
  equals: item.alpacaAccount.user.name
@@ -5551,7 +6313,15 @@ exports.Asset = {
5551
6313
  }
5552
6314
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
5553
6315
  where: {
5554
- id: item.id !== undefined ? item.id : undefined,
6316
+ id: item.id !== undefined ? {
6317
+ equals: item.id
6318
+ } : undefined,
6319
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6320
+ equals: item.alpacaAccountId
6321
+ } : undefined,
6322
+ assetId: item.assetId !== undefined ? {
6323
+ equals: item.assetId
6324
+ } : undefined,
5555
6325
  },
5556
6326
  create: {
5557
6327
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -5576,7 +6346,15 @@ exports.Asset = {
5576
6346
  }
5577
6347
  : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
5578
6348
  where: {
5579
- id: item.id !== undefined ? item.id : undefined,
6349
+ id: item.id !== undefined ? {
6350
+ equals: item.id
6351
+ } : undefined,
6352
+ assetId: item.assetId !== undefined ? {
6353
+ equals: item.assetId
6354
+ } : undefined,
6355
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6356
+ equals: item.alpacaAccountId
6357
+ } : undefined,
5580
6358
  },
5581
6359
  create: {
5582
6360
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -5603,7 +6381,12 @@ exports.Asset = {
5603
6381
  }
5604
6382
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
5605
6383
  where: {
5606
- id: item.id !== undefined ? item.id : undefined,
6384
+ id: item.id !== undefined ? {
6385
+ equals: item.id
6386
+ } : undefined,
6387
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6388
+ equals: item.alpacaAccountId
6389
+ } : undefined,
5607
6390
  },
5608
6391
  create: {
5609
6392
  message: item.message !== undefined ? item.message : undefined,
@@ -5623,7 +6406,12 @@ exports.Asset = {
5623
6406
  }
5624
6407
  : { connectOrCreate: {
5625
6408
  where: {
5626
- id: item.action.id !== undefined ? item.action.id : undefined,
6409
+ id: item.action.id !== undefined ? {
6410
+ equals: item.action.id
6411
+ } : undefined,
6412
+ tradeId: item.action.tradeId !== undefined ? {
6413
+ equals: item.action.tradeId
6414
+ } : undefined,
5627
6415
  },
5628
6416
  create: {
5629
6417
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -5639,7 +6427,15 @@ exports.Asset = {
5639
6427
  }
5640
6428
  : { connectOrCreate: {
5641
6429
  where: {
5642
- id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
6430
+ id: item.action.trade.id !== undefined ? {
6431
+ equals: item.action.trade.id
6432
+ } : undefined,
6433
+ alpacaAccountId: item.action.trade.alpacaAccountId !== undefined ? {
6434
+ equals: item.action.trade.alpacaAccountId
6435
+ } : undefined,
6436
+ assetId: item.action.trade.assetId !== undefined ? {
6437
+ equals: item.action.trade.assetId
6438
+ } : undefined,
5643
6439
  },
5644
6440
  create: {
5645
6441
  qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
@@ -5665,7 +6461,15 @@ exports.Asset = {
5665
6461
  positions: prop.positions ? {
5666
6462
  upsert: prop.positions.map((item) => ({
5667
6463
  where: {
5668
- id: item.id !== undefined ? item.id : undefined,
6464
+ id: item.id !== undefined ? {
6465
+ equals: item.id
6466
+ } : undefined,
6467
+ assetId: item.assetId !== undefined ? {
6468
+ equals: item.assetId
6469
+ } : undefined,
6470
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6471
+ equals: item.alpacaAccountId
6472
+ } : undefined,
5669
6473
  },
5670
6474
  update: {
5671
6475
  id: item.id !== undefined ? {
@@ -5716,6 +6520,9 @@ exports.Asset = {
5716
6520
  id: item.alpacaAccount.id !== undefined ? {
5717
6521
  equals: item.alpacaAccount.id
5718
6522
  } : undefined,
6523
+ userId: item.alpacaAccount.userId !== undefined ? {
6524
+ equals: item.alpacaAccount.userId
6525
+ } : undefined,
5719
6526
  },
5720
6527
  update: {
5721
6528
  id: item.alpacaAccount.id !== undefined ? {
@@ -5817,7 +6624,15 @@ exports.Asset = {
5817
6624
  trades: item.alpacaAccount.trades ? {
5818
6625
  upsert: item.alpacaAccount.trades.map((item) => ({
5819
6626
  where: {
5820
- id: item.id !== undefined ? item.id : undefined,
6627
+ id: item.id !== undefined ? {
6628
+ equals: item.id
6629
+ } : undefined,
6630
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6631
+ equals: item.alpacaAccountId
6632
+ } : undefined,
6633
+ assetId: item.assetId !== undefined ? {
6634
+ equals: item.assetId
6635
+ } : undefined,
5821
6636
  },
5822
6637
  update: {
5823
6638
  id: item.id !== undefined ? {
@@ -5875,7 +6690,18 @@ exports.Asset = {
5875
6690
  orders: item.alpacaAccount.orders ? {
5876
6691
  upsert: item.alpacaAccount.orders.map((item) => ({
5877
6692
  where: {
5878
- id: item.id !== undefined ? item.id : undefined,
6693
+ id: item.id !== undefined ? {
6694
+ equals: item.id
6695
+ } : undefined,
6696
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6697
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6698
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6699
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6700
+ equals: item.alpacaAccountId
6701
+ } : undefined,
6702
+ assetId: item.assetId !== undefined ? {
6703
+ equals: item.assetId
6704
+ } : undefined,
5879
6705
  },
5880
6706
  update: {
5881
6707
  id: item.id !== undefined ? {
@@ -5977,7 +6803,12 @@ exports.Asset = {
5977
6803
  alerts: item.alpacaAccount.alerts ? {
5978
6804
  upsert: item.alpacaAccount.alerts.map((item) => ({
5979
6805
  where: {
5980
- id: item.id !== undefined ? item.id : undefined,
6806
+ id: item.id !== undefined ? {
6807
+ equals: item.id
6808
+ } : undefined,
6809
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6810
+ equals: item.alpacaAccountId
6811
+ } : undefined,
5981
6812
  },
5982
6813
  update: {
5983
6814
  id: item.id !== undefined ? {
@@ -6019,7 +6850,9 @@ exports.Asset = {
6019
6850
  }
6020
6851
  : { connectOrCreate: {
6021
6852
  where: {
6022
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
6853
+ id: item.alpacaAccount.user.id !== undefined ? {
6854
+ equals: item.alpacaAccount.user.id
6855
+ } : undefined,
6023
6856
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
6024
6857
  name: item.alpacaAccount.user.name !== undefined ? {
6025
6858
  equals: item.alpacaAccount.user.name
@@ -6048,7 +6881,15 @@ exports.Asset = {
6048
6881
  }
6049
6882
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
6050
6883
  where: {
6051
- id: item.id !== undefined ? item.id : undefined,
6884
+ id: item.id !== undefined ? {
6885
+ equals: item.id
6886
+ } : undefined,
6887
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6888
+ equals: item.alpacaAccountId
6889
+ } : undefined,
6890
+ assetId: item.assetId !== undefined ? {
6891
+ equals: item.assetId
6892
+ } : undefined,
6052
6893
  },
6053
6894
  create: {
6054
6895
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -6073,7 +6914,18 @@ exports.Asset = {
6073
6914
  }
6074
6915
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
6075
6916
  where: {
6076
- id: item.id !== undefined ? item.id : undefined,
6917
+ id: item.id !== undefined ? {
6918
+ equals: item.id
6919
+ } : undefined,
6920
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6921
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6922
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6923
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6924
+ equals: item.alpacaAccountId
6925
+ } : undefined,
6926
+ assetId: item.assetId !== undefined ? {
6927
+ equals: item.assetId
6928
+ } : undefined,
6077
6929
  },
6078
6930
  create: {
6079
6931
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6109,7 +6961,12 @@ exports.Asset = {
6109
6961
  }
6110
6962
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
6111
6963
  where: {
6112
- id: item.id !== undefined ? item.id : undefined,
6964
+ id: item.id !== undefined ? {
6965
+ equals: item.id
6966
+ } : undefined,
6967
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6968
+ equals: item.alpacaAccountId
6969
+ } : undefined,
6113
6970
  },
6114
6971
  create: {
6115
6972
  message: item.message !== undefined ? item.message : undefined,
@@ -6144,7 +7001,12 @@ exports.Asset = {
6144
7001
  }
6145
7002
  : { connectOrCreate: {
6146
7003
  where: {
6147
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
7004
+ id: item.alpacaAccount.id !== undefined ? {
7005
+ equals: item.alpacaAccount.id
7006
+ } : undefined,
7007
+ userId: item.alpacaAccount.userId !== undefined ? {
7008
+ equals: item.alpacaAccount.userId
7009
+ } : undefined,
6148
7010
  },
6149
7011
  create: {
6150
7012
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -6164,7 +7026,9 @@ exports.Asset = {
6164
7026
  }
6165
7027
  : { connectOrCreate: {
6166
7028
  where: {
6167
- id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
7029
+ id: item.alpacaAccount.user.id !== undefined ? {
7030
+ equals: item.alpacaAccount.user.id
7031
+ } : undefined,
6168
7032
  email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
6169
7033
  name: item.alpacaAccount.user.name !== undefined ? {
6170
7034
  equals: item.alpacaAccount.user.name
@@ -6193,7 +7057,15 @@ exports.Asset = {
6193
7057
  }
6194
7058
  : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
6195
7059
  where: {
6196
- id: item.id !== undefined ? item.id : undefined,
7060
+ id: item.id !== undefined ? {
7061
+ equals: item.id
7062
+ } : undefined,
7063
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7064
+ equals: item.alpacaAccountId
7065
+ } : undefined,
7066
+ assetId: item.assetId !== undefined ? {
7067
+ equals: item.assetId
7068
+ } : undefined,
6197
7069
  },
6198
7070
  create: {
6199
7071
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -6218,7 +7090,18 @@ exports.Asset = {
6218
7090
  }
6219
7091
  : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
6220
7092
  where: {
6221
- id: item.id !== undefined ? item.id : undefined,
7093
+ id: item.id !== undefined ? {
7094
+ equals: item.id
7095
+ } : undefined,
7096
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7097
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7098
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7099
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7100
+ equals: item.alpacaAccountId
7101
+ } : undefined,
7102
+ assetId: item.assetId !== undefined ? {
7103
+ equals: item.assetId
7104
+ } : undefined,
6222
7105
  },
6223
7106
  create: {
6224
7107
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6254,7 +7137,12 @@ exports.Asset = {
6254
7137
  }
6255
7138
  : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
6256
7139
  where: {
6257
- id: item.id !== undefined ? item.id : undefined,
7140
+ id: item.id !== undefined ? {
7141
+ equals: item.id
7142
+ } : undefined,
7143
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7144
+ equals: item.alpacaAccountId
7145
+ } : undefined,
6258
7146
  },
6259
7147
  create: {
6260
7148
  message: item.message !== undefined ? item.message : undefined,
@@ -6272,8 +7160,16 @@ exports.Asset = {
6272
7160
  newsMentions: prop.newsMentions ? {
6273
7161
  upsert: prop.newsMentions.map((item) => ({
6274
7162
  where: {
6275
- id: item.id !== undefined ? item.id : undefined,
7163
+ id: item.id !== undefined ? {
7164
+ equals: item.id
7165
+ } : undefined,
6276
7166
  url: item.url !== undefined ? item.url : undefined,
7167
+ assetId: item.assetId !== undefined ? {
7168
+ equals: item.assetId
7169
+ } : undefined,
7170
+ newsArticleId: item.newsArticleId !== undefined ? {
7171
+ equals: item.newsArticleId
7172
+ } : undefined,
6277
7173
  },
6278
7174
  update: {
6279
7175
  id: item.id !== undefined ? {
@@ -6379,7 +7275,9 @@ exports.Asset = {
6379
7275
  }
6380
7276
  : { connectOrCreate: {
6381
7277
  where: {
6382
- id: item.news.id !== undefined ? item.news.id : undefined,
7278
+ id: item.news.id !== undefined ? {
7279
+ equals: item.news.id
7280
+ } : undefined,
6383
7281
  url: item.news.url !== undefined ? item.news.url : undefined,
6384
7282
  title: item.news.title !== undefined ? {
6385
7283
  equals: item.news.title
@@ -6475,7 +7373,9 @@ exports.Asset = {
6475
7373
  }`;
6476
7374
  const variables = {
6477
7375
  where: {
6478
- id: props.id !== undefined ? props.id : undefined,
7376
+ id: props.id !== undefined ? {
7377
+ equals: props.id
7378
+ } : undefined,
6479
7379
  symbol: props.symbol !== undefined ? props.symbol : undefined,
6480
7380
  name: props.name !== undefined ? props.name : undefined,
6481
7381
  type: props.type !== undefined ? props.type : undefined,