@dalmore/api-contracts 1.0.0 → 1.0.1
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.
- package/common/helpers/index.ts +88 -0
- package/common/types/account-manager.types.ts +10 -0
- package/common/types/account.types.ts +59 -2
- package/common/types/activity.types.ts +38 -0
- package/common/types/asset.types.ts +3 -0
- package/common/types/auth.types.ts +37 -10
- package/common/types/bonus-tier.types.ts +32 -0
- package/common/types/common.types.ts +19 -0
- package/common/types/contract-helpers.ts +88 -0
- package/common/types/investor-account.types.ts +137 -66
- package/common/types/phone.type.ts +1 -1
- package/common/types/secondary-trade.types.ts +8 -0
- package/common/types/trade.types.ts +81 -1
- package/common/types/user.types.ts +2 -0
- package/contracts/clients/accounts/index.ts +3 -0
- package/contracts/clients/auth/index.ts +18 -1
- package/contracts/clients/index.ts +2 -0
- package/contracts/clients/offerings/index.ts +4 -3
- package/contracts/clients/sites/index.ts +56 -0
- package/contracts/compliance/account-managers/index.ts +2 -0
- package/contracts/compliance/accounts/index.ts +4 -2
- package/contracts/compliance/bonus-tiers/index.ts +55 -0
- package/contracts/compliance/index.ts +2 -0
- package/contracts/compliance/investor-accounts/index.ts +4 -0
- package/contracts/issuers/accounts/index.ts +5 -0
- package/contracts/issuers/bonus-tiers/index.ts +18 -0
- package/contracts/issuers/investor-accounts/index.ts +22 -0
- package/package.json +12 -2
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from './common.types';
|
|
28
28
|
import { accountIdSchema } from './account.types';
|
|
29
29
|
import { SaStatus, tradeIdSchema, TradeZod } from './trade.types';
|
|
30
|
-
import { LegalEntityZod } from './legal-entity.types';
|
|
30
|
+
import { legalEntityIdSchema, LegalEntityZod } from './legal-entity.types';
|
|
31
31
|
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
32
32
|
import { offeringIdSchema } from './offering.types';
|
|
33
33
|
import { userIdSchema, UserZod } from './user.types';
|
|
@@ -97,6 +97,7 @@ export const IInvestorAccountSummary = z.object({
|
|
|
97
97
|
totalPending: z.number(),
|
|
98
98
|
concentrationLiquidNetWorth: z.number(),
|
|
99
99
|
concentrationTotalNetWorth: z.number(),
|
|
100
|
+
postTradeConcentration: z.number().optional(),
|
|
100
101
|
});
|
|
101
102
|
|
|
102
103
|
export type IInvestorAccountSummary = z.infer<typeof IInvestorAccountSummary>;
|
|
@@ -159,24 +160,33 @@ export const InvestorAccountsFiltersZod = z.object({
|
|
|
159
160
|
amlStatus: z.nativeEnum(AMLStatus).optional(),
|
|
160
161
|
aicStatus: z.nativeEnum(AicStatus).optional(),
|
|
161
162
|
offeringId: z.lazy(() => offeringIdSchema).optional(),
|
|
162
|
-
regAQualified: z
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
163
|
+
regAQualified: z.preprocess(
|
|
164
|
+
(val) =>
|
|
165
|
+
val === 'true' || val === '1'
|
|
166
|
+
? true
|
|
167
|
+
: val === 'false' || val === '0'
|
|
168
|
+
? false
|
|
169
|
+
: val,
|
|
170
|
+
z.boolean().optional(),
|
|
171
|
+
),
|
|
172
|
+
regCfQualified: z.preprocess(
|
|
173
|
+
(val) =>
|
|
174
|
+
val === 'true' || val === '1'
|
|
175
|
+
? true
|
|
176
|
+
: val === 'false' || val === '0'
|
|
177
|
+
? false
|
|
178
|
+
: val,
|
|
179
|
+
z.boolean().optional(),
|
|
180
|
+
),
|
|
181
|
+
regDQualified: z.preprocess(
|
|
182
|
+
(val) =>
|
|
183
|
+
val === 'true' || val === '1'
|
|
184
|
+
? true
|
|
185
|
+
: val === 'false' || val === '0'
|
|
186
|
+
? false
|
|
187
|
+
: val,
|
|
188
|
+
z.boolean().optional(),
|
|
189
|
+
),
|
|
180
190
|
email: z.string().optional(),
|
|
181
191
|
accountId: accountIdSchema.optional(),
|
|
182
192
|
userType: z.nativeEnum(UserType).optional(),
|
|
@@ -222,24 +232,33 @@ export const IssuerInvestorAccountsFiltersZod = z.object({
|
|
|
222
232
|
amlStatus: z.nativeEnum(AMLStatus).optional(),
|
|
223
233
|
aicStatus: z.nativeEnum(AicStatus).optional(),
|
|
224
234
|
offeringId: z.lazy(() => offeringIdSchema).optional(),
|
|
225
|
-
regAQualified: z
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
regAQualified: z.preprocess(
|
|
236
|
+
(val) =>
|
|
237
|
+
val === 'true' || val === '1'
|
|
238
|
+
? true
|
|
239
|
+
: val === 'false' || val === '0'
|
|
240
|
+
? false
|
|
241
|
+
: val,
|
|
242
|
+
z.boolean().optional(),
|
|
243
|
+
),
|
|
244
|
+
regCfQualified: z.preprocess(
|
|
245
|
+
(val) =>
|
|
246
|
+
val === 'true' || val === '1'
|
|
247
|
+
? true
|
|
248
|
+
: val === 'false' || val === '0'
|
|
249
|
+
? false
|
|
250
|
+
: val,
|
|
251
|
+
z.boolean().optional(),
|
|
252
|
+
),
|
|
253
|
+
regDQualified: z.preprocess(
|
|
254
|
+
(val) =>
|
|
255
|
+
val === 'true' || val === '1'
|
|
256
|
+
? true
|
|
257
|
+
: val === 'false' || val === '0'
|
|
258
|
+
? false
|
|
259
|
+
: val,
|
|
260
|
+
z.boolean().optional(),
|
|
261
|
+
),
|
|
243
262
|
email: z.string().optional(),
|
|
244
263
|
startDate: dateSchema.optional(),
|
|
245
264
|
endDate: dateSchema.optional(),
|
|
@@ -248,37 +267,42 @@ export const IssuerInvestorAccountsFiltersZod = z.object({
|
|
|
248
267
|
|
|
249
268
|
export const InvestorAccountsFilters = z.object({
|
|
250
269
|
investorAccountType: z.nativeEnum(InvestorAccountType).optional(),
|
|
251
|
-
regAQualified: z
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
255
|
-
message: 'regAQualified must be a boolean string',
|
|
256
|
-
}),
|
|
257
|
-
regCfQualified: z
|
|
258
|
-
.string()
|
|
259
|
-
.optional()
|
|
260
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
261
|
-
message: 'regCfQualified must be a boolean string',
|
|
262
|
-
}),
|
|
263
|
-
regDQualified: z
|
|
264
|
-
.string()
|
|
265
|
-
.optional()
|
|
266
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
267
|
-
message: 'regDQualified must be a boolean string',
|
|
268
|
-
}),
|
|
269
|
-
withPortfolio: z
|
|
270
|
-
.string()
|
|
271
|
-
.optional()
|
|
272
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
273
|
-
message: 'withPortfolio should be boolean',
|
|
274
|
-
})
|
|
275
|
-
.transform((withPortfolio) =>
|
|
276
|
-
withPortfolio === 'true'
|
|
270
|
+
regAQualified: z.preprocess(
|
|
271
|
+
(val) =>
|
|
272
|
+
val === 'true' || val === '1'
|
|
277
273
|
? true
|
|
278
|
-
:
|
|
274
|
+
: val === 'false' || val === '0'
|
|
279
275
|
? false
|
|
280
|
-
:
|
|
281
|
-
),
|
|
276
|
+
: val,
|
|
277
|
+
z.boolean().optional(),
|
|
278
|
+
),
|
|
279
|
+
regCfQualified: z.preprocess(
|
|
280
|
+
(val) =>
|
|
281
|
+
val === 'true' || val === '1'
|
|
282
|
+
? true
|
|
283
|
+
: val === 'false' || val === '0'
|
|
284
|
+
? false
|
|
285
|
+
: val,
|
|
286
|
+
z.boolean().optional(),
|
|
287
|
+
),
|
|
288
|
+
regDQualified: z.preprocess(
|
|
289
|
+
(val) =>
|
|
290
|
+
val === 'true' || val === '1'
|
|
291
|
+
? true
|
|
292
|
+
: val === 'false' || val === '0'
|
|
293
|
+
? false
|
|
294
|
+
: val,
|
|
295
|
+
z.boolean().optional(),
|
|
296
|
+
),
|
|
297
|
+
withPortfolio: z.preprocess(
|
|
298
|
+
(val) =>
|
|
299
|
+
val === 'true' || val === '1'
|
|
300
|
+
? true
|
|
301
|
+
: val === 'false' || val === '0'
|
|
302
|
+
? false
|
|
303
|
+
: val,
|
|
304
|
+
z.boolean().optional(),
|
|
305
|
+
),
|
|
282
306
|
});
|
|
283
307
|
|
|
284
308
|
export const InvestorAccountExportFilters =
|
|
@@ -373,6 +397,42 @@ export type IPaginatedRegisteredInvestorUserZod = z.infer<
|
|
|
373
397
|
typeof IPaginatedRegisteredInvestorUserZod
|
|
374
398
|
>;
|
|
375
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Schema for raw query result from queryRegisteredInvestorUsers
|
|
402
|
+
* Matches the structure returned by getRawMany() with JSON aggregations.
|
|
403
|
+
* PostgreSQL/TypeORM automatically parses JSON fields, so they come as arrays.
|
|
404
|
+
*/
|
|
405
|
+
const IndividualAggregationZod = z.object({
|
|
406
|
+
id: z.lazy(() => individualIdSchema),
|
|
407
|
+
phone: z.lazy(() => PhoneZodSchema),
|
|
408
|
+
firstName: z.string().nullable(),
|
|
409
|
+
lastName: z.string().nullable(),
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
const LegalEntityAggregationZod = z.object({
|
|
413
|
+
id: z.lazy(() => legalEntityIdSchema),
|
|
414
|
+
phone: z.lazy(() => PhoneZodSchema),
|
|
415
|
+
name: z.string().nullable(),
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
export const RegisteredInvestorUserRawZod = z.object({
|
|
419
|
+
id: z.lazy(() => userIdSchema),
|
|
420
|
+
name: z.string(),
|
|
421
|
+
email: z.string().email(),
|
|
422
|
+
investorAccountType: z.nativeEnum(InvestorAccountType).nullable(),
|
|
423
|
+
numberOfTrades: z.coerce.number().default(0),
|
|
424
|
+
invested: z.coerce.number().default(0),
|
|
425
|
+
createdAt: z.coerce.date(),
|
|
426
|
+
type: z.nativeEnum(UserType).nullable(),
|
|
427
|
+
investorAccountId: z.string().nullable(),
|
|
428
|
+
individuals: z.array(IndividualAggregationZod),
|
|
429
|
+
legalEntities: z.array(LegalEntityAggregationZod),
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
export type RegisteredInvestorUserRawZod = z.infer<
|
|
433
|
+
typeof RegisteredInvestorUserRawZod
|
|
434
|
+
>;
|
|
435
|
+
|
|
376
436
|
export const RegisteredInvestorUserFiltersZod = z.object({
|
|
377
437
|
search: z.string().optional().openapi({ example: 'John Doe' }),
|
|
378
438
|
startDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
@@ -1166,3 +1226,14 @@ export const INVESTOR_ACCOUNT_FIELDS_MAP = {
|
|
|
1166
1226
|
],
|
|
1167
1227
|
},
|
|
1168
1228
|
};
|
|
1229
|
+
|
|
1230
|
+
export const ExportRegisteredInvestorUsersFiltersZod = z.object({
|
|
1231
|
+
search: z.string().optional(),
|
|
1232
|
+
startDate: dateSchema.optional(),
|
|
1233
|
+
endDate: dateSchema.optional(),
|
|
1234
|
+
userType: z.nativeEnum(UserType).optional(),
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
export type ExportRegisteredInvestorUsersFiltersZod = z.infer<
|
|
1238
|
+
typeof ExportRegisteredInvestorUsersFiltersZod
|
|
1239
|
+
>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { normalizePhoneNumber } from '
|
|
2
|
+
import { normalizePhoneNumber } from './contract-helpers';
|
|
3
3
|
import { CountryCodes } from './countries.types';
|
|
4
4
|
import { CountryCode } from 'libphonenumber-js';
|
|
5
5
|
import { ok } from 'neverthrow';
|
|
@@ -56,6 +56,7 @@ export const SecondaryTradeFiltersZod = z.object({
|
|
|
56
56
|
complianceReview: z.nativeEnum(ComplianceReview).optional(),
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
export type SecondaryTradeFiltersZod = z.infer<typeof SecondaryTradeFiltersZod>;
|
|
59
60
|
export const ExportSecondaryTradesResponse = z.object({
|
|
60
61
|
message: z.string(),
|
|
61
62
|
});
|
|
@@ -85,3 +86,10 @@ export const IPaginatedSecondaryTradeSummaryResponse = z.object({
|
|
|
85
86
|
export type IPaginatedSecondaryTradeSummaryResponse = z.infer<
|
|
86
87
|
typeof IPaginatedSecondaryTradeSummaryResponse
|
|
87
88
|
>;
|
|
89
|
+
|
|
90
|
+
export const CountResultZod = z.array(
|
|
91
|
+
z.object({
|
|
92
|
+
count: z.string(),
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
export type CountResultZod = z.infer<typeof CountResultZod>;
|
|
@@ -30,7 +30,12 @@ import {
|
|
|
30
30
|
paymentMethodIdSchema,
|
|
31
31
|
PaymentMethodType,
|
|
32
32
|
} from './payment-methods.types';
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
investorAccountIdSchema,
|
|
35
|
+
InvestorAccountExportFilters,
|
|
36
|
+
ComplianceInvestorAccountExportFilters,
|
|
37
|
+
RegisteredInvestorUserRawZod,
|
|
38
|
+
} from './investor-account.types';
|
|
34
39
|
import {
|
|
35
40
|
tradeLineItemIdSchema,
|
|
36
41
|
TradeLineItemZod,
|
|
@@ -40,6 +45,16 @@ import { TransactionZod } from './transaction.types';
|
|
|
40
45
|
import { accountIdSchema } from './account.types';
|
|
41
46
|
import { userIdSchema } from './user.types';
|
|
42
47
|
import { issuerIdSchema } from './issuer.types';
|
|
48
|
+
import {
|
|
49
|
+
GetSecondaryCustomerFiltersZod,
|
|
50
|
+
SecondaryCustomer,
|
|
51
|
+
} from './secondary-customer.types';
|
|
52
|
+
import {
|
|
53
|
+
SecondaryTrade,
|
|
54
|
+
SecondaryTradeFiltersZod,
|
|
55
|
+
} from './secondary-trade.types';
|
|
56
|
+
import { InvestorAccount } from '../../investor-accounts/entities/investor-account.entity';
|
|
57
|
+
import { Trade } from '../../trades/entities/trade.entity';
|
|
43
58
|
|
|
44
59
|
extendZodWithOpenApi(z);
|
|
45
60
|
export const CheckResultsSchema = z.object({
|
|
@@ -107,6 +122,12 @@ export enum TradeSystemLogType {
|
|
|
107
122
|
KYC_CHECK = 'KYC Check',
|
|
108
123
|
AML_CHECK = 'AML Check',
|
|
109
124
|
AIC_CHECK = 'AIC Check',
|
|
125
|
+
USER_AGE_CHECK = 'User Age Check',
|
|
126
|
+
KYC_NAME_CHECK = 'KYC Name Check',
|
|
127
|
+
AML_NAME_CHECK = 'AML Name Check',
|
|
128
|
+
AIC_NAME_CHECK = 'AIC Name Check',
|
|
129
|
+
KYC_DOB_CHECK = 'KYC DOB Check',
|
|
130
|
+
AIC_SSN_CHECK = 'AIC SSN Check',
|
|
110
131
|
// Data Integrity Checks For Imported Trades
|
|
111
132
|
SHARES_CHECK = 'Shares Check',
|
|
112
133
|
PRICE_PER_UNIT_CHECK = 'Price Per Unit Check',
|
|
@@ -447,6 +468,7 @@ export const ExportTradesQuery = PaginationOptionsZod.merge(TradeFiltersZod)
|
|
|
447
468
|
.optional()
|
|
448
469
|
.default(TradeExportType.PAGE),
|
|
449
470
|
});
|
|
471
|
+
export type ExportTradesQuery = z.infer<typeof ExportTradesQuery>;
|
|
450
472
|
|
|
451
473
|
const tradesColumn = z.enum([
|
|
452
474
|
'id',
|
|
@@ -847,3 +869,61 @@ export const NON_CANCELABLE_COMPLIANCE_REVIEW_STATUSES = [
|
|
|
847
869
|
ComplianceReview.REJECTED,
|
|
848
870
|
ComplianceReview.CANCELLED,
|
|
849
871
|
];
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Filter type for Investor Account exports in workers
|
|
875
|
+
* Extends the base InvestorAccountExportFilters with additional optional fields needed for bulk exports
|
|
876
|
+
*/
|
|
877
|
+
export type WorkerInvestorAccountExportFilters = Partial<
|
|
878
|
+
(InvestorAccountExportFilters | ComplianceInvestorAccountExportFilters) & {
|
|
879
|
+
isRegisteredUsersExport: boolean | null;
|
|
880
|
+
search: string | null;
|
|
881
|
+
startDate: Date | null;
|
|
882
|
+
endDate: Date | null;
|
|
883
|
+
userType: string | null;
|
|
884
|
+
accountId: string | null;
|
|
885
|
+
}
|
|
886
|
+
>;
|
|
887
|
+
/**
|
|
888
|
+
* Filter type for Trade exports
|
|
889
|
+
* Extends IssuersTradeFiltersZod with accountId
|
|
890
|
+
*/
|
|
891
|
+
export type TradeExportFilters = Partial<
|
|
892
|
+
IssuersTradeFiltersZod & {
|
|
893
|
+
accountId: string | null;
|
|
894
|
+
}
|
|
895
|
+
>;
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Filter type for Compliance Trade exports
|
|
899
|
+
*/
|
|
900
|
+
export type ComplianceTradeExportFilters = Partial<ExportTradesQuery>;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Filter type for Secondary Customer exports
|
|
904
|
+
*/
|
|
905
|
+
export type SecondaryCustomerExportFilters =
|
|
906
|
+
Partial<GetSecondaryCustomerFiltersZod>;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Filter type for Secondary Trade exports
|
|
910
|
+
*/
|
|
911
|
+
export type SecondaryTradeExportFilters = Partial<SecondaryTradeFiltersZod>;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Combined filter type for all bulk export types
|
|
915
|
+
* Used in the ExportBulkDataDto
|
|
916
|
+
*/
|
|
917
|
+
export type BulkExportFilters =
|
|
918
|
+
| WorkerInvestorAccountExportFilters
|
|
919
|
+
| TradeExportFilters
|
|
920
|
+
| ComplianceTradeExportFilters
|
|
921
|
+
| SecondaryCustomerExportFilters
|
|
922
|
+
| SecondaryTradeExportFilters;
|
|
923
|
+
|
|
924
|
+
export type BulkExportResponse =
|
|
925
|
+
| InvestorAccount[]
|
|
926
|
+
| RegisteredInvestorUserRawZod[]
|
|
927
|
+
| Trade[]
|
|
928
|
+
| SecondaryCustomer[]
|
|
929
|
+
| SecondaryTrade[];
|
|
@@ -157,6 +157,7 @@ export const UserZod = IBaseEntity.extend({
|
|
|
157
157
|
onboarding: z.string().nullable(),
|
|
158
158
|
account: AccountWithoutUsersZod.optional(),
|
|
159
159
|
active: z.boolean(),
|
|
160
|
+
status: z.nativeEnum(UserStatus),
|
|
160
161
|
userLogin: IBaseEntity.extend({
|
|
161
162
|
firstName: z.string(),
|
|
162
163
|
lastName: z.string(),
|
|
@@ -284,6 +285,7 @@ export const UsersSummaryFilterZod = z.object({
|
|
|
284
285
|
portalType: z.nativeEnum(PortalType).optional(),
|
|
285
286
|
search: z.string().trim().max(50).optional(),
|
|
286
287
|
selectRole: z.nativeEnum(UserRole).optional(),
|
|
288
|
+
status: z.nativeEnum(UserStatus).optional(),
|
|
287
289
|
});
|
|
288
290
|
export type UsersSummaryFilterZod = z.infer<typeof UsersSummaryFilterZod>;
|
|
289
291
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
AccountsIncludeQuery,
|
|
10
10
|
AccountZod,
|
|
11
11
|
accountIdSchema,
|
|
12
|
+
InternalError,
|
|
12
13
|
} from '../../../common/types';
|
|
13
14
|
import { z } from 'zod';
|
|
14
15
|
|
|
@@ -32,6 +33,7 @@ export const accountsContract = c.router(
|
|
|
32
33
|
401: UnauthorizedError,
|
|
33
34
|
403: ForbiddenError,
|
|
34
35
|
404: NotFoundError,
|
|
36
|
+
500: InternalError,
|
|
35
37
|
},
|
|
36
38
|
},
|
|
37
39
|
getAccounts: {
|
|
@@ -49,6 +51,7 @@ export const accountsContract = c.router(
|
|
|
49
51
|
200: IPaginatedAccount,
|
|
50
52
|
401: UnauthorizedError,
|
|
51
53
|
403: ForbiddenError,
|
|
54
|
+
500: InternalError,
|
|
52
55
|
},
|
|
53
56
|
},
|
|
54
57
|
},
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { initContract } from '@ts-rest/core';
|
|
2
2
|
import {
|
|
3
|
+
AccessTokenResponse,
|
|
3
4
|
BadRequestError,
|
|
4
5
|
ClientAuthSuccessResponse,
|
|
5
6
|
InternalError,
|
|
7
|
+
IRegisterClientIssuerBodyZod,
|
|
6
8
|
RegisterBodyInvestors,
|
|
7
9
|
UnauthorizedError,
|
|
8
10
|
} from '../../../common/types';
|
|
@@ -12,7 +14,7 @@ const c = initContract();
|
|
|
12
14
|
export const authContract = c.router(
|
|
13
15
|
{
|
|
14
16
|
registerInvestor: {
|
|
15
|
-
summary: 'Register investor with email',
|
|
17
|
+
summary: 'Register investor with email (API Key Auth)',
|
|
16
18
|
method: 'POST',
|
|
17
19
|
path: 'register/investor',
|
|
18
20
|
metadata: {
|
|
@@ -26,6 +28,21 @@ export const authContract = c.router(
|
|
|
26
28
|
500: InternalError,
|
|
27
29
|
},
|
|
28
30
|
},
|
|
31
|
+
registerIssuer: {
|
|
32
|
+
summary: 'Register issuer with email (API Key Auth)',
|
|
33
|
+
method: 'POST',
|
|
34
|
+
path: 'register/issuer',
|
|
35
|
+
metadata: {
|
|
36
|
+
auth: true,
|
|
37
|
+
},
|
|
38
|
+
body: IRegisterClientIssuerBodyZod,
|
|
39
|
+
responses: {
|
|
40
|
+
201: AccessTokenResponse,
|
|
41
|
+
400: BadRequestError,
|
|
42
|
+
401: UnauthorizedError,
|
|
43
|
+
500: InternalError,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
29
46
|
},
|
|
30
47
|
{
|
|
31
48
|
pathPrefix: 'auth/',
|
|
@@ -14,6 +14,7 @@ import { filesPublicContract } from './files-public';
|
|
|
14
14
|
import { secureRequestContract } from './secure-requests';
|
|
15
15
|
import { aicContract } from './aic';
|
|
16
16
|
import { authContract } from './auth';
|
|
17
|
+
import { sitesContract } from './sites';
|
|
17
18
|
|
|
18
19
|
const c = initContract();
|
|
19
20
|
|
|
@@ -34,6 +35,7 @@ export const clientsContract = c.router(
|
|
|
34
35
|
legalEntities: legalEntityContract,
|
|
35
36
|
offerings: offeringsContract,
|
|
36
37
|
secureRequests: secureRequestContract,
|
|
38
|
+
sites: sitesContract,
|
|
37
39
|
trades: tradesContract,
|
|
38
40
|
},
|
|
39
41
|
{
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
OfferingSummaryFiltersZod,
|
|
14
14
|
PaginatedOfferingSummaryResponseZod,
|
|
15
15
|
PaginationOptionsZod,
|
|
16
|
-
|
|
16
|
+
PatchIssuerOffering,
|
|
17
|
+
PostIssuerOffering,
|
|
17
18
|
UnauthorizedError,
|
|
18
19
|
} from '../../../common/types';
|
|
19
20
|
|
|
@@ -83,7 +84,7 @@ export const offeringsContract = c.router(
|
|
|
83
84
|
pathParams: z.object({
|
|
84
85
|
id: offeringIdSchema,
|
|
85
86
|
}),
|
|
86
|
-
body:
|
|
87
|
+
body: PatchIssuerOffering,
|
|
87
88
|
responses: {
|
|
88
89
|
201: IOffering,
|
|
89
90
|
400: BadRequestError,
|
|
@@ -100,7 +101,7 @@ export const offeringsContract = c.router(
|
|
|
100
101
|
metadata: {
|
|
101
102
|
auth: true,
|
|
102
103
|
},
|
|
103
|
-
body:
|
|
104
|
+
body: PostIssuerOffering,
|
|
104
105
|
responses: {
|
|
105
106
|
201: IOffering,
|
|
106
107
|
400: BadRequestError,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import {
|
|
3
|
+
ForbiddenError,
|
|
4
|
+
NotFoundError,
|
|
5
|
+
PaginationOptionsZod,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
} from '../../../common/types';
|
|
8
|
+
import {
|
|
9
|
+
SitesFiltersZod,
|
|
10
|
+
SitesIncludeQuery,
|
|
11
|
+
SitesPaginated,
|
|
12
|
+
SitesParamSchema,
|
|
13
|
+
SiteZod,
|
|
14
|
+
} from '../../../common/types/site.types';
|
|
15
|
+
|
|
16
|
+
const c = initContract();
|
|
17
|
+
|
|
18
|
+
export const sitesContract = c.router(
|
|
19
|
+
{
|
|
20
|
+
getSite: {
|
|
21
|
+
summary: 'get site by id',
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: '/:id',
|
|
24
|
+
pathParams: SitesParamSchema,
|
|
25
|
+
metadata: {
|
|
26
|
+
auth: true,
|
|
27
|
+
},
|
|
28
|
+
query: SitesIncludeQuery.merge(SitesFiltersZod),
|
|
29
|
+
responses: {
|
|
30
|
+
200: SiteZod,
|
|
31
|
+
401: UnauthorizedError,
|
|
32
|
+
403: ForbiddenError,
|
|
33
|
+
404: NotFoundError,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
getSites: {
|
|
37
|
+
summary: 'query sites by url',
|
|
38
|
+
method: 'GET',
|
|
39
|
+
path: '/',
|
|
40
|
+
metadata: {
|
|
41
|
+
auth: true,
|
|
42
|
+
},
|
|
43
|
+
query:
|
|
44
|
+
PaginationOptionsZod.merge(SitesFiltersZod).merge(SitesIncludeQuery),
|
|
45
|
+
responses: {
|
|
46
|
+
200: SitesPaginated,
|
|
47
|
+
401: UnauthorizedError,
|
|
48
|
+
403: ForbiddenError,
|
|
49
|
+
404: NotFoundError,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pathPrefix: 'sites',
|
|
55
|
+
},
|
|
56
|
+
);
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
UnauthorizedError,
|
|
11
11
|
} from '../../../common/types';
|
|
12
12
|
import {
|
|
13
|
+
AccountManagerDeleteQuery,
|
|
13
14
|
AccountManagerDeleteResponse,
|
|
14
15
|
accountManagerIdSchema,
|
|
15
16
|
AccountManagersIncludeQuery,
|
|
@@ -122,6 +123,7 @@ export const accountManagersContract = c.router(
|
|
|
122
123
|
pathParams: z.object({
|
|
123
124
|
id: accountManagerIdSchema,
|
|
124
125
|
}),
|
|
126
|
+
query: AccountManagerDeleteQuery,
|
|
125
127
|
responses: {
|
|
126
128
|
201: AccountManagerDeleteResponse,
|
|
127
129
|
400: BadRequestError,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
IPaginatedAccountsSummaryResponse,
|
|
16
16
|
UpdateAccountIssuersStatusZod,
|
|
17
17
|
UpdateAccountStatusReponse,
|
|
18
|
-
|
|
18
|
+
CompliancePatchAccountZod,
|
|
19
19
|
AccountSortZod,
|
|
20
20
|
BadRequestError,
|
|
21
21
|
} from '../../../common/types';
|
|
@@ -63,6 +63,7 @@ export const accountsContract = c.router(
|
|
|
63
63
|
401: UnauthorizedError,
|
|
64
64
|
403: ForbiddenError,
|
|
65
65
|
404: NotFoundError,
|
|
66
|
+
500: InternalError,
|
|
66
67
|
},
|
|
67
68
|
},
|
|
68
69
|
// Admin
|
|
@@ -81,6 +82,7 @@ export const accountsContract = c.router(
|
|
|
81
82
|
200: IPaginatedAccount,
|
|
82
83
|
401: UnauthorizedError,
|
|
83
84
|
403: ForbiddenError,
|
|
85
|
+
500: InternalError,
|
|
84
86
|
},
|
|
85
87
|
},
|
|
86
88
|
updateAccountAdmin: {
|
|
@@ -93,7 +95,7 @@ export const accountsContract = c.router(
|
|
|
93
95
|
pathParams: z.object({
|
|
94
96
|
id: accountIdSchema,
|
|
95
97
|
}),
|
|
96
|
-
body:
|
|
98
|
+
body: CompliancePatchAccountZod,
|
|
97
99
|
responses: {
|
|
98
100
|
200: AccountZod,
|
|
99
101
|
404: NotFoundError,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import {
|
|
3
|
+
BadRequestError,
|
|
4
|
+
ForbiddenError,
|
|
5
|
+
InternalError,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
} from '../../../common/types';
|
|
8
|
+
import {
|
|
9
|
+
CompliancePostBonusTierZod,
|
|
10
|
+
EstimateBonusTierCalculationResponseZod,
|
|
11
|
+
EstimateBonusTierCalculationZod,
|
|
12
|
+
IBonusTierList,
|
|
13
|
+
} from '../../../common/types/bonus-tier.types';
|
|
14
|
+
|
|
15
|
+
const c = initContract();
|
|
16
|
+
|
|
17
|
+
export const bonusTiersContract = c.router(
|
|
18
|
+
{
|
|
19
|
+
estimateCalculation: {
|
|
20
|
+
summary: 'Estimate bonus tier calculation',
|
|
21
|
+
method: 'POST',
|
|
22
|
+
path: '/estimate-calculation',
|
|
23
|
+
metadata: {
|
|
24
|
+
auth: true,
|
|
25
|
+
},
|
|
26
|
+
body: EstimateBonusTierCalculationZod,
|
|
27
|
+
responses: {
|
|
28
|
+
200: EstimateBonusTierCalculationResponseZod,
|
|
29
|
+
400: BadRequestError,
|
|
30
|
+
401: UnauthorizedError,
|
|
31
|
+
403: ForbiddenError,
|
|
32
|
+
500: InternalError,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
postBonusTier: {
|
|
36
|
+
summary: 'Create a new bonus tier',
|
|
37
|
+
method: 'POST',
|
|
38
|
+
path: '/',
|
|
39
|
+
metadata: {
|
|
40
|
+
auth: true,
|
|
41
|
+
},
|
|
42
|
+
body: CompliancePostBonusTierZod,
|
|
43
|
+
responses: {
|
|
44
|
+
201: IBonusTierList,
|
|
45
|
+
400: BadRequestError,
|
|
46
|
+
401: UnauthorizedError,
|
|
47
|
+
403: ForbiddenError,
|
|
48
|
+
500: InternalError,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
pathPrefix: 'bonus-tiers',
|
|
54
|
+
},
|
|
55
|
+
);
|