@adaptic/backend-legacy 0.0.1012 → 0.0.1013

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.
@@ -0,0 +1,83 @@
1
+ import type { PrismaClient, Prisma } from '@prisma/client';
2
+ /** Institutional trading settings (all fields optional; unset ⇒ null). */
3
+ export declare class TradingSettings {
4
+ realTime?: boolean | null;
5
+ marketOpen?: boolean | null;
6
+ tradeAllocationPct?: number | null;
7
+ minPercentageChange?: number | null;
8
+ volumeThreshold?: number | null;
9
+ autoAllocation?: boolean | null;
10
+ allocation?: Prisma.JsonValue | null;
11
+ cryptoTradingEnabled?: boolean | null;
12
+ cryptoTradingPairs?: string[] | null;
13
+ cryptoTradeAllocationPct?: number | null;
14
+ enablePortfolioTrailingStop?: boolean | null;
15
+ portfolioTrailPercent?: number | null;
16
+ portfolioProfitThresholdPercent?: number | null;
17
+ reducedPortfolioTrailPercent?: number | null;
18
+ defaultTrailingStopPercentage100?: number | null;
19
+ firstTrailReductionThreshold100?: number | null;
20
+ secondTrailReductionThreshold100?: number | null;
21
+ firstReducedTrailPercentage100?: number | null;
22
+ secondReducedTrailPercentage100?: number | null;
23
+ minimumPriceChangePercent100?: number | null;
24
+ }
25
+ /** Partial trading-settings patch for org-default / fund-override updates. */
26
+ export declare class TradingSettingsInput {
27
+ realTime?: boolean;
28
+ marketOpen?: boolean;
29
+ tradeAllocationPct?: number;
30
+ minPercentageChange?: number;
31
+ volumeThreshold?: number;
32
+ autoAllocation?: boolean;
33
+ allocation?: Prisma.InputJsonValue;
34
+ cryptoTradingEnabled?: boolean;
35
+ cryptoTradingPairs?: string[];
36
+ cryptoTradeAllocationPct?: number;
37
+ enablePortfolioTrailingStop?: boolean;
38
+ portfolioTrailPercent?: number;
39
+ portfolioProfitThresholdPercent?: number;
40
+ reducedPortfolioTrailPercent?: number;
41
+ defaultTrailingStopPercentage100?: number;
42
+ firstTrailReductionThreshold100?: number;
43
+ secondTrailReductionThreshold100?: number;
44
+ firstReducedTrailPercentage100?: number;
45
+ secondReducedTrailPercentage100?: number;
46
+ minimumPriceChangePercent100?: number;
47
+ }
48
+ /** Result of an org-defaults update: the org plus its resolved defaults. */
49
+ export declare class OrgTradingDefaultsPayload {
50
+ id: string;
51
+ name: string;
52
+ tradingDefaults?: TradingSettings | null;
53
+ }
54
+ /** Result of a fund-overrides update: the fund plus its resolved overrides. */
55
+ export declare class FundTradingOverridesPayload {
56
+ id: string;
57
+ name: string;
58
+ tradingOverrides?: TradingSettings | null;
59
+ }
60
+ /** GraphQL resolver context carrying the Prisma client. */
61
+ interface GraphQLContext {
62
+ prisma: PrismaClient;
63
+ }
64
+ /**
65
+ * Custom resolver implementing the org→fund trading-settings policy layer over
66
+ * `Organization.tradingDefaults` and `Fund.tradingOverrides`.
67
+ */
68
+ export declare class TradingSettingsResolver {
69
+ /** Organization-level trading defaults (the stored blob; unset ⇒ null). */
70
+ organizationTradingDefaults(orgId: string, ctx: GraphQLContext): Promise<TradingSettings>;
71
+ /**
72
+ * Effective settings for an org (and optional fund): `fundOverride ??
73
+ * orgDefault` field-by-field. Unset fields are null — the system-default
74
+ * layer is applied by the runtime/client, not fabricated here.
75
+ */
76
+ effectiveTradingSettings(orgId: string, ctx: GraphQLContext, fundId?: string): Promise<TradingSettings>;
77
+ /** Merge a partial patch into the org's stored trading defaults. */
78
+ updateOrgTradingDefaults(orgId: string, settings: TradingSettingsInput, ctx: GraphQLContext): Promise<OrgTradingDefaultsPayload>;
79
+ /** Merge a partial patch into the fund's stored trading overrides. */
80
+ updateFundTradingOverrides(fundId: string, settings: TradingSettingsInput, ctx: GraphQLContext): Promise<FundTradingOverridesPayload>;
81
+ }
82
+ export {};
83
+ //# sourceMappingURL=TradingSettingsResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TradingSettingsResolver.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/custom/TradingSettingsResolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,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c,GACrC,OAAO,CAAC,eAAe,CAAC;IAW3B;;;;OAIG;IAMG,wBAAwB,CACiB,KAAK,EAAE,MAAM,EACvC,GAAG,EAAE,cAAc,EAEtC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC;IA2B3B,oEAAoE;IAM9D,wBAAwB,CACiB,KAAK,EAAE,MAAM,EAE1D,QAAQ,EAAE,oBAAoB,EACX,GAAG,EAAE,cAAc,GACrC,OAAO,CAAC,yBAAyB,CAAC;IA2BrC,sEAAsE;IAKhE,0BAA0B,CACgB,MAAM,EAAE,MAAM,EAE5D,QAAQ,EAAE,oBAAoB,EACX,GAAG,EAAE,cAAc,GACrC,OAAO,CAAC,2BAA2B,CAAC;CA0BxC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TradingSettingsResolver.js","sourceRoot":"","sources":["../../../../src/resolvers/custom/TradingSettingsResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAElF;;;;;;;;;;;;;;GAcG;AAEH,4EAA4E;AAC5E,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,sBAAsB;IACtB,oBAAoB;IACpB,0BAA0B;IAC1B,6BAA6B;IAC7B,uBAAuB;IACvB,iCAAiC;IACjC,8BAA8B;IAC9B,kCAAkC;IAClC,iCAAiC;IACjC,kCAAkC;IAClC,gCAAgC;IAChC,iCAAiC;IACjC,8BAA8B;CACtB,CAAC;AAKX,0EAA0E;AAEnE,IAAM,eAAe,GAArB,MAAM,eAAe;IAE1B,QAAQ,CAAkB;IAG1B,UAAU,CAAkB;IAG5B,kBAAkB,CAAiB;IAGnC,mBAAmB,C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AAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAA;IAE5D,WAAA,WAAW,CAAC,GAAG,EAAE,CAAA;;6CADR,oBAAoB;;yEA2B/B;AAvIU,uBAAuB;IADnC,WAAW,CAAC,QAAQ,EAAE;GACV,uBAAuB,CAwInC"}
@@ -0,0 +1,491 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import * as TypeGraphQL from 'type-graphql';
14
+ import * as GraphQLScalars from 'graphql-scalars';
15
+ import { getPrismaFromContext } from '../../generated/typegraphql-prisma/helpers.mjs';
16
+ /**
17
+ * Institutional trading settings — the org→fund policy-resolution layer.
18
+ *
19
+ * Trading settings are configured at two levels and stored as JSON blobs on the
20
+ * owning rows: organization defaults (`Organization.tradingDefaults`) and
21
+ * per-fund overrides (`Fund.tradingOverrides`). The effective settings resolve
22
+ * `fundOverride ?? orgDefault` field-by-field; the SYSTEM-default layer is owned
23
+ * by the engine/client at runtime (the platform layers its own
24
+ * `SYSTEM_TRADING_DEFAULTS`), so this API returns only what is explicitly stored
25
+ * — an unset field is `null`, never a fabricated default.
26
+ *
27
+ * All fields are nullable: a settings object carries only the keys an operator
28
+ * has actually set. Updates are partial merges — a field absent from the input
29
+ * leaves the stored value untouched.
30
+ */
31
+ /** The 20 trading-settings field keys, in the platform's fragment order. */
32
+ const TRADING_SETTINGS_KEYS = [
33
+ 'realTime',
34
+ 'marketOpen',
35
+ 'tradeAllocationPct',
36
+ 'minPercentageChange',
37
+ 'volumeThreshold',
38
+ 'autoAllocation',
39
+ 'allocation',
40
+ 'cryptoTradingEnabled',
41
+ 'cryptoTradingPairs',
42
+ 'cryptoTradeAllocationPct',
43
+ 'enablePortfolioTrailingStop',
44
+ 'portfolioTrailPercent',
45
+ 'portfolioProfitThresholdPercent',
46
+ 'reducedPortfolioTrailPercent',
47
+ 'defaultTrailingStopPercentage100',
48
+ 'firstTrailReductionThreshold100',
49
+ 'secondTrailReductionThreshold100',
50
+ 'firstReducedTrailPercentage100',
51
+ 'secondReducedTrailPercentage100',
52
+ 'minimumPriceChangePercent100',
53
+ ];
54
+ /** Institutional trading settings (all fields optional; unset ⇒ null). */
55
+ let TradingSettings = class TradingSettings {
56
+ realTime;
57
+ marketOpen;
58
+ tradeAllocationPct;
59
+ minPercentageChange;
60
+ volumeThreshold;
61
+ autoAllocation;
62
+ allocation;
63
+ cryptoTradingEnabled;
64
+ cryptoTradingPairs;
65
+ cryptoTradeAllocationPct;
66
+ enablePortfolioTrailingStop;
67
+ portfolioTrailPercent;
68
+ portfolioProfitThresholdPercent;
69
+ reducedPortfolioTrailPercent;
70
+ defaultTrailingStopPercentage100;
71
+ firstTrailReductionThreshold100;
72
+ secondTrailReductionThreshold100;
73
+ firstReducedTrailPercentage100;
74
+ secondReducedTrailPercentage100;
75
+ minimumPriceChangePercent100;
76
+ };
77
+ __decorate([
78
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
79
+ __metadata("design:type", Object)
80
+ ], TradingSettings.prototype, "realTime", void 0);
81
+ __decorate([
82
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
83
+ __metadata("design:type", Object)
84
+ ], TradingSettings.prototype, "marketOpen", void 0);
85
+ __decorate([
86
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
87
+ __metadata("design:type", Object)
88
+ ], TradingSettings.prototype, "tradeAllocationPct", void 0);
89
+ __decorate([
90
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
91
+ __metadata("design:type", Object)
92
+ ], TradingSettings.prototype, "minPercentageChange", void 0);
93
+ __decorate([
94
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
95
+ __metadata("design:type", Object)
96
+ ], TradingSettings.prototype, "volumeThreshold", void 0);
97
+ __decorate([
98
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
99
+ __metadata("design:type", Object)
100
+ ], TradingSettings.prototype, "autoAllocation", void 0);
101
+ __decorate([
102
+ TypeGraphQL.Field((_type) => GraphQLScalars.JSONResolver, { nullable: true }),
103
+ __metadata("design:type", Object)
104
+ ], TradingSettings.prototype, "allocation", void 0);
105
+ __decorate([
106
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
107
+ __metadata("design:type", Object)
108
+ ], TradingSettings.prototype, "cryptoTradingEnabled", void 0);
109
+ __decorate([
110
+ TypeGraphQL.Field((_type) => [String], { nullable: true }),
111
+ __metadata("design:type", Object)
112
+ ], TradingSettings.prototype, "cryptoTradingPairs", void 0);
113
+ __decorate([
114
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
115
+ __metadata("design:type", Object)
116
+ ], TradingSettings.prototype, "cryptoTradeAllocationPct", void 0);
117
+ __decorate([
118
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
119
+ __metadata("design:type", Object)
120
+ ], TradingSettings.prototype, "enablePortfolioTrailingStop", void 0);
121
+ __decorate([
122
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
123
+ __metadata("design:type", Object)
124
+ ], TradingSettings.prototype, "portfolioTrailPercent", void 0);
125
+ __decorate([
126
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
127
+ __metadata("design:type", Object)
128
+ ], TradingSettings.prototype, "portfolioProfitThresholdPercent", void 0);
129
+ __decorate([
130
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
131
+ __metadata("design:type", Object)
132
+ ], TradingSettings.prototype, "reducedPortfolioTrailPercent", void 0);
133
+ __decorate([
134
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
135
+ __metadata("design:type", Object)
136
+ ], TradingSettings.prototype, "defaultTrailingStopPercentage100", void 0);
137
+ __decorate([
138
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
139
+ __metadata("design:type", Object)
140
+ ], TradingSettings.prototype, "firstTrailReductionThreshold100", void 0);
141
+ __decorate([
142
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
143
+ __metadata("design:type", Object)
144
+ ], TradingSettings.prototype, "secondTrailReductionThreshold100", void 0);
145
+ __decorate([
146
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
147
+ __metadata("design:type", Object)
148
+ ], TradingSettings.prototype, "firstReducedTrailPercentage100", void 0);
149
+ __decorate([
150
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
151
+ __metadata("design:type", Object)
152
+ ], TradingSettings.prototype, "secondReducedTrailPercentage100", void 0);
153
+ __decorate([
154
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
155
+ __metadata("design:type", Object)
156
+ ], TradingSettings.prototype, "minimumPriceChangePercent100", void 0);
157
+ TradingSettings = __decorate([
158
+ TypeGraphQL.ObjectType('TradingSettings', {})
159
+ ], TradingSettings);
160
+ export { TradingSettings };
161
+ /** Partial trading-settings patch for org-default / fund-override updates. */
162
+ let TradingSettingsInput = class TradingSettingsInput {
163
+ realTime;
164
+ marketOpen;
165
+ tradeAllocationPct;
166
+ minPercentageChange;
167
+ volumeThreshold;
168
+ autoAllocation;
169
+ allocation;
170
+ cryptoTradingEnabled;
171
+ cryptoTradingPairs;
172
+ cryptoTradeAllocationPct;
173
+ enablePortfolioTrailingStop;
174
+ portfolioTrailPercent;
175
+ portfolioProfitThresholdPercent;
176
+ reducedPortfolioTrailPercent;
177
+ defaultTrailingStopPercentage100;
178
+ firstTrailReductionThreshold100;
179
+ secondTrailReductionThreshold100;
180
+ firstReducedTrailPercentage100;
181
+ secondReducedTrailPercentage100;
182
+ minimumPriceChangePercent100;
183
+ };
184
+ __decorate([
185
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
186
+ __metadata("design:type", Boolean)
187
+ ], TradingSettingsInput.prototype, "realTime", void 0);
188
+ __decorate([
189
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
190
+ __metadata("design:type", Boolean)
191
+ ], TradingSettingsInput.prototype, "marketOpen", void 0);
192
+ __decorate([
193
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
194
+ __metadata("design:type", Number)
195
+ ], TradingSettingsInput.prototype, "tradeAllocationPct", void 0);
196
+ __decorate([
197
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
198
+ __metadata("design:type", Number)
199
+ ], TradingSettingsInput.prototype, "minPercentageChange", void 0);
200
+ __decorate([
201
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
202
+ __metadata("design:type", Number)
203
+ ], TradingSettingsInput.prototype, "volumeThreshold", void 0);
204
+ __decorate([
205
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
206
+ __metadata("design:type", Boolean)
207
+ ], TradingSettingsInput.prototype, "autoAllocation", void 0);
208
+ __decorate([
209
+ TypeGraphQL.Field((_type) => GraphQLScalars.JSONResolver, { nullable: true }),
210
+ __metadata("design:type", Object)
211
+ ], TradingSettingsInput.prototype, "allocation", void 0);
212
+ __decorate([
213
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
214
+ __metadata("design:type", Boolean)
215
+ ], TradingSettingsInput.prototype, "cryptoTradingEnabled", void 0);
216
+ __decorate([
217
+ TypeGraphQL.Field((_type) => [String], { nullable: true }),
218
+ __metadata("design:type", Array)
219
+ ], TradingSettingsInput.prototype, "cryptoTradingPairs", void 0);
220
+ __decorate([
221
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
222
+ __metadata("design:type", Number)
223
+ ], TradingSettingsInput.prototype, "cryptoTradeAllocationPct", void 0);
224
+ __decorate([
225
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
226
+ __metadata("design:type", Boolean)
227
+ ], TradingSettingsInput.prototype, "enablePortfolioTrailingStop", void 0);
228
+ __decorate([
229
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
230
+ __metadata("design:type", Number)
231
+ ], TradingSettingsInput.prototype, "portfolioTrailPercent", void 0);
232
+ __decorate([
233
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
234
+ __metadata("design:type", Number)
235
+ ], TradingSettingsInput.prototype, "portfolioProfitThresholdPercent", void 0);
236
+ __decorate([
237
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
238
+ __metadata("design:type", Number)
239
+ ], TradingSettingsInput.prototype, "reducedPortfolioTrailPercent", void 0);
240
+ __decorate([
241
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
242
+ __metadata("design:type", Number)
243
+ ], TradingSettingsInput.prototype, "defaultTrailingStopPercentage100", void 0);
244
+ __decorate([
245
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
246
+ __metadata("design:type", Number)
247
+ ], TradingSettingsInput.prototype, "firstTrailReductionThreshold100", void 0);
248
+ __decorate([
249
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
250
+ __metadata("design:type", Number)
251
+ ], TradingSettingsInput.prototype, "secondTrailReductionThreshold100", void 0);
252
+ __decorate([
253
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
254
+ __metadata("design:type", Number)
255
+ ], TradingSettingsInput.prototype, "firstReducedTrailPercentage100", void 0);
256
+ __decorate([
257
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
258
+ __metadata("design:type", Number)
259
+ ], TradingSettingsInput.prototype, "secondReducedTrailPercentage100", void 0);
260
+ __decorate([
261
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
262
+ __metadata("design:type", Number)
263
+ ], TradingSettingsInput.prototype, "minimumPriceChangePercent100", void 0);
264
+ TradingSettingsInput = __decorate([
265
+ TypeGraphQL.InputType('TradingSettingsInput', {})
266
+ ], TradingSettingsInput);
267
+ export { TradingSettingsInput };
268
+ /** Result of an org-defaults update: the org plus its resolved defaults. */
269
+ let OrgTradingDefaultsPayload = class OrgTradingDefaultsPayload {
270
+ id;
271
+ name;
272
+ tradingDefaults;
273
+ };
274
+ __decorate([
275
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
276
+ __metadata("design:type", String)
277
+ ], OrgTradingDefaultsPayload.prototype, "id", void 0);
278
+ __decorate([
279
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
280
+ __metadata("design:type", String)
281
+ ], OrgTradingDefaultsPayload.prototype, "name", void 0);
282
+ __decorate([
283
+ TypeGraphQL.Field((_type) => TradingSettings, { nullable: true }),
284
+ __metadata("design:type", Object)
285
+ ], OrgTradingDefaultsPayload.prototype, "tradingDefaults", void 0);
286
+ OrgTradingDefaultsPayload = __decorate([
287
+ TypeGraphQL.ObjectType('OrgTradingDefaultsPayload', {})
288
+ ], OrgTradingDefaultsPayload);
289
+ export { OrgTradingDefaultsPayload };
290
+ /** Result of a fund-overrides update: the fund plus its resolved overrides. */
291
+ let FundTradingOverridesPayload = class FundTradingOverridesPayload {
292
+ id;
293
+ name;
294
+ tradingOverrides;
295
+ };
296
+ __decorate([
297
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
298
+ __metadata("design:type", String)
299
+ ], FundTradingOverridesPayload.prototype, "id", void 0);
300
+ __decorate([
301
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
302
+ __metadata("design:type", String)
303
+ ], FundTradingOverridesPayload.prototype, "name", void 0);
304
+ __decorate([
305
+ TypeGraphQL.Field((_type) => TradingSettings, { nullable: true }),
306
+ __metadata("design:type", Object)
307
+ ], FundTradingOverridesPayload.prototype, "tradingOverrides", void 0);
308
+ FundTradingOverridesPayload = __decorate([
309
+ TypeGraphQL.ObjectType('FundTradingOverridesPayload', {})
310
+ ], FundTradingOverridesPayload);
311
+ export { FundTradingOverridesPayload };
312
+ /**
313
+ * Coerce a stored JSON settings blob into a plain record, dropping any
314
+ * non-object value (a corrupt/legacy scalar) to an empty record so callers
315
+ * always see a well-formed settings object.
316
+ */
317
+ function toSettingsRecord(value) {
318
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
319
+ return value;
320
+ }
321
+ return {};
322
+ }
323
+ /**
324
+ * Project a settings record onto exactly the known trading-settings keys,
325
+ * dropping any stray keys. Present keys keep their stored value (including an
326
+ * explicit `null`); absent keys are omitted so GraphQL resolves them to `null`.
327
+ */
328
+ function projectSettings(record) {
329
+ const out = {};
330
+ for (const key of TRADING_SETTINGS_KEYS) {
331
+ if (key in record) {
332
+ out[key] = record[key];
333
+ }
334
+ }
335
+ return out;
336
+ }
337
+ /**
338
+ * Merge a partial input patch onto an existing settings record. Only keys
339
+ * actually supplied in the patch (value !== undefined) overwrite; every other
340
+ * stored value is preserved. Returns a plain JSON-serialisable record.
341
+ */
342
+ function mergeSettings(existing, patch) {
343
+ const merged = { ...projectSettings(existing) };
344
+ for (const key of TRADING_SETTINGS_KEYS) {
345
+ const next = patch[key];
346
+ if (next !== undefined) {
347
+ merged[key] = next;
348
+ }
349
+ }
350
+ return merged;
351
+ }
352
+ /**
353
+ * Custom resolver implementing the org→fund trading-settings policy layer over
354
+ * `Organization.tradingDefaults` and `Fund.tradingOverrides`.
355
+ */
356
+ let TradingSettingsResolver = class TradingSettingsResolver {
357
+ /** Organization-level trading defaults (the stored blob; unset ⇒ null). */
358
+ async organizationTradingDefaults(orgId, ctx) {
359
+ const prisma = getPrismaFromContext(ctx);
360
+ const org = await prisma.organization.findUnique({
361
+ where: { id: orgId },
362
+ select: { tradingDefaults: true },
363
+ });
364
+ return projectSettings(toSettingsRecord(org?.tradingDefaults));
365
+ }
366
+ /**
367
+ * Effective settings for an org (and optional fund): `fundOverride ??
368
+ * orgDefault` field-by-field. Unset fields are null — the system-default
369
+ * layer is applied by the runtime/client, not fabricated here.
370
+ */
371
+ async effectiveTradingSettings(orgId, ctx, fundId) {
372
+ const prisma = getPrismaFromContext(ctx);
373
+ const [org, fund] = await Promise.all([
374
+ prisma.organization.findUnique({
375
+ where: { id: orgId },
376
+ select: { tradingDefaults: true },
377
+ }),
378
+ fundId
379
+ ? prisma.fund.findUnique({
380
+ where: { id: fundId },
381
+ select: { tradingOverrides: true },
382
+ })
383
+ : Promise.resolve(null),
384
+ ]);
385
+ const orgDefaults = projectSettings(toSettingsRecord(org?.tradingDefaults));
386
+ const fundOverrides = projectSettings(toSettingsRecord(fund?.tradingOverrides));
387
+ const effective = {};
388
+ for (const key of TRADING_SETTINGS_KEYS) {
389
+ const fundVal = fundOverrides[key];
390
+ effective[key] =
391
+ fundVal !== undefined && fundVal !== null ? fundVal : orgDefaults[key];
392
+ }
393
+ return effective;
394
+ }
395
+ /** Merge a partial patch into the org's stored trading defaults. */
396
+ async updateOrgTradingDefaults(orgId, settings, ctx) {
397
+ const prisma = getPrismaFromContext(ctx);
398
+ const existing = await prisma.organization.findUnique({
399
+ where: { id: orgId },
400
+ select: { tradingDefaults: true },
401
+ });
402
+ if (!existing) {
403
+ throw new Error(`Organization ${orgId} not found`);
404
+ }
405
+ const merged = mergeSettings(toSettingsRecord(existing.tradingDefaults), settings);
406
+ const updated = await prisma.organization.update({
407
+ where: { id: orgId },
408
+ data: { tradingDefaults: merged },
409
+ select: { id: true, name: true, tradingDefaults: true },
410
+ });
411
+ return {
412
+ id: updated.id,
413
+ name: updated.name,
414
+ tradingDefaults: projectSettings(toSettingsRecord(updated.tradingDefaults)),
415
+ };
416
+ }
417
+ /** Merge a partial patch into the fund's stored trading overrides. */
418
+ async updateFundTradingOverrides(fundId, settings, ctx) {
419
+ const prisma = getPrismaFromContext(ctx);
420
+ const existing = await prisma.fund.findUnique({
421
+ where: { id: fundId },
422
+ select: { tradingOverrides: true },
423
+ });
424
+ if (!existing) {
425
+ throw new Error(`Fund ${fundId} not found`);
426
+ }
427
+ const merged = mergeSettings(toSettingsRecord(existing.tradingOverrides), settings);
428
+ const updated = await prisma.fund.update({
429
+ where: { id: fundId },
430
+ data: { tradingOverrides: merged },
431
+ select: { id: true, name: true, tradingOverrides: true },
432
+ });
433
+ return {
434
+ id: updated.id,
435
+ name: updated.name,
436
+ tradingOverrides: projectSettings(toSettingsRecord(updated.tradingOverrides)),
437
+ };
438
+ }
439
+ };
440
+ __decorate([
441
+ TypeGraphQL.Query((_returns) => TradingSettings, {
442
+ nullable: true,
443
+ description: 'Organization-level trading defaults (unset fields are null).',
444
+ }),
445
+ __param(0, TypeGraphQL.Arg('orgId', (_type) => String)),
446
+ __param(1, TypeGraphQL.Ctx()),
447
+ __metadata("design:type", Function),
448
+ __metadata("design:paramtypes", [String, Object]),
449
+ __metadata("design:returntype", Promise)
450
+ ], TradingSettingsResolver.prototype, "organizationTradingDefaults", null);
451
+ __decorate([
452
+ TypeGraphQL.Query((_returns) => TradingSettings, {
453
+ nullable: true,
454
+ description: 'Effective trading settings: fund override takes precedence over org default, field by field.',
455
+ }),
456
+ __param(0, TypeGraphQL.Arg('orgId', (_type) => String)),
457
+ __param(1, TypeGraphQL.Ctx()),
458
+ __param(2, TypeGraphQL.Arg('fundId', (_type) => String, { nullable: true })),
459
+ __metadata("design:type", Function),
460
+ __metadata("design:paramtypes", [String, Object, String]),
461
+ __metadata("design:returntype", Promise)
462
+ ], TradingSettingsResolver.prototype, "effectiveTradingSettings", null);
463
+ __decorate([
464
+ TypeGraphQL.Mutation((_returns) => OrgTradingDefaultsPayload, {
465
+ nullable: false,
466
+ description: 'Update (partial-merge) the organization-level trading defaults.',
467
+ }),
468
+ __param(0, TypeGraphQL.Arg('orgId', (_type) => String)),
469
+ __param(1, TypeGraphQL.Arg('settings', (_type) => TradingSettingsInput)),
470
+ __param(2, TypeGraphQL.Ctx()),
471
+ __metadata("design:type", Function),
472
+ __metadata("design:paramtypes", [String, TradingSettingsInput, Object]),
473
+ __metadata("design:returntype", Promise)
474
+ ], TradingSettingsResolver.prototype, "updateOrgTradingDefaults", null);
475
+ __decorate([
476
+ TypeGraphQL.Mutation((_returns) => FundTradingOverridesPayload, {
477
+ nullable: false,
478
+ description: 'Update (partial-merge) the fund-level trading overrides.',
479
+ }),
480
+ __param(0, TypeGraphQL.Arg('fundId', (_type) => String)),
481
+ __param(1, TypeGraphQL.Arg('settings', (_type) => TradingSettingsInput)),
482
+ __param(2, TypeGraphQL.Ctx()),
483
+ __metadata("design:type", Function),
484
+ __metadata("design:paramtypes", [String, TradingSettingsInput, Object]),
485
+ __metadata("design:returntype", Promise)
486
+ ], TradingSettingsResolver.prototype, "updateFundTradingOverrides", null);
487
+ TradingSettingsResolver = __decorate([
488
+ TypeGraphQL.Resolver()
489
+ ], TradingSettingsResolver);
490
+ export { TradingSettingsResolver };
491
+ //# sourceMappingURL=TradingSettingsResolver.js.map
@@ -5,4 +5,5 @@
5
5
  */
