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/server/Trade.mjs CHANGED
@@ -293,7 +293,12 @@ export const Trade = {
293
293
  }
294
294
  : { connectOrCreate: {
295
295
  where: {
296
- id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
296
+ id: props.alpacaAccount.id !== undefined ? {
297
+ equals: props.alpacaAccount.id
298
+ } : undefined,
299
+ userId: props.alpacaAccount.userId !== undefined ? {
300
+ equals: props.alpacaAccount.userId
301
+ } : undefined,
297
302
  },
298
303
  create: {
299
304
  type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
@@ -313,7 +318,9 @@ export const Trade = {
313
318
  }
314
319
  : { connectOrCreate: {
315
320
  where: {
316
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
321
+ id: props.alpacaAccount.user.id !== undefined ? {
322
+ equals: props.alpacaAccount.user.id
323
+ } : undefined,
317
324
  email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
318
325
  name: props.alpacaAccount.user.name !== undefined ? {
319
326
  equals: props.alpacaAccount.user.name
@@ -339,10 +346,20 @@ export const Trade = {
339
346
  }
340
347
  : { connectOrCreate: {
341
348
  where: {
342
- id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
349
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
350
+ equals: props.alpacaAccount.user.customer.id
351
+ } : undefined,
352
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
353
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
354
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
355
+ equals: props.alpacaAccount.user.customer.authUserId
356
+ } : undefined,
343
357
  name: props.alpacaAccount.user.customer.name !== undefined ? {
344
358
  equals: props.alpacaAccount.user.customer.name
345
359
  } : undefined,
360
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
361
+ equals: props.alpacaAccount.user.customer.stripePriceId
362
+ } : undefined,
346
363
  },
347
364
  create: {
348
365
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -363,7 +380,15 @@ export const Trade = {
363
380
  }
364
381
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
365
382
  where: {
366
- id: item.id !== undefined ? item.id : undefined,
383
+ id: item.id !== undefined ? {
384
+ equals: item.id
385
+ } : undefined,
386
+ userId: item.userId !== undefined ? {
387
+ equals: item.userId
388
+ } : undefined,
389
+ providerAccountId: item.providerAccountId !== undefined ? {
390
+ equals: item.providerAccountId
391
+ } : undefined,
367
392
  },
368
393
  create: {
369
394
  type: item.type !== undefined ? item.type : undefined,
@@ -387,7 +412,12 @@ export const Trade = {
387
412
  }
388
413
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
389
414
  where: {
390
- id: item.id !== undefined ? item.id : undefined,
415
+ id: item.id !== undefined ? {
416
+ equals: item.id
417
+ } : undefined,
418
+ userId: item.userId !== undefined ? {
419
+ equals: item.userId
420
+ } : undefined,
391
421
  },
392
422
  create: {
393
423
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -403,7 +433,12 @@ export const Trade = {
403
433
  }
404
434
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
405
435
  where: {
406
- id: item.id !== undefined ? item.id : undefined,
436
+ id: item.id !== undefined ? {
437
+ equals: item.id
438
+ } : undefined,
439
+ userId: item.userId !== undefined ? {
440
+ equals: item.userId
441
+ } : undefined,
407
442
  },
408
443
  create: {
409
444
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -423,7 +458,18 @@ export const Trade = {
423
458
  }
424
459
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
425
460
  where: {
426
- id: item.id !== undefined ? item.id : undefined,
461
+ id: item.id !== undefined ? {
462
+ equals: item.id
463
+ } : undefined,
464
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
465
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
466
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
467
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
468
+ equals: item.alpacaAccountId
469
+ } : undefined,
470
+ assetId: item.assetId !== undefined ? {
471
+ equals: item.assetId
472
+ } : undefined,
427
473
  },
428
474
  create: {
429
475
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -456,7 +502,10 @@ export const Trade = {
456
502
  }
457
503
  : { connectOrCreate: {
458
504
  where: {
459
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
505
+ id: item.stopLoss.id !== undefined ? {
506
+ equals: item.stopLoss.id
507
+ } : undefined,
508
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
460
509
  },
461
510
  create: {
462
511
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -472,7 +521,10 @@ export const Trade = {
472
521
  }
473
522
  : { connectOrCreate: {
474
523
  where: {
475
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
524
+ id: item.takeProfit.id !== undefined ? {
525
+ equals: item.takeProfit.id
526
+ } : undefined,
527
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
476
528
  },
477
529
  create: {
478
530
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -488,7 +540,12 @@ export const Trade = {
488
540
  }
489
541
  : { connectOrCreate: {
490
542
  where: {
491
- id: item.action.id !== undefined ? item.action.id : undefined,
543
+ id: item.action.id !== undefined ? {
544
+ equals: item.action.id
545
+ } : undefined,
546
+ tradeId: item.action.tradeId !== undefined ? {
547
+ equals: item.action.tradeId
548
+ } : undefined,
492
549
  },
493
550
  create: {
494
551
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -507,7 +564,9 @@ export const Trade = {
507
564
  }
508
565
  : { connectOrCreate: {
509
566
  where: {
510
- id: item.asset.id !== undefined ? item.asset.id : undefined,
567
+ id: item.asset.id !== undefined ? {
568
+ equals: item.asset.id
569
+ } : undefined,
511
570
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
512
571
  name: item.asset.name !== undefined ? item.asset.name : undefined,
513
572
  },
@@ -581,7 +640,15 @@ export const Trade = {
581
640
  }
582
641
  : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
583
642
  where: {
584
- id: item.id !== undefined ? item.id : undefined,
643
+ id: item.id !== undefined ? {
644
+ equals: item.id
645
+ } : undefined,
646
+ assetId: item.assetId !== undefined ? {
647
+ equals: item.assetId
648
+ } : undefined,
649
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
650
+ equals: item.alpacaAccountId
651
+ } : undefined,
585
652
  },
586
653
  create: {
587
654
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -605,7 +672,9 @@ export const Trade = {
605
672
  }
606
673
  : { connectOrCreate: {
607
674
  where: {
608
- id: item.asset.id !== undefined ? item.asset.id : undefined,
675
+ id: item.asset.id !== undefined ? {
676
+ equals: item.asset.id
677
+ } : undefined,
609
678
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
610
679
  name: item.asset.name !== undefined ? item.asset.name : undefined,
611
680
  },
@@ -679,7 +748,12 @@ export const Trade = {
679
748
  }
680
749
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
681
750
  where: {
682
- id: item.id !== undefined ? item.id : undefined,
751
+ id: item.id !== undefined ? {
752
+ equals: item.id
753
+ } : undefined,
754
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
755
+ equals: item.alpacaAccountId
756
+ } : undefined,
683
757
  },
684
758
  create: {
685
759
  message: item.message !== undefined ? item.message : undefined,
@@ -699,7 +773,9 @@ export const Trade = {
699
773
  }
700
774
  : { connectOrCreate: {
701
775
  where: {
702
- id: props.asset.id !== undefined ? props.asset.id : undefined,
776
+ id: props.asset.id !== undefined ? {
777
+ equals: props.asset.id
778
+ } : undefined,
703
779
  symbol: props.asset.symbol !== undefined ? props.asset.symbol : undefined,
704
780
  name: props.asset.name !== undefined ? props.asset.name : undefined,
705
781
  },
@@ -767,7 +843,18 @@ export const Trade = {
767
843
  }
768
844
  : { connectOrCreate: props.asset.orders.map((item) => ({
769
845
  where: {
770
- id: item.id !== undefined ? item.id : undefined,
846
+ id: item.id !== undefined ? {
847
+ equals: item.id
848
+ } : undefined,
849
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
850
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
851
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
852
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
853
+ equals: item.alpacaAccountId
854
+ } : undefined,
855
+ assetId: item.assetId !== undefined ? {
856
+ equals: item.assetId
857
+ } : undefined,
771
858
  },
772
859
  create: {
773
860
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -800,7 +887,10 @@ export const Trade = {
800
887
  }
801
888
  : { connectOrCreate: {
802
889
  where: {
803
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
890
+ id: item.stopLoss.id !== undefined ? {
891
+ equals: item.stopLoss.id
892
+ } : undefined,
893
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
804
894
  },
805
895
  create: {
806
896
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -816,7 +906,10 @@ export const Trade = {
816
906
  }
817
907
  : { connectOrCreate: {
818
908
  where: {
819
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
909
+ id: item.takeProfit.id !== undefined ? {
910
+ equals: item.takeProfit.id
911
+ } : undefined,
912
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
820
913
  },
821
914
  create: {
822
915
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -832,7 +925,12 @@ export const Trade = {
832
925
  }
833
926
  : { connectOrCreate: {
834
927
  where: {
835
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
928
+ id: item.alpacaAccount.id !== undefined ? {
929
+ equals: item.alpacaAccount.id
930
+ } : undefined,
931
+ userId: item.alpacaAccount.userId !== undefined ? {
932
+ equals: item.alpacaAccount.userId
933
+ } : undefined,
836
934
  },
837
935
  create: {
838
936
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -855,7 +953,12 @@ export const Trade = {
855
953
  }
856
954
  : { connectOrCreate: {
857
955
  where: {
858
- id: item.action.id !== undefined ? item.action.id : undefined,
956
+ id: item.action.id !== undefined ? {
957
+ equals: item.action.id
958
+ } : undefined,
959
+ tradeId: item.action.tradeId !== undefined ? {
960
+ equals: item.action.tradeId
961
+ } : undefined,
859
962
  },
860
963
  create: {
861
964
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -877,7 +980,15 @@ export const Trade = {
877
980
  }
878
981
  : { connectOrCreate: props.asset.positions.map((item) => ({
879
982
  where: {
880
- id: item.id !== undefined ? item.id : undefined,
983
+ id: item.id !== undefined ? {
984
+ equals: item.id
985
+ } : undefined,
986
+ assetId: item.assetId !== undefined ? {
987
+ equals: item.assetId
988
+ } : undefined,
989
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
990
+ equals: item.alpacaAccountId
991
+ } : undefined,
881
992
  },
882
993
  create: {
883
994
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -901,7 +1012,12 @@ export const Trade = {
901
1012
  }
902
1013
  : { connectOrCreate: {
903
1014
  where: {
904
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1015
+ id: item.alpacaAccount.id !== undefined ? {
1016
+ equals: item.alpacaAccount.id
1017
+ } : undefined,
1018
+ userId: item.alpacaAccount.userId !== undefined ? {
1019
+ equals: item.alpacaAccount.userId
1020
+ } : undefined,
905
1021
  },
906
1022
  create: {
907
1023
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -927,8 +1043,16 @@ export const Trade = {
927
1043
  }
928
1044
  : { connectOrCreate: props.asset.newsMentions.map((item) => ({
929
1045
  where: {
930
- id: item.id !== undefined ? item.id : undefined,
1046
+ id: item.id !== undefined ? {
1047
+ equals: item.id
1048
+ } : undefined,
931
1049
  url: item.url !== undefined ? item.url : undefined,
1050
+ assetId: item.assetId !== undefined ? {
1051
+ equals: item.assetId
1052
+ } : undefined,
1053
+ newsArticleId: item.newsArticleId !== undefined ? {
1054
+ equals: item.newsArticleId
1055
+ } : undefined,
932
1056
  },
933
1057
  create: {
934
1058
  url: item.url !== undefined ? item.url : undefined,
@@ -943,7 +1067,9 @@ export const Trade = {
943
1067
  }
944
1068
  : { connectOrCreate: {
945
1069
  where: {
946
- id: item.news.id !== undefined ? item.news.id : undefined,
1070
+ id: item.news.id !== undefined ? {
1071
+ equals: item.news.id
1072
+ } : undefined,
947
1073
  url: item.news.url !== undefined ? item.news.url : undefined,
948
1074
  title: item.news.title !== undefined ? {
949
1075
  equals: item.news.title
@@ -980,7 +1106,12 @@ export const Trade = {
980
1106
  }
981
1107
  : { connectOrCreate: props.actions.map((item) => ({
982
1108
  where: {
983
- id: item.id !== undefined ? item.id : undefined,
1109
+ id: item.id !== undefined ? {
1110
+ equals: item.id
1111
+ } : undefined,
1112
+ tradeId: item.tradeId !== undefined ? {
1113
+ equals: item.tradeId
1114
+ } : undefined,
984
1115
  },
985
1116
  create: {
986
1117
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -996,7 +1127,18 @@ export const Trade = {
996
1127
  }
997
1128
  : { connectOrCreate: {
998
1129
  where: {
999
- id: item.order.id !== undefined ? item.order.id : undefined,
1130
+ id: item.order.id !== undefined ? {
1131
+ equals: item.order.id
1132
+ } : undefined,
1133
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
1134
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
1135
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
1136
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
1137
+ equals: item.order.alpacaAccountId
1138
+ } : undefined,
1139
+ assetId: item.order.assetId !== undefined ? {
1140
+ equals: item.order.assetId
1141
+ } : undefined,
1000
1142
  },
1001
1143
  create: {
1002
1144
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -1029,7 +1171,10 @@ export const Trade = {
1029
1171
  }
1030
1172
  : { connectOrCreate: {
1031
1173
  where: {
1032
- id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
1174
+ id: item.order.stopLoss.id !== undefined ? {
1175
+ equals: item.order.stopLoss.id
1176
+ } : undefined,
1177
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
1033
1178
  },
1034
1179
  create: {
1035
1180
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -1045,7 +1190,10 @@ export const Trade = {
1045
1190
  }
1046
1191
  : { connectOrCreate: {
1047
1192
  where: {
1048
- id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
1193
+ id: item.order.takeProfit.id !== undefined ? {
1194
+ equals: item.order.takeProfit.id
1195
+ } : undefined,
1196
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
1049
1197
  },
1050
1198
  create: {
1051
1199
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -1061,7 +1209,12 @@ export const Trade = {
1061
1209
  }
1062
1210
  : { connectOrCreate: {
1063
1211
  where: {
1064
- id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
1212
+ id: item.order.alpacaAccount.id !== undefined ? {
1213
+ equals: item.order.alpacaAccount.id
1214
+ } : undefined,
1215
+ userId: item.order.alpacaAccount.userId !== undefined ? {
1216
+ equals: item.order.alpacaAccount.userId
1217
+ } : undefined,
1065
1218
  },
1066
1219
  create: {
1067
1220
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -1084,7 +1237,9 @@ export const Trade = {
1084
1237
  }
1085
1238
  : { connectOrCreate: {
1086
1239
  where: {
1087
- id: item.order.asset.id !== undefined ? item.order.asset.id : undefined,
1240
+ id: item.order.asset.id !== undefined ? {
1241
+ equals: item.order.asset.id
1242
+ } : undefined,
1088
1243
  symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
1089
1244
  name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
1090
1245
  },
@@ -1234,9 +1389,15 @@ export const Trade = {
1234
1389
  }`;
1235
1390
  const variables = {
1236
1391
  where: {
1237
- id: props.id !== undefined ? props.id : undefined,
1238
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
1239
- assetId: props.assetId !== undefined ? props.assetId : undefined,
1392
+ id: props.id !== undefined ? {
1393
+ equals: props.id
1394
+ } : undefined,
1395
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
1396
+ equals: props.alpacaAccountId
1397
+ } : undefined,
1398
+ assetId: props.assetId !== undefined ? {
1399
+ equals: props.assetId
1400
+ } : undefined,
1240
1401
  qty: props.qty !== undefined ? props.qty : undefined,
1241
1402
  price: props.price !== undefined ? props.price : undefined,
1242
1403
  total: props.total !== undefined ? props.total : undefined,
@@ -1300,6 +1461,9 @@ export const Trade = {
1300
1461
  id: props.alpacaAccount.id !== undefined ? {
1301
1462
  equals: props.alpacaAccount.id
1302
1463
  } : undefined,
1464
+ userId: props.alpacaAccount.userId !== undefined ? {
1465
+ equals: props.alpacaAccount.userId
1466
+ } : undefined,
1303
1467
  },
1304
1468
  update: {
1305
1469
  id: props.alpacaAccount.id !== undefined ? {
@@ -1388,9 +1552,21 @@ export const Trade = {
1388
1552
  id: props.alpacaAccount.user.customer.id !== undefined ? {
1389
1553
  equals: props.alpacaAccount.user.customer.id
1390
1554
  } : undefined,
1555
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
1556
+ equals: props.alpacaAccount.user.customer.authUserId
1557
+ } : undefined,
1391
1558
  name: props.alpacaAccount.user.customer.name !== undefined ? {
1392
1559
  equals: props.alpacaAccount.user.customer.name
1393
1560
  } : undefined,
1561
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
1562
+ equals: props.alpacaAccount.user.customer.stripeCustomerId
1563
+ } : undefined,
1564
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
1565
+ equals: props.alpacaAccount.user.customer.stripeSubscriptionId
1566
+ } : undefined,
1567
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
1568
+ equals: props.alpacaAccount.user.customer.stripePriceId
1569
+ } : undefined,
1394
1570
  },
1395
1571
  update: {
1396
1572
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -1429,7 +1605,15 @@ export const Trade = {
1429
1605
  accounts: props.alpacaAccount.user.accounts ? {
1430
1606
  upsert: props.alpacaAccount.user.accounts.map((item) => ({
1431
1607
  where: {
1432
- id: item.id !== undefined ? item.id : undefined,
1608
+ id: item.id !== undefined ? {
1609
+ equals: item.id
1610
+ } : undefined,
1611
+ userId: item.userId !== undefined ? {
1612
+ equals: item.userId
1613
+ } : undefined,
1614
+ providerAccountId: item.providerAccountId !== undefined ? {
1615
+ equals: item.providerAccountId
1616
+ } : undefined,
1433
1617
  },
1434
1618
  update: {
1435
1619
  id: item.id !== undefined ? {
@@ -1483,7 +1667,12 @@ export const Trade = {
1483
1667
  sessions: props.alpacaAccount.user.sessions ? {
1484
1668
  upsert: props.alpacaAccount.user.sessions.map((item) => ({
1485
1669
  where: {
1486
- id: item.id !== undefined ? item.id : undefined,
1670
+ id: item.id !== undefined ? {
1671
+ equals: item.id
1672
+ } : undefined,
1673
+ userId: item.userId !== undefined ? {
1674
+ equals: item.userId
1675
+ } : undefined,
1487
1676
  },
1488
1677
  update: {
1489
1678
  id: item.id !== undefined ? {
@@ -1505,7 +1694,12 @@ export const Trade = {
1505
1694
  authenticators: props.alpacaAccount.user.authenticators ? {
1506
1695
  upsert: props.alpacaAccount.user.authenticators.map((item) => ({
1507
1696
  where: {
1508
- id: item.id !== undefined ? item.id : undefined,
1697
+ id: item.id !== undefined ? {
1698
+ equals: item.id
1699
+ } : undefined,
1700
+ userId: item.userId !== undefined ? {
1701
+ equals: item.userId
1702
+ } : undefined,
1509
1703
  },
1510
1704
  update: {
1511
1705
  id: item.id !== undefined ? {
@@ -1549,10 +1743,20 @@ export const Trade = {
1549
1743
  }
1550
1744
  : { connectOrCreate: {
1551
1745
  where: {
1552
- id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
1746
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
1747
+ equals: props.alpacaAccount.user.customer.id
1748
+ } : undefined,
1749
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
1750
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
1751
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
1752
+ equals: props.alpacaAccount.user.customer.authUserId
1753
+ } : undefined,
1553
1754
  name: props.alpacaAccount.user.customer.name !== undefined ? {
1554
1755
  equals: props.alpacaAccount.user.customer.name
1555
1756
  } : undefined,
1757
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
1758
+ equals: props.alpacaAccount.user.customer.stripePriceId
1759
+ } : undefined,
1556
1760
  },
1557
1761
  create: {
1558
1762
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -1573,7 +1777,15 @@ export const Trade = {
1573
1777
  }
1574
1778
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
1575
1779
  where: {
1576
- id: item.id !== undefined ? item.id : undefined,
1780
+ id: item.id !== undefined ? {
1781
+ equals: item.id
1782
+ } : undefined,
1783
+ userId: item.userId !== undefined ? {
1784
+ equals: item.userId
1785
+ } : undefined,
1786
+ providerAccountId: item.providerAccountId !== undefined ? {
1787
+ equals: item.providerAccountId
1788
+ } : undefined,
1577
1789
  },
1578
1790
  create: {
1579
1791
  type: item.type !== undefined ? item.type : undefined,
@@ -1597,7 +1809,12 @@ export const Trade = {
1597
1809
  }
1598
1810
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
1599
1811
  where: {
1600
- id: item.id !== undefined ? item.id : undefined,
1812
+ id: item.id !== undefined ? {
1813
+ equals: item.id
1814
+ } : undefined,
1815
+ userId: item.userId !== undefined ? {
1816
+ equals: item.userId
1817
+ } : undefined,
1601
1818
  },
1602
1819
  create: {
1603
1820
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -1613,7 +1830,12 @@ export const Trade = {
1613
1830
  }
1614
1831
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
1615
1832
  where: {
1616
- id: item.id !== undefined ? item.id : undefined,
1833
+ id: item.id !== undefined ? {
1834
+ equals: item.id
1835
+ } : undefined,
1836
+ userId: item.userId !== undefined ? {
1837
+ equals: item.userId
1838
+ } : undefined,
1617
1839
  },
1618
1840
  create: {
1619
1841
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -1628,7 +1850,18 @@ export const Trade = {
1628
1850
  orders: props.alpacaAccount.orders ? {
1629
1851
  upsert: props.alpacaAccount.orders.map((item) => ({
1630
1852
  where: {
1631
- id: item.id !== undefined ? item.id : undefined,
1853
+ id: item.id !== undefined ? {
1854
+ equals: item.id
1855
+ } : undefined,
1856
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1857
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1858
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1859
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1860
+ equals: item.alpacaAccountId
1861
+ } : undefined,
1862
+ assetId: item.assetId !== undefined ? {
1863
+ equals: item.assetId
1864
+ } : undefined,
1632
1865
  },
1633
1866
  update: {
1634
1867
  id: item.id !== undefined ? {
@@ -1706,6 +1939,9 @@ export const Trade = {
1706
1939
  id: item.stopLoss.id !== undefined ? {
1707
1940
  equals: item.stopLoss.id
1708
1941
  } : undefined,
1942
+ orderId: item.stopLoss.orderId !== undefined ? {
1943
+ equals: item.stopLoss.orderId
1944
+ } : undefined,
1709
1945
  },
1710
1946
  update: {
1711
1947
  id: item.stopLoss.id !== undefined ? {
@@ -1730,6 +1966,9 @@ export const Trade = {
1730
1966
  id: item.takeProfit.id !== undefined ? {
1731
1967
  equals: item.takeProfit.id
1732
1968
  } : undefined,
1969
+ orderId: item.takeProfit.orderId !== undefined ? {
1970
+ equals: item.takeProfit.orderId
1971
+ } : undefined,
1733
1972
  },
1734
1973
  update: {
1735
1974
  id: item.takeProfit.id !== undefined ? {
@@ -1754,6 +1993,9 @@ export const Trade = {
1754
1993
  id: item.action.id !== undefined ? {
1755
1994
  equals: item.action.id
1756
1995
  } : undefined,
1996
+ tradeId: item.action.tradeId !== undefined ? {
1997
+ equals: item.action.tradeId
1998
+ } : undefined,
1757
1999
  },
1758
2000
  update: {
1759
2001
  id: item.action.id !== undefined ? {
@@ -2058,7 +2300,10 @@ export const Trade = {
2058
2300
  }
2059
2301
  : { connectOrCreate: {
2060
2302
  where: {
2061
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2303
+ id: item.stopLoss.id !== undefined ? {
2304
+ equals: item.stopLoss.id
2305
+ } : undefined,
2306
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2062
2307
  },
2063
2308
  create: {
2064
2309
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2074,7 +2319,10 @@ export const Trade = {
2074
2319
  }
2075
2320
  : { connectOrCreate: {
2076
2321
  where: {
2077
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2322
+ id: item.takeProfit.id !== undefined ? {
2323
+ equals: item.takeProfit.id
2324
+ } : undefined,
2325
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2078
2326
  },
2079
2327
  create: {
2080
2328
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2090,7 +2338,12 @@ export const Trade = {
2090
2338
  }
2091
2339
  : { connectOrCreate: {
2092
2340
  where: {
2093
- id: item.action.id !== undefined ? item.action.id : undefined,
2341
+ id: item.action.id !== undefined ? {
2342
+ equals: item.action.id
2343
+ } : undefined,
2344
+ tradeId: item.action.tradeId !== undefined ? {
2345
+ equals: item.action.tradeId
2346
+ } : undefined,
2094
2347
  },
2095
2348
  create: {
2096
2349
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2109,7 +2362,9 @@ export const Trade = {
2109
2362
  }
2110
2363
  : { connectOrCreate: {
2111
2364
  where: {
2112
- id: item.asset.id !== undefined ? item.asset.id : undefined,
2365
+ id: item.asset.id !== undefined ? {
2366
+ equals: item.asset.id
2367
+ } : undefined,
2113
2368
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2114
2369
  name: item.asset.name !== undefined ? item.asset.name : undefined,
2115
2370
  },
@@ -2178,7 +2433,15 @@ export const Trade = {
2178
2433
  positions: props.alpacaAccount.positions ? {
2179
2434
  upsert: props.alpacaAccount.positions.map((item) => ({
2180
2435
  where: {
2181
- id: item.id !== undefined ? item.id : undefined,
2436
+ id: item.id !== undefined ? {
2437
+ equals: item.id
2438
+ } : undefined,
2439
+ assetId: item.assetId !== undefined ? {
2440
+ equals: item.assetId
2441
+ } : undefined,
2442
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2443
+ equals: item.alpacaAccountId
2444
+ } : undefined,
2182
2445
  },
2183
2446
  update: {
2184
2447
  id: item.id !== undefined ? {
@@ -2488,7 +2751,9 @@ export const Trade = {
2488
2751
  }
2489
2752
  : { connectOrCreate: {
2490
2753
  where: {
2491
- id: item.asset.id !== undefined ? item.asset.id : undefined,
2754
+ id: item.asset.id !== undefined ? {
2755
+ equals: item.asset.id
2756
+ } : undefined,
2492
2757
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2493
2758
  name: item.asset.name !== undefined ? item.asset.name : undefined,
2494
2759
  },
@@ -2557,7 +2822,12 @@ export const Trade = {
2557
2822
  alerts: props.alpacaAccount.alerts ? {
2558
2823
  upsert: props.alpacaAccount.alerts.map((item) => ({
2559
2824
  where: {
2560
- id: item.id !== undefined ? item.id : undefined,
2825
+ id: item.id !== undefined ? {
2826
+ equals: item.id
2827
+ } : undefined,
2828
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2829
+ equals: item.alpacaAccountId
2830
+ } : undefined,
2561
2831
  },
2562
2832
  update: {
2563
2833
  id: item.id !== undefined ? {
@@ -2599,7 +2869,9 @@ export const Trade = {
2599
2869
  }
2600
2870
  : { connectOrCreate: {
2601
2871
  where: {
2602
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
2872
+ id: props.alpacaAccount.user.id !== undefined ? {
2873
+ equals: props.alpacaAccount.user.id
2874
+ } : undefined,
2603
2875
  email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
2604
2876
  name: props.alpacaAccount.user.name !== undefined ? {
2605
2877
  equals: props.alpacaAccount.user.name
@@ -2625,10 +2897,20 @@ export const Trade = {
2625
2897
  }
2626
2898
  : { connectOrCreate: {
2627
2899
  where: {
2628
- id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
2900
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
2901
+ equals: props.alpacaAccount.user.customer.id
2902
+ } : undefined,
2903
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2904
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2905
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2906
+ equals: props.alpacaAccount.user.customer.authUserId
2907
+ } : undefined,
2629
2908
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2630
2909
  equals: props.alpacaAccount.user.customer.name
2631
2910
  } : undefined,
2911
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2912
+ equals: props.alpacaAccount.user.customer.stripePriceId
2913
+ } : undefined,
2632
2914
  },
2633
2915
  create: {
2634
2916
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -2649,7 +2931,15 @@ export const Trade = {
2649
2931
  }
2650
2932
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
2651
2933
  where: {
2652
- id: item.id !== undefined ? item.id : undefined,
2934
+ id: item.id !== undefined ? {
2935
+ equals: item.id
2936
+ } : undefined,
2937
+ userId: item.userId !== undefined ? {
2938
+ equals: item.userId
2939
+ } : undefined,
2940
+ providerAccountId: item.providerAccountId !== undefined ? {
2941
+ equals: item.providerAccountId
2942
+ } : undefined,
2653
2943
  },
2654
2944
  create: {
2655
2945
  type: item.type !== undefined ? item.type : undefined,
@@ -2673,7 +2963,12 @@ export const Trade = {
2673
2963
  }
2674
2964
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
2675
2965
  where: {
2676
- id: item.id !== undefined ? item.id : undefined,
2966
+ id: item.id !== undefined ? {
2967
+ equals: item.id
2968
+ } : undefined,
2969
+ userId: item.userId !== undefined ? {
2970
+ equals: item.userId
2971
+ } : undefined,
2677
2972
  },
2678
2973
  create: {
2679
2974
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -2689,7 +2984,12 @@ export const Trade = {
2689
2984
  }
2690
2985
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
2691
2986
  where: {
2692
- id: item.id !== undefined ? item.id : undefined,
2987
+ id: item.id !== undefined ? {
2988
+ equals: item.id
2989
+ } : undefined,
2990
+ userId: item.userId !== undefined ? {
2991
+ equals: item.userId
2992
+ } : undefined,
2693
2993
  },
2694
2994
  create: {
2695
2995
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -2709,7 +3009,18 @@ export const Trade = {
2709
3009
  }
2710
3010
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
2711
3011
  where: {
2712
- id: item.id !== undefined ? item.id : undefined,
3012
+ id: item.id !== undefined ? {
3013
+ equals: item.id
3014
+ } : undefined,
3015
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3016
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3017
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3018
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3019
+ equals: item.alpacaAccountId
3020
+ } : undefined,
3021
+ assetId: item.assetId !== undefined ? {
3022
+ equals: item.assetId
3023
+ } : undefined,
2713
3024
  },
2714
3025
  create: {
2715
3026
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2742,7 +3053,10 @@ export const Trade = {
2742
3053
  }
2743
3054
  : { connectOrCreate: {
2744
3055
  where: {
2745
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3056
+ id: item.stopLoss.id !== undefined ? {
3057
+ equals: item.stopLoss.id
3058
+ } : undefined,
3059
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2746
3060
  },
2747
3061
  create: {
2748
3062
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2758,7 +3072,10 @@ export const Trade = {
2758
3072
  }
2759
3073
  : { connectOrCreate: {
2760
3074
  where: {
2761
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3075
+ id: item.takeProfit.id !== undefined ? {
3076
+ equals: item.takeProfit.id
3077
+ } : undefined,
3078
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2762
3079
  },
2763
3080
  create: {
2764
3081
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2774,7 +3091,12 @@ export const Trade = {
2774
3091
  }
2775
3092
  : { connectOrCreate: {
2776
3093
  where: {
2777
- id: item.action.id !== undefined ? item.action.id : undefined,
3094
+ id: item.action.id !== undefined ? {
3095
+ equals: item.action.id
3096
+ } : undefined,
3097
+ tradeId: item.action.tradeId !== undefined ? {
3098
+ equals: item.action.tradeId
3099
+ } : undefined,
2778
3100
  },
2779
3101
  create: {
2780
3102
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2793,7 +3115,9 @@ export const Trade = {
2793
3115
  }
2794
3116
  : { connectOrCreate: {
2795
3117
  where: {
2796
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3118
+ id: item.asset.id !== undefined ? {
3119
+ equals: item.asset.id
3120
+ } : undefined,
2797
3121
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2798
3122
  name: item.asset.name !== undefined ? item.asset.name : undefined,
2799
3123
  },
@@ -2867,7 +3191,15 @@ export const Trade = {
2867
3191
  }
2868
3192
  : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
2869
3193
  where: {
2870
- id: item.id !== undefined ? item.id : undefined,
3194
+ id: item.id !== undefined ? {
3195
+ equals: item.id
3196
+ } : undefined,
3197
+ assetId: item.assetId !== undefined ? {
3198
+ equals: item.assetId
3199
+ } : undefined,
3200
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3201
+ equals: item.alpacaAccountId
3202
+ } : undefined,
2871
3203
  },
2872
3204
  create: {
2873
3205
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -2891,7 +3223,9 @@ export const Trade = {
2891
3223
  }
2892
3224
  : { connectOrCreate: {
2893
3225
  where: {
2894
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3226
+ id: item.asset.id !== undefined ? {
3227
+ equals: item.asset.id
3228
+ } : undefined,
2895
3229
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2896
3230
  name: item.asset.name !== undefined ? item.asset.name : undefined,
2897
3231
  },
@@ -2965,7 +3299,12 @@ export const Trade = {
2965
3299
  }
2966
3300
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
2967
3301
  where: {
2968
- id: item.id !== undefined ? item.id : undefined,
3302
+ id: item.id !== undefined ? {
3303
+ equals: item.id
3304
+ } : undefined,
3305
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3306
+ equals: item.alpacaAccountId
3307
+ } : undefined,
2969
3308
  },
2970
3309
  create: {
2971
3310
  message: item.message !== undefined ? item.message : undefined,
@@ -3162,7 +3501,18 @@ export const Trade = {
3162
3501
  orders: props.asset.orders ? {
3163
3502
  upsert: props.asset.orders.map((item) => ({
3164
3503
  where: {
3165
- id: item.id !== undefined ? item.id : undefined,
3504
+ id: item.id !== undefined ? {
3505
+ equals: item.id
3506
+ } : undefined,
3507
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3508
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3509
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3510
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3511
+ equals: item.alpacaAccountId
3512
+ } : undefined,
3513
+ assetId: item.assetId !== undefined ? {
3514
+ equals: item.assetId
3515
+ } : undefined,
3166
3516
  },
3167
3517
  update: {
3168
3518
  id: item.id !== undefined ? {
@@ -3240,6 +3590,9 @@ export const Trade = {
3240
3590
  id: item.stopLoss.id !== undefined ? {
3241
3591
  equals: item.stopLoss.id
3242
3592
  } : undefined,
3593
+ orderId: item.stopLoss.orderId !== undefined ? {
3594
+ equals: item.stopLoss.orderId
3595
+ } : undefined,
3243
3596
  },
3244
3597
  update: {
3245
3598
  id: item.stopLoss.id !== undefined ? {
@@ -3264,6 +3617,9 @@ export const Trade = {
3264
3617
  id: item.takeProfit.id !== undefined ? {
3265
3618
  equals: item.takeProfit.id
3266
3619
  } : undefined,
3620
+ orderId: item.takeProfit.orderId !== undefined ? {
3621
+ equals: item.takeProfit.orderId
3622
+ } : undefined,
3267
3623
  },
3268
3624
  update: {
3269
3625
  id: item.takeProfit.id !== undefined ? {
@@ -3288,6 +3644,9 @@ export const Trade = {
3288
3644
  id: item.alpacaAccount.id !== undefined ? {
3289
3645
  equals: item.alpacaAccount.id
3290
3646
  } : undefined,
3647
+ userId: item.alpacaAccount.userId !== undefined ? {
3648
+ equals: item.alpacaAccount.userId
3649
+ } : undefined,
3291
3650
  },
3292
3651
  update: {
3293
3652
  id: item.alpacaAccount.id !== undefined ? {
@@ -3340,6 +3699,9 @@ export const Trade = {
3340
3699
  id: item.action.id !== undefined ? {
3341
3700
  equals: item.action.id
3342
3701
  } : undefined,
3702
+ tradeId: item.action.tradeId !== undefined ? {
3703
+ equals: item.action.tradeId
3704
+ } : undefined,
3343
3705
  },
3344
3706
  update: {
3345
3707
  id: item.action.id !== undefined ? {
@@ -3402,7 +3764,10 @@ export const Trade = {
3402
3764
  }
3403
3765
  : { connectOrCreate: {
3404
3766
  where: {
3405
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3767
+ id: item.stopLoss.id !== undefined ? {
3768
+ equals: item.stopLoss.id
3769
+ } : undefined,
3770
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3406
3771
  },
3407
3772
  create: {
3408
3773
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3418,7 +3783,10 @@ export const Trade = {
3418
3783
  }
3419
3784
  : { connectOrCreate: {
3420
3785
  where: {
3421
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3786
+ id: item.takeProfit.id !== undefined ? {
3787
+ equals: item.takeProfit.id
3788
+ } : undefined,
3789
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3422
3790
  },
3423
3791
  create: {
3424
3792
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3434,7 +3802,12 @@ export const Trade = {
3434
3802
  }
3435
3803
  : { connectOrCreate: {
3436
3804
  where: {
3437
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3805
+ id: item.alpacaAccount.id !== undefined ? {
3806
+ equals: item.alpacaAccount.id
3807
+ } : undefined,
3808
+ userId: item.alpacaAccount.userId !== undefined ? {
3809
+ equals: item.alpacaAccount.userId
3810
+ } : undefined,
3438
3811
  },
3439
3812
  create: {
3440
3813
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3457,7 +3830,12 @@ export const Trade = {
3457
3830
  }
3458
3831
  : { connectOrCreate: {
3459
3832
  where: {
3460
- id: item.action.id !== undefined ? item.action.id : undefined,
3833
+ id: item.action.id !== undefined ? {
3834
+ equals: item.action.id
3835
+ } : undefined,
3836
+ tradeId: item.action.tradeId !== undefined ? {
3837
+ equals: item.action.tradeId
3838
+ } : undefined,
3461
3839
  },
3462
3840
  create: {
3463
3841
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3474,7 +3852,15 @@ export const Trade = {
3474
3852
  positions: props.asset.positions ? {
3475
3853
  upsert: props.asset.positions.map((item) => ({
3476
3854
  where: {
3477
- id: item.id !== undefined ? item.id : undefined,
3855
+ id: item.id !== undefined ? {
3856
+ equals: item.id
3857
+ } : undefined,
3858
+ assetId: item.assetId !== undefined ? {
3859
+ equals: item.assetId
3860
+ } : undefined,
3861
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3862
+ equals: item.alpacaAccountId
3863
+ } : undefined,
3478
3864
  },
3479
3865
  update: {
3480
3866
  id: item.id !== undefined ? {
@@ -3525,6 +3911,9 @@ export const Trade = {
3525
3911
  id: item.alpacaAccount.id !== undefined ? {
3526
3912
  equals: item.alpacaAccount.id
3527
3913
  } : undefined,
3914
+ userId: item.alpacaAccount.userId !== undefined ? {
3915
+ equals: item.alpacaAccount.userId
3916
+ } : undefined,
3528
3917
  },
3529
3918
  update: {
3530
3919
  id: item.alpacaAccount.id !== undefined ? {
@@ -3594,7 +3983,12 @@ export const Trade = {
3594
3983
  }
3595
3984
  : { connectOrCreate: {
3596
3985
  where: {
3597
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3986
+ id: item.alpacaAccount.id !== undefined ? {
3987
+ equals: item.alpacaAccount.id
3988
+ } : undefined,
3989
+ userId: item.alpacaAccount.userId !== undefined ? {
3990
+ equals: item.alpacaAccount.userId
3991
+ } : undefined,
3598
3992
  },
3599
3993
  create: {
3600
3994
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3615,8 +4009,16 @@ export const Trade = {
3615
4009
  newsMentions: props.asset.newsMentions ? {
3616
4010
  upsert: props.asset.newsMentions.map((item) => ({
3617
4011
  where: {
3618
- id: item.id !== undefined ? item.id : undefined,
4012
+ id: item.id !== undefined ? {
4013
+ equals: item.id
4014
+ } : undefined,
3619
4015
  url: item.url !== undefined ? item.url : undefined,
4016
+ assetId: item.assetId !== undefined ? {
4017
+ equals: item.assetId
4018
+ } : undefined,
4019
+ newsArticleId: item.newsArticleId !== undefined ? {
4020
+ equals: item.newsArticleId
4021
+ } : undefined,
3620
4022
  },
3621
4023
  update: {
3622
4024
  id: item.id !== undefined ? {
@@ -3722,7 +4124,9 @@ export const Trade = {
3722
4124
  }
3723
4125
  : { connectOrCreate: {
3724
4126
  where: {
3725
- id: item.news.id !== undefined ? item.news.id : undefined,
4127
+ id: item.news.id !== undefined ? {
4128
+ equals: item.news.id
4129
+ } : undefined,
3726
4130
  url: item.news.url !== undefined ? item.news.url : undefined,
3727
4131
  title: item.news.title !== undefined ? {
3728
4132
  equals: item.news.title
@@ -3813,7 +4217,18 @@ export const Trade = {
3813
4217
  }
3814
4218
  : { connectOrCreate: props.asset.orders.map((item) => ({
3815
4219
  where: {
3816
- id: item.id !== undefined ? item.id : undefined,
4220
+ id: item.id !== undefined ? {
4221
+ equals: item.id
4222
+ } : undefined,
4223
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4224
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4225
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4226
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4227
+ equals: item.alpacaAccountId
4228
+ } : undefined,
4229
+ assetId: item.assetId !== undefined ? {
4230
+ equals: item.assetId
4231
+ } : undefined,
3817
4232
  },
3818
4233
  create: {
3819
4234
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3846,7 +4261,10 @@ export const Trade = {
3846
4261
  }
3847
4262
  : { connectOrCreate: {
3848
4263
  where: {
3849
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4264
+ id: item.stopLoss.id !== undefined ? {
4265
+ equals: item.stopLoss.id
4266
+ } : undefined,
4267
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3850
4268
  },
3851
4269
  create: {
3852
4270
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3862,7 +4280,10 @@ export const Trade = {
3862
4280
  }
3863
4281
  : { connectOrCreate: {
3864
4282
  where: {
3865
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
4283
+ id: item.takeProfit.id !== undefined ? {
4284
+ equals: item.takeProfit.id
4285
+ } : undefined,
4286
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3866
4287
  },
3867
4288
  create: {
3868
4289
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3878,7 +4299,12 @@ export const Trade = {
3878
4299
  }
3879
4300
  : { connectOrCreate: {
3880
4301
  where: {
3881
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4302
+ id: item.alpacaAccount.id !== undefined ? {
4303
+ equals: item.alpacaAccount.id
4304
+ } : undefined,
4305
+ userId: item.alpacaAccount.userId !== undefined ? {
4306
+ equals: item.alpacaAccount.userId
4307
+ } : undefined,
3882
4308
  },
3883
4309
  create: {
3884
4310
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3901,7 +4327,12 @@ export const Trade = {
3901
4327
  }
3902
4328
  : { connectOrCreate: {
3903
4329
  where: {
3904
- id: item.action.id !== undefined ? item.action.id : undefined,
4330
+ id: item.action.id !== undefined ? {
4331
+ equals: item.action.id
4332
+ } : undefined,
4333
+ tradeId: item.action.tradeId !== undefined ? {
4334
+ equals: item.action.tradeId
4335
+ } : undefined,
3905
4336
  },
3906
4337
  create: {
3907
4338
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3923,7 +4354,15 @@ export const Trade = {
3923
4354
  }
3924
4355
  : { connectOrCreate: props.asset.positions.map((item) => ({
3925
4356
  where: {
3926
- id: item.id !== undefined ? item.id : undefined,
4357
+ id: item.id !== undefined ? {
4358
+ equals: item.id
4359
+ } : undefined,
4360
+ assetId: item.assetId !== undefined ? {
4361
+ equals: item.assetId
4362
+ } : undefined,
4363
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4364
+ equals: item.alpacaAccountId
4365
+ } : undefined,
3927
4366
  },
3928
4367
  create: {
3929
4368
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -3947,7 +4386,12 @@ export const Trade = {
3947
4386
  }
3948
4387
  : { connectOrCreate: {
3949
4388
  where: {
3950
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4389
+ id: item.alpacaAccount.id !== undefined ? {
4390
+ equals: item.alpacaAccount.id
4391
+ } : undefined,
4392
+ userId: item.alpacaAccount.userId !== undefined ? {
4393
+ equals: item.alpacaAccount.userId
4394
+ } : undefined,
3951
4395
  },
3952
4396
  create: {
3953
4397
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3973,8 +4417,16 @@ export const Trade = {
3973
4417
  }
3974
4418
  : { connectOrCreate: props.asset.newsMentions.map((item) => ({
3975
4419
  where: {
3976
- id: item.id !== undefined ? item.id : undefined,
4420
+ id: item.id !== undefined ? {
4421
+ equals: item.id
4422
+ } : undefined,
3977
4423
  url: item.url !== undefined ? item.url : undefined,
4424
+ assetId: item.assetId !== undefined ? {
4425
+ equals: item.assetId
4426
+ } : undefined,
4427
+ newsArticleId: item.newsArticleId !== undefined ? {
4428
+ equals: item.newsArticleId
4429
+ } : undefined,
3978
4430
  },
3979
4431
  create: {
3980
4432
  url: item.url !== undefined ? item.url : undefined,
@@ -3989,7 +4441,9 @@ export const Trade = {
3989
4441
  }
3990
4442
  : { connectOrCreate: {
3991
4443
  where: {
3992
- id: item.news.id !== undefined ? item.news.id : undefined,
4444
+ id: item.news.id !== undefined ? {
4445
+ equals: item.news.id
4446
+ } : undefined,
3993
4447
  url: item.news.url !== undefined ? item.news.url : undefined,
3994
4448
  title: item.news.title !== undefined ? {
3995
4449
  equals: item.news.title
@@ -4021,7 +4475,12 @@ export const Trade = {
4021
4475
  actions: props.actions ? {
4022
4476
  upsert: props.actions.map((item) => ({
4023
4477
  where: {
4024
- id: item.id !== undefined ? item.id : undefined,
4478
+ id: item.id !== undefined ? {
4479
+ equals: item.id
4480
+ } : undefined,
4481
+ tradeId: item.tradeId !== undefined ? {
4482
+ equals: item.tradeId
4483
+ } : undefined,
4025
4484
  },
4026
4485
  update: {
4027
4486
  id: item.id !== undefined ? {
@@ -4048,6 +4507,18 @@ export const Trade = {
4048
4507
  id: item.order.id !== undefined ? {
4049
4508
  equals: item.order.id
4050
4509
  } : undefined,
4510
+ clientOrderId: item.order.clientOrderId !== undefined ? {
4511
+ equals: item.order.clientOrderId
4512
+ } : undefined,
4513
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
4514
+ equals: item.order.alpacaAccountId
4515
+ } : undefined,
4516
+ assetId: item.order.assetId !== undefined ? {
4517
+ equals: item.order.assetId
4518
+ } : undefined,
4519
+ actionId: item.order.actionId !== undefined ? {
4520
+ equals: item.order.actionId
4521
+ } : undefined,
4051
4522
  },
4052
4523
  update: {
4053
4524
  id: item.order.id !== undefined ? {
@@ -4125,6 +4596,9 @@ export const Trade = {
4125
4596
  id: item.order.stopLoss.id !== undefined ? {
4126
4597
  equals: item.order.stopLoss.id
4127
4598
  } : undefined,
4599
+ orderId: item.order.stopLoss.orderId !== undefined ? {
4600
+ equals: item.order.stopLoss.orderId
4601
+ } : undefined,
4128
4602
  },
4129
4603
  update: {
4130
4604
  id: item.order.stopLoss.id !== undefined ? {
@@ -4149,6 +4623,9 @@ export const Trade = {
4149
4623
  id: item.order.takeProfit.id !== undefined ? {
4150
4624
  equals: item.order.takeProfit.id
4151
4625
  } : undefined,
4626
+ orderId: item.order.takeProfit.orderId !== undefined ? {
4627
+ equals: item.order.takeProfit.orderId
4628
+ } : undefined,
4152
4629
  },
4153
4630
  update: {
4154
4631
  id: item.order.takeProfit.id !== undefined ? {
@@ -4173,6 +4650,9 @@ export const Trade = {
4173
4650
  id: item.order.alpacaAccount.id !== undefined ? {
4174
4651
  equals: item.order.alpacaAccount.id
4175
4652
  } : undefined,
4653
+ userId: item.order.alpacaAccount.userId !== undefined ? {
4654
+ equals: item.order.alpacaAccount.userId
4655
+ } : undefined,
4176
4656
  },
4177
4657
  update: {
4178
4658
  id: item.order.alpacaAccount.id !== undefined ? {
@@ -4493,7 +4973,10 @@ export const Trade = {
4493
4973
  }
4494
4974
  : { connectOrCreate: {
4495
4975
  where: {
4496
- id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
4976
+ id: item.order.stopLoss.id !== undefined ? {
4977
+ equals: item.order.stopLoss.id
4978
+ } : undefined,
4979
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
4497
4980
  },
4498
4981
  create: {
4499
4982
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -4509,7 +4992,10 @@ export const Trade = {
4509
4992
  }
4510
4993
  : { connectOrCreate: {
4511
4994
  where: {
4512
- id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
4995
+ id: item.order.takeProfit.id !== undefined ? {
4996
+ equals: item.order.takeProfit.id
4997
+ } : undefined,
4998
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
4513
4999
  },
4514
5000
  create: {
4515
5001
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -4525,7 +5011,12 @@ export const Trade = {
4525
5011
  }
4526
5012
  : { connectOrCreate: {
4527
5013
  where: {
4528
- id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
5014
+ id: item.order.alpacaAccount.id !== undefined ? {
5015
+ equals: item.order.alpacaAccount.id
5016
+ } : undefined,
5017
+ userId: item.order.alpacaAccount.userId !== undefined ? {
5018
+ equals: item.order.alpacaAccount.userId
5019
+ } : undefined,
4529
5020
  },
4530
5021
  create: {
4531
5022
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -4548,7 +5039,9 @@ export const Trade = {
4548
5039
  }
4549
5040
  : { connectOrCreate: {
4550
5041
  where: {
4551
- id: item.order.asset.id !== undefined ? item.order.asset.id : undefined,
5042
+ id: item.order.asset.id !== undefined ? {
5043
+ equals: item.order.asset.id
5044
+ } : undefined,
4552
5045
  symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
4553
5046
  name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
4554
5047
  },
@@ -4629,7 +5122,18 @@ export const Trade = {
4629
5122
  }
4630
5123
  : { connectOrCreate: {
4631
5124
  where: {
4632
- id: item.order.id !== undefined ? item.order.id : undefined,
5125
+ id: item.order.id !== undefined ? {
5126
+ equals: item.order.id
5127
+ } : undefined,
5128
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
5129
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
5130
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
5131
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
5132
+ equals: item.order.alpacaAccountId
5133
+ } : undefined,
5134
+ assetId: item.order.assetId !== undefined ? {
5135
+ equals: item.order.assetId
5136
+ } : undefined,
4633
5137
  },
4634
5138
  create: {
4635
5139
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -4662,7 +5166,10 @@ export const Trade = {
4662
5166
  }
4663
5167
  : { connectOrCreate: {
4664
5168
  where: {
4665
- id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
5169
+ id: item.order.stopLoss.id !== undefined ? {
5170
+ equals: item.order.stopLoss.id
5171
+ } : undefined,
5172
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
4666
5173
  },
4667
5174
  create: {
4668
5175
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -4678,7 +5185,10 @@ export const Trade = {
4678
5185
  }
4679
5186
  : { connectOrCreate: {
4680
5187
  where: {
4681
- id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
5188
+ id: item.order.takeProfit.id !== undefined ? {
5189
+ equals: item.order.takeProfit.id
5190
+ } : undefined,
5191
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
4682
5192
  },
4683
5193
  create: {
4684
5194
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -4694,7 +5204,12 @@ export const Trade = {
4694
5204
  }
4695
5205
  : { connectOrCreate: {
4696
5206
  where: {
4697
- id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
5207
+ id: item.order.alpacaAccount.id !== undefined ? {
5208
+ equals: item.order.alpacaAccount.id
5209
+ } : undefined,
5210
+ userId: item.order.alpacaAccount.userId !== undefined ? {
5211
+ equals: item.order.alpacaAccount.userId
5212
+ } : undefined,
4698
5213
  },
4699
5214
  create: {
4700
5215
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -4717,7 +5232,9 @@ export const Trade = {
4717
5232
  }
4718
5233
  : { connectOrCreate: {
4719
5234
  where: {
4720
- id: item.order.asset.id !== undefined ? item.order.asset.id : undefined,
5235
+ id: item.order.asset.id !== undefined ? {
5236
+ equals: item.order.asset.id
5237
+ } : undefined,
4721
5238
  symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
4722
5239
  name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
4723
5240
  },
@@ -4820,9 +5337,15 @@ export const Trade = {
4820
5337
  }`;
4821
5338
  const variables = props.map(prop => ({
4822
5339
  where: {
4823
- id: prop.id !== undefined ? prop.id : undefined,
4824
- alpacaAccountId: prop.alpacaAccountId !== undefined ? prop.alpacaAccountId : undefined,
4825
- assetId: prop.assetId !== undefined ? prop.assetId : undefined,
5340
+ id: prop.id !== undefined ? {
5341
+ equals: prop.id
5342
+ } : undefined,
5343
+ alpacaAccountId: prop.alpacaAccountId !== undefined ? {
5344
+ equals: prop.alpacaAccountId
5345
+ } : undefined,
5346
+ assetId: prop.assetId !== undefined ? {
5347
+ equals: prop.assetId
5348
+ } : undefined,
4826
5349
  qty: prop.qty !== undefined ? prop.qty : undefined,
4827
5350
  price: prop.price !== undefined ? prop.price : undefined,
4828
5351
  total: prop.total !== undefined ? prop.total : undefined,
@@ -4886,6 +5409,9 @@ export const Trade = {
4886
5409
  id: prop.alpacaAccount.id !== undefined ? {
4887
5410
  equals: prop.alpacaAccount.id
4888
5411
  } : undefined,
5412
+ userId: prop.alpacaAccount.userId !== undefined ? {
5413
+ equals: prop.alpacaAccount.userId
5414
+ } : undefined,
4889
5415
  },
4890
5416
  update: {
4891
5417
  id: prop.alpacaAccount.id !== undefined ? {
@@ -4974,9 +5500,21 @@ export const Trade = {
4974
5500
  id: prop.alpacaAccount.user.customer.id !== undefined ? {
4975
5501
  equals: prop.alpacaAccount.user.customer.id
4976
5502
  } : undefined,
5503
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5504
+ equals: prop.alpacaAccount.user.customer.authUserId
5505
+ } : undefined,
4977
5506
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
4978
5507
  equals: prop.alpacaAccount.user.customer.name
4979
5508
  } : undefined,
5509
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
5510
+ equals: prop.alpacaAccount.user.customer.stripeCustomerId
5511
+ } : undefined,
5512
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
5513
+ equals: prop.alpacaAccount.user.customer.stripeSubscriptionId
5514
+ } : undefined,
5515
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5516
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5517
+ } : undefined,
4980
5518
  },
4981
5519
  update: {
4982
5520
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -5015,7 +5553,15 @@ export const Trade = {
5015
5553
  accounts: prop.alpacaAccount.user.accounts ? {
5016
5554
  upsert: prop.alpacaAccount.user.accounts.map((item) => ({
5017
5555
  where: {
5018
- id: item.id !== undefined ? item.id : undefined,
5556
+ id: item.id !== undefined ? {
5557
+ equals: item.id
5558
+ } : undefined,
5559
+ userId: item.userId !== undefined ? {
5560
+ equals: item.userId
5561
+ } : undefined,
5562
+ providerAccountId: item.providerAccountId !== undefined ? {
5563
+ equals: item.providerAccountId
5564
+ } : undefined,
5019
5565
  },
5020
5566
  update: {
5021
5567
  id: item.id !== undefined ? {
@@ -5069,7 +5615,12 @@ export const Trade = {
5069
5615
  sessions: prop.alpacaAccount.user.sessions ? {
5070
5616
  upsert: prop.alpacaAccount.user.sessions.map((item) => ({
5071
5617
  where: {
5072
- id: item.id !== undefined ? item.id : undefined,
5618
+ id: item.id !== undefined ? {
5619
+ equals: item.id
5620
+ } : undefined,
5621
+ userId: item.userId !== undefined ? {
5622
+ equals: item.userId
5623
+ } : undefined,
5073
5624
  },
5074
5625
  update: {
5075
5626
  id: item.id !== undefined ? {
@@ -5091,7 +5642,12 @@ export const Trade = {
5091
5642
  authenticators: prop.alpacaAccount.user.authenticators ? {
5092
5643
  upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
5093
5644
  where: {
5094
- id: item.id !== undefined ? item.id : undefined,
5645
+ id: item.id !== undefined ? {
5646
+ equals: item.id
5647
+ } : undefined,
5648
+ userId: item.userId !== undefined ? {
5649
+ equals: item.userId
5650
+ } : undefined,
5095
5651
  },
5096
5652
  update: {
5097
5653
  id: item.id !== undefined ? {
@@ -5135,10 +5691,20 @@ export const Trade = {
5135
5691
  }
5136
5692
  : { connectOrCreate: {
5137
5693
  where: {
5138
- id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
5694
+ id: prop.alpacaAccount.user.customer.id !== undefined ? {
5695
+ equals: prop.alpacaAccount.user.customer.id
5696
+ } : undefined,
5697
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
5698
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
5699
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5700
+ equals: prop.alpacaAccount.user.customer.authUserId
5701
+ } : undefined,
5139
5702
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5140
5703
  equals: prop.alpacaAccount.user.customer.name
5141
5704
  } : undefined,
5705
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5706
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5707
+ } : undefined,
5142
5708
  },
5143
5709
  create: {
5144
5710
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -5159,7 +5725,15 @@ export const Trade = {
5159
5725
  }
5160
5726
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
5161
5727
  where: {
5162
- id: item.id !== undefined ? item.id : undefined,
5728
+ id: item.id !== undefined ? {
5729
+ equals: item.id
5730
+ } : undefined,
5731
+ userId: item.userId !== undefined ? {
5732
+ equals: item.userId
5733
+ } : undefined,
5734
+ providerAccountId: item.providerAccountId !== undefined ? {
5735
+ equals: item.providerAccountId
5736
+ } : undefined,
5163
5737
  },
5164
5738
  create: {
5165
5739
  type: item.type !== undefined ? item.type : undefined,
@@ -5183,7 +5757,12 @@ export const Trade = {
5183
5757
  }
5184
5758
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
5185
5759
  where: {
5186
- id: item.id !== undefined ? item.id : undefined,
5760
+ id: item.id !== undefined ? {
5761
+ equals: item.id
5762
+ } : undefined,
5763
+ userId: item.userId !== undefined ? {
5764
+ equals: item.userId
5765
+ } : undefined,
5187
5766
  },
5188
5767
  create: {
5189
5768
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -5199,7 +5778,12 @@ export const Trade = {
5199
5778
  }
5200
5779
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
5201
5780
  where: {
5202
- id: item.id !== undefined ? item.id : undefined,
5781
+ id: item.id !== undefined ? {
5782
+ equals: item.id
5783
+ } : undefined,
5784
+ userId: item.userId !== undefined ? {
5785
+ equals: item.userId
5786
+ } : undefined,
5203
5787
  },
5204
5788
  create: {
5205
5789
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -5214,7 +5798,18 @@ export const Trade = {
5214
5798
  orders: prop.alpacaAccount.orders ? {
5215
5799
  upsert: prop.alpacaAccount.orders.map((item) => ({
5216
5800
  where: {
5217
- id: item.id !== undefined ? item.id : undefined,
5801
+ id: item.id !== undefined ? {
5802
+ equals: item.id
5803
+ } : undefined,
5804
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5805
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5806
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5807
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5808
+ equals: item.alpacaAccountId
5809
+ } : undefined,
5810
+ assetId: item.assetId !== undefined ? {
5811
+ equals: item.assetId
5812
+ } : undefined,
5218
5813
  },
5219
5814
  update: {
5220
5815
  id: item.id !== undefined ? {
@@ -5292,6 +5887,9 @@ export const Trade = {
5292
5887
  id: item.stopLoss.id !== undefined ? {
5293
5888
  equals: item.stopLoss.id
5294
5889
  } : undefined,
5890
+ orderId: item.stopLoss.orderId !== undefined ? {
5891
+ equals: item.stopLoss.orderId
5892
+ } : undefined,
5295
5893
  },
5296
5894
  update: {
5297
5895
  id: item.stopLoss.id !== undefined ? {
@@ -5316,6 +5914,9 @@ export const Trade = {
5316
5914
  id: item.takeProfit.id !== undefined ? {
5317
5915
  equals: item.takeProfit.id
5318
5916
  } : undefined,
5917
+ orderId: item.takeProfit.orderId !== undefined ? {
5918
+ equals: item.takeProfit.orderId
5919
+ } : undefined,
5319
5920
  },
5320
5921
  update: {
5321
5922
  id: item.takeProfit.id !== undefined ? {
@@ -5340,6 +5941,9 @@ export const Trade = {
5340
5941
  id: item.action.id !== undefined ? {
5341
5942
  equals: item.action.id
5342
5943
  } : undefined,
5944
+ tradeId: item.action.tradeId !== undefined ? {
5945
+ equals: item.action.tradeId
5946
+ } : undefined,
5343
5947
  },
5344
5948
  update: {
5345
5949
  id: item.action.id !== undefined ? {
@@ -5644,7 +6248,10 @@ export const Trade = {
5644
6248
  }
5645
6249
  : { connectOrCreate: {
5646
6250
  where: {
5647
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
6251
+ id: item.stopLoss.id !== undefined ? {
6252
+ equals: item.stopLoss.id
6253
+ } : undefined,
6254
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
5648
6255
  },
5649
6256
  create: {
5650
6257
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -5660,7 +6267,10 @@ export const Trade = {
5660
6267
  }
5661
6268
  : { connectOrCreate: {
5662
6269
  where: {
5663
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
6270
+ id: item.takeProfit.id !== undefined ? {
6271
+ equals: item.takeProfit.id
6272
+ } : undefined,
6273
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
5664
6274
  },
5665
6275
  create: {
5666
6276
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -5676,7 +6286,12 @@ export const Trade = {
5676
6286
  }
5677
6287
  : { connectOrCreate: {
5678
6288
  where: {
5679
- id: item.action.id !== undefined ? item.action.id : undefined,
6289
+ id: item.action.id !== undefined ? {
6290
+ equals: item.action.id
6291
+ } : undefined,
6292
+ tradeId: item.action.tradeId !== undefined ? {
6293
+ equals: item.action.tradeId
6294
+ } : undefined,
5680
6295
  },
5681
6296
  create: {
5682
6297
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -5695,7 +6310,9 @@ export const Trade = {
5695
6310
  }
5696
6311
  : { connectOrCreate: {
5697
6312
  where: {
5698
- id: item.asset.id !== undefined ? item.asset.id : undefined,
6313
+ id: item.asset.id !== undefined ? {
6314
+ equals: item.asset.id
6315
+ } : undefined,
5699
6316
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5700
6317
  name: item.asset.name !== undefined ? item.asset.name : undefined,
5701
6318
  },
@@ -5764,7 +6381,15 @@ export const Trade = {
5764
6381
  positions: prop.alpacaAccount.positions ? {
5765
6382
  upsert: prop.alpacaAccount.positions.map((item) => ({
5766
6383
  where: {
5767
- id: item.id !== undefined ? item.id : undefined,
6384
+ id: item.id !== undefined ? {
6385
+ equals: item.id
6386
+ } : undefined,
6387
+ assetId: item.assetId !== undefined ? {
6388
+ equals: item.assetId
6389
+ } : undefined,
6390
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6391
+ equals: item.alpacaAccountId
6392
+ } : undefined,
5768
6393
  },
5769
6394
  update: {
5770
6395
  id: item.id !== undefined ? {
@@ -6074,7 +6699,9 @@ export const Trade = {
6074
6699
  }
6075
6700
  : { connectOrCreate: {
6076
6701
  where: {
6077
- id: item.asset.id !== undefined ? item.asset.id : undefined,
6702
+ id: item.asset.id !== undefined ? {
6703
+ equals: item.asset.id
6704
+ } : undefined,
6078
6705
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6079
6706
  name: item.asset.name !== undefined ? item.asset.name : undefined,
6080
6707
  },
@@ -6143,7 +6770,12 @@ export const Trade = {
6143
6770
  alerts: prop.alpacaAccount.alerts ? {
6144
6771
  upsert: prop.alpacaAccount.alerts.map((item) => ({
6145
6772
  where: {
6146
- id: item.id !== undefined ? item.id : undefined,
6773
+ id: item.id !== undefined ? {
6774
+ equals: item.id
6775
+ } : undefined,
6776
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6777
+ equals: item.alpacaAccountId
6778
+ } : undefined,
6147
6779
  },
6148
6780
  update: {
6149
6781
  id: item.id !== undefined ? {
@@ -6185,7 +6817,9 @@ export const Trade = {
6185
6817
  }
6186
6818
  : { connectOrCreate: {
6187
6819
  where: {
6188
- id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
6820
+ id: prop.alpacaAccount.user.id !== undefined ? {
6821
+ equals: prop.alpacaAccount.user.id
6822
+ } : undefined,
6189
6823
  email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
6190
6824
  name: prop.alpacaAccount.user.name !== undefined ? {
6191
6825
  equals: prop.alpacaAccount.user.name
@@ -6211,10 +6845,20 @@ export const Trade = {
6211
6845
  }
6212
6846
  : { connectOrCreate: {
6213
6847
  where: {
6214
- id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
6848
+ id: prop.alpacaAccount.user.customer.id !== undefined ? {
6849
+ equals: prop.alpacaAccount.user.customer.id
6850
+ } : undefined,
6851
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
6852
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
6853
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
6854
+ equals: prop.alpacaAccount.user.customer.authUserId
6855
+ } : undefined,
6215
6856
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
6216
6857
  equals: prop.alpacaAccount.user.customer.name
6217
6858
  } : undefined,
6859
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
6860
+ equals: prop.alpacaAccount.user.customer.stripePriceId
6861
+ } : undefined,
6218
6862
  },
6219
6863
  create: {
6220
6864
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -6235,7 +6879,15 @@ export const Trade = {
6235
6879
  }
6236
6880
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
6237
6881
  where: {
6238
- id: item.id !== undefined ? item.id : undefined,
6882
+ id: item.id !== undefined ? {
6883
+ equals: item.id
6884
+ } : undefined,
6885
+ userId: item.userId !== undefined ? {
6886
+ equals: item.userId
6887
+ } : undefined,
6888
+ providerAccountId: item.providerAccountId !== undefined ? {
6889
+ equals: item.providerAccountId
6890
+ } : undefined,
6239
6891
  },
6240
6892
  create: {
6241
6893
  type: item.type !== undefined ? item.type : undefined,
@@ -6259,7 +6911,12 @@ export const Trade = {
6259
6911
  }
6260
6912
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
6261
6913
  where: {
6262
- id: item.id !== undefined ? item.id : undefined,
6914
+ id: item.id !== undefined ? {
6915
+ equals: item.id
6916
+ } : undefined,
6917
+ userId: item.userId !== undefined ? {
6918
+ equals: item.userId
6919
+ } : undefined,
6263
6920
  },
6264
6921
  create: {
6265
6922
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -6275,7 +6932,12 @@ export const Trade = {
6275
6932
  }
6276
6933
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
6277
6934
  where: {
6278
- id: item.id !== undefined ? item.id : undefined,
6935
+ id: item.id !== undefined ? {
6936
+ equals: item.id
6937
+ } : undefined,
6938
+ userId: item.userId !== undefined ? {
6939
+ equals: item.userId
6940
+ } : undefined,
6279
6941
  },
6280
6942
  create: {
6281
6943
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -6295,7 +6957,18 @@ export const Trade = {
6295
6957
  }
6296
6958
  : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
6297
6959
  where: {
6298
- id: item.id !== undefined ? item.id : undefined,
6960
+ id: item.id !== undefined ? {
6961
+ equals: item.id
6962
+ } : undefined,
6963
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6964
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6965
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6966
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6967
+ equals: item.alpacaAccountId
6968
+ } : undefined,
6969
+ assetId: item.assetId !== undefined ? {
6970
+ equals: item.assetId
6971
+ } : undefined,
6299
6972
  },
6300
6973
  create: {
6301
6974
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6328,7 +7001,10 @@ export const Trade = {
6328
7001
  }
6329
7002
  : { connectOrCreate: {
6330
7003
  where: {
6331
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7004
+ id: item.stopLoss.id !== undefined ? {
7005
+ equals: item.stopLoss.id
7006
+ } : undefined,
7007
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6332
7008
  },
6333
7009
  create: {
6334
7010
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6344,7 +7020,10 @@ export const Trade = {
6344
7020
  }
6345
7021
  : { connectOrCreate: {
6346
7022
  where: {
6347
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7023
+ id: item.takeProfit.id !== undefined ? {
7024
+ equals: item.takeProfit.id
7025
+ } : undefined,
7026
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6348
7027
  },
6349
7028
  create: {
6350
7029
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6360,7 +7039,12 @@ export const Trade = {
6360
7039
  }
6361
7040
  : { connectOrCreate: {
6362
7041
  where: {
6363
- id: item.action.id !== undefined ? item.action.id : undefined,
7042
+ id: item.action.id !== undefined ? {
7043
+ equals: item.action.id
7044
+ } : undefined,
7045
+ tradeId: item.action.tradeId !== undefined ? {
7046
+ equals: item.action.tradeId
7047
+ } : undefined,
6364
7048
  },
6365
7049
  create: {
6366
7050
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6379,7 +7063,9 @@ export const Trade = {
6379
7063
  }
6380
7064
  : { connectOrCreate: {
6381
7065
  where: {
6382
- id: item.asset.id !== undefined ? item.asset.id : undefined,
7066
+ id: item.asset.id !== undefined ? {
7067
+ equals: item.asset.id
7068
+ } : undefined,
6383
7069
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6384
7070
  name: item.asset.name !== undefined ? item.asset.name : undefined,
6385
7071
  },
@@ -6453,7 +7139,15 @@ export const Trade = {
6453
7139
  }
6454
7140
  : { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
6455
7141
  where: {
6456
- id: item.id !== undefined ? item.id : undefined,
7142
+ id: item.id !== undefined ? {
7143
+ equals: item.id
7144
+ } : undefined,
7145
+ assetId: item.assetId !== undefined ? {
7146
+ equals: item.assetId
7147
+ } : undefined,
7148
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7149
+ equals: item.alpacaAccountId
7150
+ } : undefined,
6457
7151
  },
6458
7152
  create: {
6459
7153
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -6477,7 +7171,9 @@ export const Trade = {
6477
7171
  }
6478
7172
  : { connectOrCreate: {
6479
7173
  where: {
6480
- id: item.asset.id !== undefined ? item.asset.id : undefined,
7174
+ id: item.asset.id !== undefined ? {
7175
+ equals: item.asset.id
7176
+ } : undefined,
6481
7177
  symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6482
7178
  name: item.asset.name !== undefined ? item.asset.name : undefined,
6483
7179
  },
@@ -6551,7 +7247,12 @@ export const Trade = {
6551
7247
  }
6552
7248
  : { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
6553
7249
  where: {
6554
- id: item.id !== undefined ? item.id : undefined,
7250
+ id: item.id !== undefined ? {
7251
+ equals: item.id
7252
+ } : undefined,
7253
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7254
+ equals: item.alpacaAccountId
7255
+ } : undefined,
6555
7256
  },
6556
7257
  create: {
6557
7258
  message: item.message !== undefined ? item.message : undefined,
@@ -6748,7 +7449,18 @@ export const Trade = {
6748
7449
  orders: prop.asset.orders ? {
6749
7450
  upsert: prop.asset.orders.map((item) => ({
6750
7451
  where: {
6751
- id: item.id !== undefined ? item.id : undefined,
7452
+ id: item.id !== undefined ? {
7453
+ equals: item.id
7454
+ } : undefined,
7455
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7456
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7457
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7458
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7459
+ equals: item.alpacaAccountId
7460
+ } : undefined,
7461
+ assetId: item.assetId !== undefined ? {
7462
+ equals: item.assetId
7463
+ } : undefined,
6752
7464
  },
6753
7465
  update: {
6754
7466
  id: item.id !== undefined ? {
@@ -6826,6 +7538,9 @@ export const Trade = {
6826
7538
  id: item.stopLoss.id !== undefined ? {
6827
7539
  equals: item.stopLoss.id
6828
7540
  } : undefined,
7541
+ orderId: item.stopLoss.orderId !== undefined ? {
7542
+ equals: item.stopLoss.orderId
7543
+ } : undefined,
6829
7544
  },
6830
7545
  update: {
6831
7546
  id: item.stopLoss.id !== undefined ? {
@@ -6850,6 +7565,9 @@ export const Trade = {
6850
7565
  id: item.takeProfit.id !== undefined ? {
6851
7566
  equals: item.takeProfit.id
6852
7567
  } : undefined,
7568
+ orderId: item.takeProfit.orderId !== undefined ? {
7569
+ equals: item.takeProfit.orderId
7570
+ } : undefined,
6853
7571
  },
6854
7572
  update: {
6855
7573
  id: item.takeProfit.id !== undefined ? {
@@ -6874,6 +7592,9 @@ export const Trade = {
6874
7592
  id: item.alpacaAccount.id !== undefined ? {
6875
7593
  equals: item.alpacaAccount.id
6876
7594
  } : undefined,
7595
+ userId: item.alpacaAccount.userId !== undefined ? {
7596
+ equals: item.alpacaAccount.userId
7597
+ } : undefined,
6877
7598
  },
6878
7599
  update: {
6879
7600
  id: item.alpacaAccount.id !== undefined ? {
@@ -6926,6 +7647,9 @@ export const Trade = {
6926
7647
  id: item.action.id !== undefined ? {
6927
7648
  equals: item.action.id
6928
7649
  } : undefined,
7650
+ tradeId: item.action.tradeId !== undefined ? {
7651
+ equals: item.action.tradeId
7652
+ } : undefined,
6929
7653
  },
6930
7654
  update: {
6931
7655
  id: item.action.id !== undefined ? {
@@ -6988,7 +7712,10 @@ export const Trade = {
6988
7712
  }
6989
7713
  : { connectOrCreate: {
6990
7714
  where: {
6991
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7715
+ id: item.stopLoss.id !== undefined ? {
7716
+ equals: item.stopLoss.id
7717
+ } : undefined,
7718
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6992
7719
  },
6993
7720
  create: {
6994
7721
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -7004,7 +7731,10 @@ export const Trade = {
7004
7731
  }
7005
7732
  : { connectOrCreate: {
7006
7733
  where: {
7007
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7734
+ id: item.takeProfit.id !== undefined ? {
7735
+ equals: item.takeProfit.id
7736
+ } : undefined,
7737
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
7008
7738
  },
7009
7739
  create: {
7010
7740
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -7020,7 +7750,12 @@ export const Trade = {
7020
7750
  }
7021
7751
  : { connectOrCreate: {
7022
7752
  where: {
7023
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
7753
+ id: item.alpacaAccount.id !== undefined ? {
7754
+ equals: item.alpacaAccount.id
7755
+ } : undefined,
7756
+ userId: item.alpacaAccount.userId !== undefined ? {
7757
+ equals: item.alpacaAccount.userId
7758
+ } : undefined,
7024
7759
  },
7025
7760
  create: {
7026
7761
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7043,7 +7778,12 @@ export const Trade = {
7043
7778
  }
7044
7779
  : { connectOrCreate: {
7045
7780
  where: {
7046
- id: item.action.id !== undefined ? item.action.id : undefined,
7781
+ id: item.action.id !== undefined ? {
7782
+ equals: item.action.id
7783
+ } : undefined,
7784
+ tradeId: item.action.tradeId !== undefined ? {
7785
+ equals: item.action.tradeId
7786
+ } : undefined,
7047
7787
  },
7048
7788
  create: {
7049
7789
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -7060,7 +7800,15 @@ export const Trade = {
7060
7800
  positions: prop.asset.positions ? {
7061
7801
  upsert: prop.asset.positions.map((item) => ({
7062
7802
  where: {
7063
- id: item.id !== undefined ? item.id : undefined,
7803
+ id: item.id !== undefined ? {
7804
+ equals: item.id
7805
+ } : undefined,
7806
+ assetId: item.assetId !== undefined ? {
7807
+ equals: item.assetId
7808
+ } : undefined,
7809
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7810
+ equals: item.alpacaAccountId
7811
+ } : undefined,
7064
7812
  },
7065
7813
  update: {
7066
7814
  id: item.id !== undefined ? {
@@ -7111,6 +7859,9 @@ export const Trade = {
7111
7859
  id: item.alpacaAccount.id !== undefined ? {
7112
7860
  equals: item.alpacaAccount.id
7113
7861
  } : undefined,
7862
+ userId: item.alpacaAccount.userId !== undefined ? {
7863
+ equals: item.alpacaAccount.userId
7864
+ } : undefined,
7114
7865
  },
7115
7866
  update: {
7116
7867
  id: item.alpacaAccount.id !== undefined ? {
@@ -7180,7 +7931,12 @@ export const Trade = {
7180
7931
  }
7181
7932
  : { connectOrCreate: {
7182
7933
  where: {
7183
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
7934
+ id: item.alpacaAccount.id !== undefined ? {
7935
+ equals: item.alpacaAccount.id
7936
+ } : undefined,
7937
+ userId: item.alpacaAccount.userId !== undefined ? {
7938
+ equals: item.alpacaAccount.userId
7939
+ } : undefined,
7184
7940
  },
7185
7941
  create: {
7186
7942
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7201,8 +7957,16 @@ export const Trade = {
7201
7957
  newsMentions: prop.asset.newsMentions ? {
7202
7958
  upsert: prop.asset.newsMentions.map((item) => ({
7203
7959
  where: {
7204
- id: item.id !== undefined ? item.id : undefined,
7960
+ id: item.id !== undefined ? {
7961
+ equals: item.id
7962
+ } : undefined,
7205
7963
  url: item.url !== undefined ? item.url : undefined,
7964
+ assetId: item.assetId !== undefined ? {
7965
+ equals: item.assetId
7966
+ } : undefined,
7967
+ newsArticleId: item.newsArticleId !== undefined ? {
7968
+ equals: item.newsArticleId
7969
+ } : undefined,
7206
7970
  },
7207
7971
  update: {
7208
7972
  id: item.id !== undefined ? {
@@ -7308,7 +8072,9 @@ export const Trade = {
7308
8072
  }
7309
8073
  : { connectOrCreate: {
7310
8074
  where: {
7311
- id: item.news.id !== undefined ? item.news.id : undefined,
8075
+ id: item.news.id !== undefined ? {
8076
+ equals: item.news.id
8077
+ } : undefined,
7312
8078
  url: item.news.url !== undefined ? item.news.url : undefined,
7313
8079
  title: item.news.title !== undefined ? {
7314
8080
  equals: item.news.title
@@ -7399,7 +8165,18 @@ export const Trade = {
7399
8165
  }
7400
8166
  : { connectOrCreate: prop.asset.orders.map((item) => ({
7401
8167
  where: {
7402
- id: item.id !== undefined ? item.id : undefined,
8168
+ id: item.id !== undefined ? {
8169
+ equals: item.id
8170
+ } : undefined,
8171
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
8172
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
8173
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
8174
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
8175
+ equals: item.alpacaAccountId
8176
+ } : undefined,
8177
+ assetId: item.assetId !== undefined ? {
8178
+ equals: item.assetId
8179
+ } : undefined,
7403
8180
  },
7404
8181
  create: {
7405
8182
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -7432,7 +8209,10 @@ export const Trade = {
7432
8209
  }
7433
8210
  : { connectOrCreate: {
7434
8211
  where: {
7435
- id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
8212
+ id: item.stopLoss.id !== undefined ? {
8213
+ equals: item.stopLoss.id
8214
+ } : undefined,
8215
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
7436
8216
  },
7437
8217
  create: {
7438
8218
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -7448,7 +8228,10 @@ export const Trade = {
7448
8228
  }
7449
8229
  : { connectOrCreate: {
7450
8230
  where: {
7451
- id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
8231
+ id: item.takeProfit.id !== undefined ? {
8232
+ equals: item.takeProfit.id
8233
+ } : undefined,
8234
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
7452
8235
  },
7453
8236
  create: {
7454
8237
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -7464,7 +8247,12 @@ export const Trade = {
7464
8247
  }
7465
8248
  : { connectOrCreate: {
7466
8249
  where: {
7467
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
8250
+ id: item.alpacaAccount.id !== undefined ? {
8251
+ equals: item.alpacaAccount.id
8252
+ } : undefined,
8253
+ userId: item.alpacaAccount.userId !== undefined ? {
8254
+ equals: item.alpacaAccount.userId
8255
+ } : undefined,
7468
8256
  },
7469
8257
  create: {
7470
8258
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7487,7 +8275,12 @@ export const Trade = {
7487
8275
  }
7488
8276
  : { connectOrCreate: {
7489
8277
  where: {
7490
- id: item.action.id !== undefined ? item.action.id : undefined,
8278
+ id: item.action.id !== undefined ? {
8279
+ equals: item.action.id
8280
+ } : undefined,
8281
+ tradeId: item.action.tradeId !== undefined ? {
8282
+ equals: item.action.tradeId
8283
+ } : undefined,
7491
8284
  },
7492
8285
  create: {
7493
8286
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -7509,7 +8302,15 @@ export const Trade = {
7509
8302
  }
7510
8303
  : { connectOrCreate: prop.asset.positions.map((item) => ({
7511
8304
  where: {
7512
- id: item.id !== undefined ? item.id : undefined,
8305
+ id: item.id !== undefined ? {
8306
+ equals: item.id
8307
+ } : undefined,
8308
+ assetId: item.assetId !== undefined ? {
8309
+ equals: item.assetId
8310
+ } : undefined,
8311
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
8312
+ equals: item.alpacaAccountId
8313
+ } : undefined,
7513
8314
  },
7514
8315
  create: {
7515
8316
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -7533,7 +8334,12 @@ export const Trade = {
7533
8334
  }
7534
8335
  : { connectOrCreate: {
7535
8336
  where: {
7536
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
8337
+ id: item.alpacaAccount.id !== undefined ? {
8338
+ equals: item.alpacaAccount.id
8339
+ } : undefined,
8340
+ userId: item.alpacaAccount.userId !== undefined ? {
8341
+ equals: item.alpacaAccount.userId
8342
+ } : undefined,
7537
8343
  },
7538
8344
  create: {
7539
8345
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7559,8 +8365,16 @@ export const Trade = {
7559
8365
  }
7560
8366
  : { connectOrCreate: prop.asset.newsMentions.map((item) => ({
7561
8367
  where: {
7562
- id: item.id !== undefined ? item.id : undefined,
8368
+ id: item.id !== undefined ? {
8369
+ equals: item.id
8370
+ } : undefined,
7563
8371
  url: item.url !== undefined ? item.url : undefined,
8372
+ assetId: item.assetId !== undefined ? {
8373
+ equals: item.assetId
8374
+ } : undefined,
8375
+ newsArticleId: item.newsArticleId !== undefined ? {
8376
+ equals: item.newsArticleId
8377
+ } : undefined,
7564
8378
  },
7565
8379
  create: {
7566
8380
  url: item.url !== undefined ? item.url : undefined,
@@ -7575,7 +8389,9 @@ export const Trade = {
7575
8389
  }
7576
8390
  : { connectOrCreate: {
7577
8391
  where: {
7578
- id: item.news.id !== undefined ? item.news.id : undefined,
8392
+ id: item.news.id !== undefined ? {
8393
+ equals: item.news.id
8394
+ } : undefined,
7579
8395
  url: item.news.url !== undefined ? item.news.url : undefined,
7580
8396
  title: item.news.title !== undefined ? {
7581
8397
  equals: item.news.title
@@ -7607,7 +8423,12 @@ export const Trade = {
7607
8423
  actions: prop.actions ? {
7608
8424
  upsert: prop.actions.map((item) => ({
7609
8425
  where: {
7610
- id: item.id !== undefined ? item.id : undefined,
8426
+ id: item.id !== undefined ? {
8427
+ equals: item.id
8428
+ } : undefined,
8429
+ tradeId: item.tradeId !== undefined ? {
8430
+ equals: item.tradeId
8431
+ } : undefined,
7611
8432
  },
7612
8433
  update: {
7613
8434
  id: item.id !== undefined ? {
@@ -7634,6 +8455,18 @@ export const Trade = {
7634
8455
  id: item.order.id !== undefined ? {
7635
8456
  equals: item.order.id
7636
8457
  } : undefined,
8458
+ clientOrderId: item.order.clientOrderId !== undefined ? {
8459
+ equals: item.order.clientOrderId
8460
+ } : undefined,
8461
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
8462
+ equals: item.order.alpacaAccountId
8463
+ } : undefined,
8464
+ assetId: item.order.assetId !== undefined ? {
8465
+ equals: item.order.assetId
8466
+ } : undefined,
8467
+ actionId: item.order.actionId !== undefined ? {
8468
+ equals: item.order.actionId
8469
+ } : undefined,
7637
8470
  },
7638
8471
  update: {
7639
8472
  id: item.order.id !== undefined ? {
@@ -7711,6 +8544,9 @@ export const Trade = {
7711
8544
  id: item.order.stopLoss.id !== undefined ? {
7712
8545
  equals: item.order.stopLoss.id
7713
8546
  } : undefined,
8547
+ orderId: item.order.stopLoss.orderId !== undefined ? {
8548
+ equals: item.order.stopLoss.orderId
8549
+ } : undefined,
7714
8550
  },
7715
8551
  update: {
7716
8552
  id: item.order.stopLoss.id !== undefined ? {
@@ -7735,6 +8571,9 @@ export const Trade = {
7735
8571
  id: item.order.takeProfit.id !== undefined ? {
7736
8572
  equals: item.order.takeProfit.id
7737
8573
  } : undefined,
8574
+ orderId: item.order.takeProfit.orderId !== undefined ? {
8575
+ equals: item.order.takeProfit.orderId
8576
+ } : undefined,
7738
8577
  },
7739
8578
  update: {
7740
8579
  id: item.order.takeProfit.id !== undefined ? {
@@ -7759,6 +8598,9 @@ export const Trade = {
7759
8598
  id: item.order.alpacaAccount.id !== undefined ? {
7760
8599
  equals: item.order.alpacaAccount.id
7761
8600
  } : undefined,
8601
+ userId: item.order.alpacaAccount.userId !== undefined ? {
8602
+ equals: item.order.alpacaAccount.userId
8603
+ } : undefined,
7762
8604
  },
7763
8605
  update: {
7764
8606
  id: item.order.alpacaAccount.id !== undefined ? {
@@ -8079,7 +8921,10 @@ export const Trade = {
8079
8921
  }
8080
8922
  : { connectOrCreate: {
8081
8923
  where: {
8082
- id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
8924
+ id: item.order.stopLoss.id !== undefined ? {
8925
+ equals: item.order.stopLoss.id
8926
+ } : undefined,
8927
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
8083
8928
  },
8084
8929
  create: {
8085
8930
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -8095,7 +8940,10 @@ export const Trade = {
8095
8940
  }
8096
8941
  : { connectOrCreate: {
8097
8942
  where: {
8098
- id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
8943
+ id: item.order.takeProfit.id !== undefined ? {
8944
+ equals: item.order.takeProfit.id
8945
+ } : undefined,
8946
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
8099
8947
  },
8100
8948
  create: {
8101
8949
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -8111,7 +8959,12 @@ export const Trade = {
8111
8959
  }
8112
8960
  : { connectOrCreate: {
8113
8961
  where: {
8114
- id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
8962
+ id: item.order.alpacaAccount.id !== undefined ? {
8963
+ equals: item.order.alpacaAccount.id
8964
+ } : undefined,
8965
+ userId: item.order.alpacaAccount.userId !== undefined ? {
8966
+ equals: item.order.alpacaAccount.userId
8967
+ } : undefined,
8115
8968
  },
8116
8969
  create: {
8117
8970
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -8134,7 +8987,9 @@ export const Trade = {
8134
8987
  }
8135
8988
  : { connectOrCreate: {
8136
8989
  where: {
8137
- id: item.order.asset.id !== undefined ? item.order.asset.id : undefined,
8990
+ id: item.order.asset.id !== undefined ? {
8991
+ equals: item.order.asset.id
8992
+ } : undefined,
8138
8993
  symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
8139
8994
  name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
8140
8995
  },
@@ -8215,7 +9070,18 @@ export const Trade = {
8215
9070
  }
8216
9071
  : { connectOrCreate: {
8217
9072
  where: {
8218
- id: item.order.id !== undefined ? item.order.id : undefined,
9073
+ id: item.order.id !== undefined ? {
9074
+ equals: item.order.id
9075
+ } : undefined,
9076
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
9077
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
9078
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
9079
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
9080
+ equals: item.order.alpacaAccountId
9081
+ } : undefined,
9082
+ assetId: item.order.assetId !== undefined ? {
9083
+ equals: item.order.assetId
9084
+ } : undefined,
8219
9085
  },
8220
9086
  create: {
8221
9087
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -8248,7 +9114,10 @@ export const Trade = {
8248
9114
  }
8249
9115
  : { connectOrCreate: {
8250
9116
  where: {
8251
- id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
9117
+ id: item.order.stopLoss.id !== undefined ? {
9118
+ equals: item.order.stopLoss.id
9119
+ } : undefined,
9120
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
8252
9121
  },
8253
9122
  create: {
8254
9123
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -8264,7 +9133,10 @@ export const Trade = {
8264
9133
  }
8265
9134
  : { connectOrCreate: {
8266
9135
  where: {
8267
- id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
9136
+ id: item.order.takeProfit.id !== undefined ? {
9137
+ equals: item.order.takeProfit.id
9138
+ } : undefined,
9139
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
8268
9140
  },
8269
9141
  create: {
8270
9142
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -8280,7 +9152,12 @@ export const Trade = {
8280
9152
  }
8281
9153
  : { connectOrCreate: {
8282
9154
  where: {
8283
- id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
9155
+ id: item.order.alpacaAccount.id !== undefined ? {
9156
+ equals: item.order.alpacaAccount.id
9157
+ } : undefined,
9158
+ userId: item.order.alpacaAccount.userId !== undefined ? {
9159
+ equals: item.order.alpacaAccount.userId
9160
+ } : undefined,
8284
9161
  },
8285
9162
  create: {
8286
9163
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -8303,7 +9180,9 @@ export const Trade = {
8303
9180
  }
8304
9181
  : { connectOrCreate: {
8305
9182
  where: {
8306
- id: item.order.asset.id !== undefined ? item.order.asset.id : undefined,
9183
+ id: item.order.asset.id !== undefined ? {
9184
+ equals: item.order.asset.id
9185
+ } : undefined,
8307
9186
  symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
8308
9187
  name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
8309
9188
  },
@@ -8441,9 +9320,15 @@ export const Trade = {
8441
9320
  }`;
8442
9321
  const variables = {
8443
9322
  where: {
8444
- id: props.id !== undefined ? props.id : undefined,
8445
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
8446
- assetId: props.assetId !== undefined ? props.assetId : undefined,
9323
+ id: props.id !== undefined ? {
9324
+ equals: props.id
9325
+ } : undefined,
9326
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
9327
+ equals: props.alpacaAccountId
9328
+ } : undefined,
9329
+ assetId: props.assetId !== undefined ? {
9330
+ equals: props.assetId
9331
+ } : undefined,
8447
9332
  qty: props.qty !== undefined ? props.qty : undefined,
8448
9333
  price: props.price !== undefined ? props.price : undefined,
8449
9334
  total: props.total !== undefined ? props.total : undefined,
@@ -8522,8 +9407,12 @@ export const Trade = {
8522
9407
  id: props.id !== undefined ? {
8523
9408
  equals: props.id
8524
9409
  } : undefined,
8525
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
8526
- assetId: props.assetId !== undefined ? props.assetId : undefined,
9410
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
9411
+ equals: props.alpacaAccountId
9412
+ } : undefined,
9413
+ assetId: props.assetId !== undefined ? {
9414
+ equals: props.assetId
9415
+ } : undefined,
8527
9416
  qty: props.qty !== undefined ? props.qty : undefined,
8528
9417
  price: props.price !== undefined ? props.price : undefined,
8529
9418
  total: props.total !== undefined ? props.total : undefined,