6
6
  export { OptionsGreeksHistoryCustomResolver } from './OptionsGreeksHistoryCustomResolver';
7
7
  export { OptionsGreeksHistorySystemSummary } from './OptionsGreeksHistorySystemSummary';
8
+ export { TradingSettingsResolver, TradingSettings, TradingSettingsInput, OrgTradingDefaultsPayload, FundTradingOverridesPayload, } from './TradingSettingsResolver';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC"}
@@ -5,4 +5,5 @@
5
5
  */
6
6
  export { OptionsGreeksHistoryCustomResolver } from './OptionsGreeksHistoryCustomResolver.mjs';
7
7
  export { OptionsGreeksHistorySystemSummary } from './OptionsGreeksHistorySystemSummary.mjs';
8
+ export { TradingSettingsResolver, TradingSettings, TradingSettingsInput, OrgTradingDefaultsPayload, FundTradingOverridesPayload, } from './TradingSettingsResolver.mjs';
8
9
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/backend-legacy",
3
- "version": "0.0.1012",
3
+ "version": "0.0.1013",
4
4
  "description": "Backend executable CRUD functions with dynamic variables construction, and type definitions for the Adaptic AI platform.",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,481 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
45
+ return function (target, key) { decorator(target, key, paramIndex); }
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.TradingSettingsResolver = exports.FundTradingOverridesPayload = exports.OrgTradingDefaultsPayload = exports.TradingSettingsInput = exports.TradingSettings = void 0;
49
+ const TypeGraphQL = __importStar(require("type-graphql"));
50
+ const GraphQLScalars = __importStar(require("graphql-scalars"));
51
+ const helpers_1 = require("../../generated/typegraphql-prisma/helpers.cjs");
52
+ /**
53
+ * Institutional trading settings — the org→fund policy-resolution layer.
54
+ *
55
+ * Trading settings are configured at two levels and stored as JSON blobs on the
56
+ * owning rows: organization defaults (`Organization.tradingDefaults`) and
57
+ * per-fund overrides (`Fund.tradingOverrides`). The effective settings resolve
58
+ * `fundOverride ?? orgDefault` field-by-field; the SYSTEM-default layer is owned
59
+ * by the engine/client at runtime (the platform layers its own
60
+ * `SYSTEM_TRADING_DEFAULTS`), so this API returns only what is explicitly stored
61
+ * — an unset field is `null`, never a fabricated default.
62
+ *
63
+ * All fields are nullable: a settings object carries only the keys an operator
64
+ * has actually set. Updates are partial merges — a field absent from the input
65
+ * leaves the stored value untouched.
66
+ */
67
+ /** The 20 trading-settings field keys, in the platform's fragment order. */
68
+ const TRADING_SETTINGS_KEYS = [
69
+ 'realTime',
70
+ 'marketOpen',
71
+ 'tradeAllocationPct',
72
+ 'minPercentageChange',
73
+ 'volumeThreshold',
74
+ 'autoAllocation',
75
+ 'allocation',
76
+ 'cryptoTradingEnabled',
77
+ 'cryptoTradingPairs',
78
+ 'cryptoTradeAllocationPct',
79
+ 'enablePortfolioTrailingStop',
80
+ 'portfolioTrailPercent',
81
+ 'portfolioProfitThresholdPercent',
82
+ 'reducedPortfolioTrailPercent',
83
+ 'defaultTrailingStopPercentage100',
84
+ 'firstTrailReductionThreshold100',
85
+ 'secondTrailReductionThreshold100',
86
+ 'firstReducedTrailPercentage100',
87
+ 'secondReducedTrailPercentage100',
88
+ 'minimumPriceChangePercent100',
89
+ ];
90
+ /** Institutional trading settings (all fields optional; unset ⇒ null). */
91
+ let TradingSettings = class TradingSettings {
92
+ };
93
+ exports.TradingSettings = TradingSettings;
94
+ __decorate([
95
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
96
+ __metadata("design:type", Object)
97
+ ], TradingSettings.prototype, "realTime", void 0);
98
+ __decorate([
99
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
100
+ __metadata("design:type", Object)
101
+ ], TradingSettings.prototype, "marketOpen", void 0);
102
+ __decorate([
103
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
104
+ __metadata("design:type", Object)
105
+ ], TradingSettings.prototype, "tradeAllocationPct", void 0);
106
+ __decorate([
107
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
108
+ __metadata("design:type", Object)
109
+ ], TradingSettings.prototype, "minPercentageChange", void 0);
110
+ __decorate([
111
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
112
+ __metadata("design:type", Object)
113
+ ], TradingSettings.prototype, "volumeThreshold", void 0);
114
+ __decorate([
115
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
116
+ __metadata("design:type", Object)
117
+ ], TradingSettings.prototype, "autoAllocation", void 0);
118
+ __decorate([
119
+ TypeGraphQL.Field((_type) => GraphQLScalars.JSONResolver, { nullable: true }),
120
+ __metadata("design:type", Object)
121
+ ], TradingSettings.prototype, "allocation", void 0);
122
+ __decorate([
123
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
124
+ __metadata("design:type", Object)
125
+ ], TradingSettings.prototype, "cryptoTradingEnabled", void 0);
126
+ __decorate([
127
+ TypeGraphQL.Field((_type) => [String], { nullable: true }),
128
+ __metadata("design:type", Object)
129
+ ], TradingSettings.prototype, "cryptoTradingPairs", void 0);
130
+ __decorate([
131
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
132
+ __metadata("design:type", Object)
133
+ ], TradingSettings.prototype, "cryptoTradeAllocationPct", void 0);
134
+ __decorate([
135
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
136
+ __metadata("design:type", Object)
137
+ ], TradingSettings.prototype, "enablePortfolioTrailingStop", void 0);
138
+ __decorate([
139
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
140
+ __metadata("design:type", Object)
141
+ ], TradingSettings.prototype, "portfolioTrailPercent", void 0);
142
+ __decorate([
143
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
144
+ __metadata("design:type", Object)
145
+ ], TradingSettings.prototype, "portfolioProfitThresholdPercent", void 0);
146
+ __decorate([
147
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
148
+ __metadata("design:type", Object)
149
+ ], TradingSettings.prototype, "reducedPortfolioTrailPercent", void 0);
150
+ __decorate([
151
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
152
+ __metadata("design:type", Object)
153
+ ], TradingSettings.prototype, "defaultTrailingStopPercentage100", void 0);
154
+ __decorate([
155
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
156
+ __metadata("design:type", Object)
157
+ ], TradingSettings.prototype, "firstTrailReductionThreshold100", void 0);
158
+ __decorate([
159
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
160
+ __metadata("design:type", Object)
161
+ ], TradingSettings.prototype, "secondTrailReductionThreshold100", void 0);
162
+ __decorate([
163
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
164
+ __metadata("design:type", Object)
165
+ ], TradingSettings.prototype, "firstReducedTrailPercentage100", void 0);
166
+ __decorate([
167
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
168
+ __metadata("design:type", Object)
169
+ ], TradingSettings.prototype, "secondReducedTrailPercentage100", void 0);
170
+ __decorate([
171
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
172
+ __metadata("design:type", Object)
173
+ ], TradingSettings.prototype, "minimumPriceChangePercent100", void 0);
174
+ exports.TradingSettings = TradingSettings = __decorate([
175
+ TypeGraphQL.ObjectType('TradingSettings', {})
176
+ ], TradingSettings);
177
+ /** Partial trading-settings patch for org-default / fund-override updates. */
178
+ let TradingSettingsInput = class TradingSettingsInput {
179
+ };
180
+ exports.TradingSettingsInput = TradingSettingsInput;
181
+ __decorate([
182
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
183
+ __metadata("design:type", Boolean)
184
+ ], TradingSettingsInput.prototype, "realTime", void 0);
185
+ __decorate([
186
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
187
+ __metadata("design:type", Boolean)
188
+ ], TradingSettingsInput.prototype, "marketOpen", void 0);
189
+ __decorate([
190
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
191
+ __metadata("design:type", Number)
192
+ ], TradingSettingsInput.prototype, "tradeAllocationPct", void 0);
193
+ __decorate([
194
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
195
+ __metadata("design:type", Number)
196
+ ], TradingSettingsInput.prototype, "minPercentageChange", void 0);
197
+ __decorate([
198
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
199
+ __metadata("design:type", Number)
200
+ ], TradingSettingsInput.prototype, "volumeThreshold", void 0);
201
+ __decorate([
202
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
203
+ __metadata("design:type", Boolean)
204
+ ], TradingSettingsInput.prototype, "autoAllocation", void 0);
205
+ __decorate([
206
+ TypeGraphQL.Field((_type) => GraphQLScalars.JSONResolver, { nullable: true }),
207
+ __metadata("design:type", Object)
208
+ ], TradingSettingsInput.prototype, "allocation", void 0);
209
+ __decorate([
210
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
211
+ __metadata("design:type", Boolean)
212
+ ], TradingSettingsInput.prototype, "cryptoTradingEnabled", void 0);
213
+ __decorate([
214
+ TypeGraphQL.Field((_type) => [String], { nullable: true }),
215
+ __metadata("design:type", Array)
216
+ ], TradingSettingsInput.prototype, "cryptoTradingPairs", void 0);
217
+ __decorate([
218
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
219
+ __metadata("design:type", Number)
220
+ ], TradingSettingsInput.prototype, "cryptoTradeAllocationPct", void 0);
221
+ __decorate([
222
+ TypeGraphQL.Field((_type) => Boolean, { nullable: true }),
223
+ __metadata("design:type", Boolean)
224
+ ], TradingSettingsInput.prototype, "enablePortfolioTrailingStop", void 0);
225
+ __decorate([
226
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
227
+ __metadata("design:type", Number)
228
+ ], TradingSettingsInput.prototype, "portfolioTrailPercent", void 0);
229
+ __decorate([
230
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
231
+ __metadata("design:type", Number)
232
+ ], TradingSettingsInput.prototype, "portfolioProfitThresholdPercent", void 0);
233
+ __decorate([
234
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
235
+ __metadata("design:type", Number)
236
+ ], TradingSettingsInput.prototype, "reducedPortfolioTrailPercent", void 0);
237
+ __decorate([
238
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
239
+ __metadata("design:type", Number)
240
+ ], TradingSettingsInput.prototype, "defaultTrailingStopPercentage100", void 0);
241
+ __decorate([
242
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
243
+ __metadata("design:type", Number)
244
+ ], TradingSettingsInput.prototype, "firstTrailReductionThreshold100", void 0);
245
+ __decorate([
246
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
247
+ __metadata("design:type", Number)
248
+ ], TradingSettingsInput.prototype, "secondTrailReductionThreshold100", void 0);
249
+ __decorate([
250
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
251
+ __metadata("design:type", Number)
252
+ ], TradingSettingsInput.prototype, "firstReducedTrailPercentage100", void 0);
253
+ __decorate([
254
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
255
+ __metadata("design:type", Number)
256
+ ], TradingSettingsInput.prototype, "secondReducedTrailPercentage100", void 0);
257
+ __decorate([
258
+ TypeGraphQL.Field((_type) => TypeGraphQL.Float, { nullable: true }),
259
+ __metadata("design:type", Number)
260
+ ], TradingSettingsInput.prototype, "minimumPriceChangePercent100", void 0);
261
+ exports.TradingSettingsInput = TradingSettingsInput = __decorate([
262
+ TypeGraphQL.InputType('TradingSettingsInput', {})
263
+ ], TradingSettingsInput);
264
+ /** Result of an org-defaults update: the org plus its resolved defaults. */
265
+ let OrgTradingDefaultsPayload = class OrgTradingDefaultsPayload {
266
+ };
267
+ exports.OrgTradingDefaultsPayload = OrgTradingDefaultsPayload;
268
+ __decorate([
269
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
270
+ __metadata("design:type", String)
271
+ ], OrgTradingDefaultsPayload.prototype, "id", void 0);
272
+ __decorate([
273
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
274
+ __metadata("design:type", String)
275
+ ], OrgTradingDefaultsPayload.prototype, "name", void 0);
276
+ __decorate([
277
+ TypeGraphQL.Field((_type) => TradingSettings, { nullable: true }),
278
+ __metadata("design:type", Object)
279
+ ], OrgTradingDefaultsPayload.prototype, "tradingDefaults", void 0);
280
+ exports.OrgTradingDefaultsPayload = OrgTradingDefaultsPayload = __decorate([
281
+ TypeGraphQL.ObjectType('OrgTradingDefaultsPayload', {})
282
+ ], OrgTradingDefaultsPayload);
283
+ /** Result of a fund-overrides update: the fund plus its resolved overrides. */
284
+ let FundTradingOverridesPayload = class FundTradingOverridesPayload {
285
+ };
286
+ exports.FundTradingOverridesPayload = FundTradingOverridesPayload;
287
+ __decorate([
288
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
289
+ __metadata("design:type", String)
290
+ ], FundTradingOverridesPayload.prototype, "id", void 0);
291
+ __decorate([
292
+ TypeGraphQL.Field((_type) => String, { nullable: false }),
293
+ __metadata("design:type", String)
294
+ ], FundTradingOverridesPayload.prototype, "name", void 0);
295
+ __decorate([
296
+ TypeGraphQL.Field((_type) => TradingSettings, { nullable: true }),
297
+ __metadata("design:type", Object)
298
+ ], FundTradingOverridesPayload.prototype, "tradingOverrides", void 0);
299
+ exports.FundTradingOverridesPayload = FundTradingOverridesPayload = __decorate([
300
+ TypeGraphQL.ObjectType('FundTradingOverridesPayload', {})
301
+ ], FundTradingOverridesPayload);
302
+ /**
303
+ * Coerce a stored JSON settings blob into a plain record, dropping any
304
+ * non-object value (a corrupt/legacy scalar) to an empty record so callers
305
+ * always see a well-formed settings object.
306
+ */
307
+ function toSettingsRecord(value) {
308
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
309
+ return value;
310
+ }
311
+ return {};
312
+ }
313
+ /**
314
+ * Project a settings record onto exactly the known trading-settings keys,
315
+ * dropping any stray keys. Present keys keep their stored value (including an
316
+ * explicit `null`); absent keys are omitted so GraphQL resolves them to `null`.
317
+ */
318
+ function projectSettings(record) {
319
+ const out = {};
320
+ for (const key of TRADING_SETTINGS_KEYS) {
321
+ if (key in record) {
322
+ out[key] = record[key];
323
+ }
324
+ }
325
+ return out;
326
+ }
327
+ /**
328
+ * Merge a partial input patch onto an existing settings record. Only keys
329
+ * actually supplied in the patch (value !== undefined) overwrite; every other
330
+ * stored value is preserved. Returns a plain JSON-serialisable record.
331
+ */
332
+ function mergeSettings(existing, patch) {
333
+ const merged = { ...projectSettings(existing) };
334
+ for (const key of TRADING_SETTINGS_KEYS) {
335
+ const next = patch[key];
336
+ if (next !== undefined) {
337
+ merged[key] = next;
338
+ }
339
+ }
340
+ return merged;
341
+ }
342
+ /**
343
+ * Custom resolver implementing the org→fund trading-settings policy layer over
344
+ * `Organization.tradingDefaults` and `Fund.tradingOverrides`.
345
+ */
346
+ let TradingSettingsResolver = class TradingSettingsResolver {
347
+ /** Organization-level trading defaults (the stored blob; unset ⇒ null). */
348
+ async organizationTradingDefaults(orgId, ctx) {
349
+ const prisma = (0, helpers_1.getPrismaFromContext)(ctx);
350
+ const org = await prisma.organization.findUnique({
351
+ where: { id: orgId },
352
+ select: { tradingDefaults: true },
353
+ });
354
+ return projectSettings(toSettingsRecord(org === null || org === void 0 ? void 0 : org.tradingDefaults));
355
+ }
356
+ /**
357
+ * Effective settings for an org (and optional fund): `fundOverride ??
358
+ * orgDefault` field-by-field. Unset fields are null — the system-default
359
+ * layer is applied by the runtime/client, not fabricated here.
360
+ */
361
+ async effectiveTradingSettings(orgId, ctx, fundId) {
362
+ const prisma = (0, helpers_1.getPrismaFromContext)(ctx);
363
+ const [org, fund] = await Promise.all([
364
+ prisma.organization.findUnique({
365
+ where: { id: orgId },
366
+ select: { tradingDefaults: true },
367
+ }),
368
+ fundId
369
+ ? prisma.fund.findUnique({
370
+ where: { id: fundId },
371
+ select: { tradingOverrides: true },
372
+ })
373
+ : Promise.resolve(null),
374
+ ]);
375
+ const orgDefaults = projectSettings(toSettingsRecord(org === null || org === void 0 ? void 0 : org.tradingDefaults));
376
+ const fundOverrides = projectSettings(toSettingsRecord(fund === null || fund === void 0 ? void 0 : fund.tradingOverrides));
377
+ const effective = {};
378
+ for (const key of TRADING_SETTINGS_KEYS) {
379
+ const fundVal = fundOverrides[key];
380
+ effective[key] =
381
+ fundVal !== undefined && fundVal !== null ? fundVal : orgDefaults[key];
382
+ }
383
+ return effective;
384
+ }
385
+ /** Merge a partial patch into the org's stored trading defaults. */
386
+ async updateOrgTradingDefaults(orgId, settings, ctx) {
387
+ const prisma = (0, helpers_1.getPrismaFromContext)(ctx);
388
+ const existing = await prisma.organization.findUnique({
389
+ where: { id: orgId },
390
+ select: { tradingDefaults: true },
391
+ });
392
+ if (!existing) {
393
+ throw new Error(`Organization ${orgId} not found`);
394
+ }
395
+ const merged = mergeSettings(toSettingsRecord(existing.tradingDefaults), settings);
396
+ const updated = await prisma.organization.update({
397
+ where: { id: orgId },
398
+ data: { tradingDefaults: merged },
399
+ select: { id: true, name: true, tradingDefaults: true },
400
+ });
401
+ return {
402
+ id: updated.id,
403
+ name: updated.name,
404
+ tradingDefaults: projectSettings(toSettingsRecord(updated.tradingDefaults)),
405
+ };
406
+ }
407
+ /** Merge a partial patch into the fund's stored trading overrides. */
408
+ async updateFundTradingOverrides(fundId, settings, ctx) {
409
+ const prisma = (0, helpers_1.getPrismaFromContext)(ctx);
410
+ const existing = await prisma.fund.findUnique({
411
+ where: { id: fundId },
412
+ select: { tradingOverrides: true },
413
+ });
414
+ if (!existing) {
415
+ throw new Error(`Fund ${fundId} not found`);
416
+ }
417
+ const merged = mergeSettings(toSettingsRecord(existing.tradingOverrides), settings);
418
+ const updated = await prisma.fund.update({
419
+ where: { id: fundId },
420
+ data: { tradingOverrides: merged },
421
+ select: { id: true, name: true, tradingOverrides: true },
422
+ });
423
+ return {
424
+ id: updated.id,
425
+ name: updated.name,
426
+ tradingOverrides: projectSettings(toSettingsRecord(updated.tradingOverrides)),
427
+ };
428
+ }
429
+ };
430
+ exports.TradingSettingsResolver = TradingSettingsResolver;
431
+ __decorate([
432
+ TypeGraphQL.Query((_returns) => TradingSettings, {
433
+ nullable: true,
434
+ description: 'Organization-level trading defaults (unset fields are null).',
435
+ }),
436
+ __param(0, TypeGraphQL.Arg('orgId', (_type) => String)),
437
+ __param(1, TypeGraphQL.Ctx()),
438
+ __metadata("design:type", Function),
439
+ __metadata("design:paramtypes", [String, Object]),
440
+ __metadata("design:returntype", Promise)
441
+ ], TradingSettingsResolver.prototype, "organizationTradingDefaults", null);
442
+ __decorate([
443
+ TypeGraphQL.Query((_returns) => TradingSettings, {
444
+ nullable: true,
445
+ description: 'Effective trading settings: fund override takes precedence over org default, field by field.',
446
+ }),
447
+ __param(0, TypeGraphQL.Arg('orgId', (_type) => String)),
448
+ __param(1, TypeGraphQL.Ctx()),
449
+ __param(2, TypeGraphQL.Arg('fundId', (_type) => String, { nullable: true })),
450
+ __metadata("design:type", Function),
451
+ __metadata("design:paramtypes", [String, Object, String]),
452
+ __metadata("design:returntype", Promise)
453
+ ], TradingSettingsResolver.prototype, "effectiveTradingSettings", null);
454
+ __decorate([
455
+ TypeGraphQL.Mutation((_returns) => OrgTradingDefaultsPayload, {
456
+ nullable: false,
457
+ description: 'Update (partial-merge) the organization-level trading defaults.',
458
+ }),
459
+ __param(0, TypeGraphQL.Arg('orgId', (_type) => String)),
460
+ __param(1, TypeGraphQL.Arg('settings', (_type) => TradingSettingsInput)),
461
+ __param(2, TypeGraphQL.Ctx()),
462
+ __metadata("design:type", Function),
463
+ __metadata("design:paramtypes", [String, TradingSettingsInput, Object]),
464
+ __metadata("design:returntype", Promise)
465
+ ], TradingSettingsResolver.prototype, "updateOrgTradingDefaults", null);
466
+ __decorate([
467
+ TypeGraphQL.Mutation((_returns) => FundTradingOverridesPayload, {
468
+ nullable: false,
469
+ description: 'Update (partial-merge) the fund-level trading overrides.',
470
+ }),
471
+ __param(0, TypeGraphQL.Arg('fundId', (_type) => String)),
472
+ __param(1, TypeGraphQL.Arg('settings', (_type) => TradingSettingsInput)),
473
+ __param(2, TypeGraphQL.Ctx()),
474
+ __metadata("design:type", Function),
475
+ __metadata("design:paramtypes", [String, TradingSettingsInput, Object]),
476
+ __metadata("design:returntype", Promise)
477
+ ], TradingSettingsResolver.prototype, "updateFundTradingOverrides", null);
478
+ exports.TradingSettingsResolver = TradingSettingsResolver = __decorate([
479
+ TypeGraphQL.Resolver()
480
+ ], TradingSettingsResolver);
481
+ //# sourceMappingURL=TradingSettingsResolver.js.map
@@ -0,0 +1,83 @@
1
+ import type { PrismaClient, Prisma } from '@prisma/client';
2
+ /** Institutional trading settings (all fields optional; unset ⇒ null). */
3
+ export declare class TradingSettings {
4
+ realTime?: boolean | null;
5
+ marketOpen?: boolean | null;
6
+ tradeAllocationPct?: number | null;
7
+ minPercentageChange?: number | null;
8
+ volumeThreshold?: number | null;
9
+ autoAllocation?: boolean | null;
10
+ allocation?: Prisma.JsonValue | null;
11
+ cryptoTradingEnabled?: boolean | null;
12
+ cryptoTradingPairs?: string[] | null;
13
+ cryptoTradeAllocationPct?: number | null;
14
+ enablePortfolioTrailingStop?: boolean | null;
15
+ portfolioTrailPercent?: number | null;
16
+ portfolioProfitThresholdPercent?: number | null;
17
+ reducedPortfolioTrailPercent?: number | null;
18
+ defaultTrailingStopPercentage100?: number | null;
19
+ firstTrailReductionThreshold100?: number | null;
20
+ secondTrailReductionThreshold100?: number | null;
21
+ firstReducedTrailPercentage100?: number | null;
22
+ secondReducedTrailPercentage100?: number | null;
23
+ minimumPriceChangePercent100?: number | null;
24
+ }
25
+ /** Partial trading-settings patch for org-default / fund-override updates. */
26
+ export declare class TradingSettingsInput {
27
+ realTime?: boolean;
28
+ marketOpen?: boolean;
29
+ tradeAllocationPct?: number;
30
+ minPercentageChange?: number;
31
+ volumeThreshold?: number;
32
+ autoAllocation?: boolean;
33
+ allocation?: Prisma.InputJsonValue;
34
+ cryptoTradingEnabled?: boolean;
35
+ cryptoTradingPairs?: string[];
36
+ cryptoTradeAllocationPct?: number;
37
+ enablePortfolioTrailingStop?: boolean;
38
+ portfolioTrailPercent?: number;
39
+ portfolioProfitThresholdPercent?: number;
40
+ reducedPortfolioTrailPercent?: number;
41
+ defaultTrailingStopPercentage100?: number;
42
+ firstTrailReductionThreshold100?: number;
43
+ secondTrailReductionThreshold100?: number;
44
+ firstReducedTrailPercentage100?: number;
45
+ secondReducedTrailPercentage100?: number;
46
+ minimumPriceChangePercent100?: number;
47
+ }
48
+ /** Result of an org-defaults update: the org plus its resolved defaults. */
49
+ export declare class OrgTradingDefaultsPayload {
50
+ id: string;
51
+ name: string;
52
+ tradingDefaults?: TradingSettings | null;
53
+ }
54
+ /** Result of a fund-overrides update: the fund plus its resolved overrides. */
55
+ export declare class FundTradingOverridesPayload {
56
+ id: string;
57
+ name: string;
58
+ tradingOverrides?: TradingSettings | null;
59
+ }
60
+ /** GraphQL resolver context carrying the Prisma client. */
61
+ interface GraphQLContext {
62
+ prisma: PrismaClient;
63
+ }
64
+ /**
65
+ * Custom resolver implementing the org→fund trading-settings policy layer over
66
+ * `Organization.tradingDefaults` and `Fund.tradingOverrides`.
67
+ */
68
+ export declare class TradingSettingsResolver {
69
+ /** Organization-level trading defaults (the stored blob; unset ⇒ null). */
70
+ organizationTradingDefaults(orgId: string, ctx: GraphQLContext): Promise<TradingSettings>;
71
+ /**
72
+ * Effective settings for an org (and optional fund): `fundOverride ??
73
+ * orgDefault` field-by-field. Unset fields are null — the system-default
74
+ * layer is applied by the runtime/client, not fabricated here.
75
+ */
76
+ effectiveTradingSettings(orgId: string, ctx: GraphQLContext, fundId?: string): Promise<TradingSettings>;
77
+ /** Merge a partial patch into the org's stored trading defaults. */
78
+ updateOrgTradingDefaults(orgId: string, settings: TradingSettingsInput, ctx: GraphQLContext): Promise<OrgTradingDefaultsPayload>;
79
+ /** Merge a partial patch into the fund's stored trading overrides. */
80
+ updateFundTradingOverrides(fundId: string, settings: TradingSettingsInput, ctx: GraphQLContext): Promise<FundTradingOverridesPayload>;
81
+ }
82
+ export {};
83
+ //# sourceMappingURL=TradingSettingsResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TradingSettingsResolver.d.ts","sourceRoot":"","sources":["../../../src/resolvers/custom/TradingSettingsResolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AA8C3D,0EAA0E;AAC1E,qBACa,eAAe;IAE1B,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAG1B,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAG5B,kBAAkB,CAAC,EAA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AAK,EAAE,MAAM,EAE1D,QAAQ,EAAE,oBAAoB,EACX,GAAG,EAAE,cAAc,GACrC,OAAO,CAAC,yBAAyB,CAAC;IA2BrC,sEAAsE;IAKhE,0BAA0B,CACgB,MAAM,EAAE,MAAM,EAE5D,QAAQ,EAAE,oBAAoB,EACX,GAAG,EAAE,cAAc,GACrC,OAAO,CAAC,2BAA2B,CAAC;CA0BxC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TradingSettingsResolver.js","sourceRoot":"","sources":["../../../src/resolvers/custom/TradingSettingsResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,gEAAkD;AAElD,wEAAkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,4EAA4E;AAC5E,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,sBAAsB;IACtB,oBAAoB;IACpB,0BAA0B;IAC1B,6BAA6B;IAC7B,uBAAuB;IACvB,iCAAiC;IACjC,8BAA8B;IAC9B,kCAAkC;IAClC,iCAAiC;IACjC,kCAAkC;IAClC,gCAAgC;IAChC,iCAAiC;IACjC,8BAA8B;CACtB,CAAC;AAKX,0EAA0E;AAEnE,IAAM,eAAe,GAArB,MAAM,eAAe;CA4D3B,CAAA;AA5DY,0CAAe;AAE1B;IADC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAChC;AAG1B;IADC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC9B;AAG5B;IADC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAA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E,CAAC;IAEC,WAAA,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IAC5C,WAAA,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAA;IAE5D,WAAA,WAAW,CAAC,GAAG,EAAE,CAAA;;6CADR,oBAAoB;;yEA2B/B;kCAvIU,uBAAuB;IADnC,WAAW,CAAC,QAAQ,EAAE;GACV,uBAAuB,CAwInC"}
@@ -5,9 +5,15 @@
5
5
  * with custom aggregation queries and business logic
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.OptionsGreeksHistorySystemSummary = exports.OptionsGreeksHistoryCustomResolver = void 0;
8
+ exports.FundTradingOverridesPayload = exports.OrgTradingDefaultsPayload = exports.TradingSettingsInput = exports.TradingSettings = exports.TradingSettingsResolver = exports.OptionsGreeksHistorySystemSummary = exports.OptionsGreeksHistoryCustomResolver = void 0;
9
9
  var OptionsGreeksHistoryCustomResolver_1 = require("./OptionsGreeksHistoryCustomResolver.cjs");
10
10
  Object.defineProperty(exports, "OptionsGreeksHistoryCustomResolver", { enumerable: true, get: function () { return OptionsGreeksHistoryCustomResolver_1.OptionsGreeksHistoryCustomResolver; } });
11
11
  var OptionsGreeksHistorySystemSummary_1 = require("./OptionsGreeksHistorySystemSummary.cjs");
12
12
  Object.defineProperty(exports, "OptionsGreeksHistorySystemSummary", { enumerable: true, get: function () { return OptionsGreeksHistorySystemSummary_1.OptionsGreeksHistorySystemSummary; } });
13
+ var TradingSettingsResolver_1 = require("./TradingSettingsResolver.cjs");
14
+ Object.defineProperty(exports, "TradingSettingsResolver", { enumerable: true, get: function () { return TradingSettingsResolver_1.TradingSettingsResolver; } });
15
+ Object.defineProperty(exports, "TradingSettings", { enumerable: true, get: function () { return TradingSettingsResolver_1.TradingSettings; } });
16
+ Object.defineProperty(exports, "TradingSettingsInput", { enumerable: true, get: function () { return TradingSettingsResolver_1.TradingSettingsInput; } });
17
+ Object.defineProperty(exports, "OrgTradingDefaultsPayload", { enumerable: true, get: function () { return TradingSettingsResolver_1.OrgTradingDefaultsPayload; } });
18
+ Object.defineProperty(exports, "FundTradingOverridesPayload", { enumerable: true, get: function () { return TradingSettingsResolver_1.FundTradingOverridesPayload; } });
13
19
  //# sourceMappingURL=index.js.map
@@ -5,4 +5,5 @@
5
5
  */
6
6
  export { OptionsGreeksHistoryCustomResolver } from './OptionsGreeksHistoryCustomResolver';
7
7
  export { OptionsGreeksHistorySystemSummary } from './OptionsGreeksHistorySystemSummary';
8
+ export { TradingSettingsResolver, TradingSettings, TradingSettingsInput, OrgTradingDefaultsPayload, FundTradingOverridesPayload, } from './TradingSettingsResolver';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resolvers/custom/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2FAA0F;AAAjF,wJAAA,kCAAkC,OAAA;AAC3C,yFAAwF;AAA/E,sJAAA,iCAAiC,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resolvers/custom/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2FAA0F;AAAjF,wJAAA,kCAAkC,OAAA;AAC3C,yFAAwF;AAA/E,sJAAA,iCAAiC,OAAA;AAC1C,qEAMmC;AALjC,kIAAA,uBAAuB,OAAA;AACvB,0HAAA,eAAe,OAAA;AACf,+HAAA,oBAAoB,OAAA;AACpB,oIAAA,yBAAyB,OAAA;AACzB,sIAAA,2BAA2B,OAAA"}
package/server.cjs CHANGED
@@ -138,7 +138,11 @@ const startServer = async () => {
138
138
  skippedActions: authzSummary.skippedActions.length,
139
139
  });
140
140
  const schema = await (0, type_graphql_1.buildSchema)({
141
- resolvers: [...typegraphql_prisma_1.resolvers, custom_1.OptionsGreeksHistoryCustomResolver],
141
+ resolvers: [
142
+ ...typegraphql_prisma_1.resolvers,
143
+ custom_1.OptionsGreeksHistoryCustomResolver,
144
+ custom_1.TradingSettingsResolver,
145
+ ],
142
146
  validate: false,
143
147
  // Row-level tenancy scoping (SP2-G7 / SOC2). Applies ONLY to user-scoped
144
148
  // principals on the tenancy + notification models; service/admin principals