@dalmore/api-contracts 0.0.0-dev.2dc8e92 → 0.0.0-dev.3af7603
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/types/account-setting.types.ts +31 -0
- package/common/types/activity.types.ts +1 -1
- package/common/types/api-key-logs.types.ts +1 -1
- package/common/types/asset.types.ts +14 -14
- package/common/types/bonus-tier.types.ts +33 -0
- package/common/types/cart.types.ts +4 -1
- package/common/types/common.types.ts +16 -6
- package/common/types/dashboard.types.ts +2 -9
- package/common/types/disbursements.types.ts +119 -3
- package/common/types/file.types.ts +20 -4
- package/common/types/i-will-do-it-later.types.ts +68 -0
- package/common/types/index.ts +2 -0
- package/common/types/individuals.types.ts +2 -15
- package/common/types/issuer-offering.types.ts +113 -30
- package/common/types/issuer-payment-method.types.ts +41 -0
- package/common/types/issuer.types.ts +9 -0
- package/common/types/notification.types.ts +239 -29
- package/common/types/offering.types.ts +106 -20
- package/common/types/site.types.ts +2 -9
- package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
- package/common/types/trade.types.ts +71 -1
- package/common/types/transaction.types.ts +12 -1
- package/common/types/user.types.ts +15 -28
- package/contracts/clients/cart/index.ts +80 -0
- package/contracts/clients/index.ts +10 -0
- package/contracts/clients/issuer-payment-methods/index.ts +39 -0
- package/contracts/clients/payment-methods/index.ts +85 -0
- package/contracts/clients/trade-line-items/index.ts +66 -0
- package/contracts/clients/trades/index.ts +65 -1
- package/contracts/clients/transactions/index.ts +37 -0
- package/contracts/compliance/bonus-tiers/index.ts +21 -2
- package/contracts/compliance/trade-line-items/index.ts +1 -1
- package/contracts/compliance/users/index.ts +21 -0
- package/contracts/investors/bonus-tiers/index.ts +18 -0
- package/contracts/investors/individuals/index.ts +22 -0
- package/contracts/investors/trade-line-items/index.ts +1 -1
- package/contracts/issuers/bonus-tiers/index.ts +18 -0
- package/contracts/issuers/disbursements/index.ts +36 -0
- package/package.json +1 -1
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
SortBy,
|
|
16
16
|
OfferingVersioningType,
|
|
17
17
|
OfferingOnboardingStatus,
|
|
18
|
+
AssetType,
|
|
19
|
+
DurationType,
|
|
20
|
+
StringToBooleanSchema,
|
|
18
21
|
} from './common.types';
|
|
19
22
|
import { IBaseEntity } from './entity.types';
|
|
20
23
|
import { fileIdSchema, FileZod } from './file.types';
|
|
@@ -24,6 +27,7 @@ import {
|
|
|
24
27
|
InvestorsOfferingsIncludeQuery,
|
|
25
28
|
} from './investors-offering.types';
|
|
26
29
|
import { OfferingStatus } from './issuer-offering.types';
|
|
30
|
+
import { postAssetRefinement, AssetTemplateType } from './asset.types';
|
|
27
31
|
|
|
28
32
|
export enum OfferingFeeType {
|
|
29
33
|
FIXED = 'FIXED',
|
|
@@ -115,7 +119,7 @@ export const IPaginatedOffering = z.object({
|
|
|
115
119
|
});
|
|
116
120
|
export type IPaginatedOffering = z.infer<typeof IPaginatedOffering>;
|
|
117
121
|
|
|
118
|
-
export const
|
|
122
|
+
export const PatchOfferingBase = z.object({
|
|
119
123
|
name: z.string().optional(),
|
|
120
124
|
description: z.string().nullable().optional(),
|
|
121
125
|
tid: z.string().optional(),
|
|
@@ -148,8 +152,8 @@ export const PatchOffering = z.object({
|
|
|
148
152
|
.openapi({ example: 5000 })
|
|
149
153
|
.optional()
|
|
150
154
|
.nullable(),
|
|
151
|
-
startAt: dateSchema.optional(),
|
|
152
|
-
endAt: dateSchema.optional(),
|
|
155
|
+
startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
|
|
156
|
+
endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
|
|
153
157
|
platform: z.string().optional(),
|
|
154
158
|
coverArtId: z
|
|
155
159
|
.lazy(() => fileIdSchema)
|
|
@@ -175,16 +179,108 @@ export const PatchOffering = z.object({
|
|
|
175
179
|
showTotalRaised: z.boolean().optional(),
|
|
176
180
|
issuerId: issuerIdSchema.optional(),
|
|
177
181
|
});
|
|
178
|
-
|
|
182
|
+
export const PatchOffering = PatchOfferingBase.merge(
|
|
183
|
+
z.object({
|
|
184
|
+
assetName: z
|
|
185
|
+
.string()
|
|
186
|
+
.min(2)
|
|
187
|
+
.max(50)
|
|
188
|
+
.optional()
|
|
189
|
+
.openapi({ example: 'Asset name' }),
|
|
190
|
+
assetType: z
|
|
191
|
+
.nativeEnum(AssetType)
|
|
192
|
+
.optional()
|
|
193
|
+
.openapi({ example: AssetType.STOCK }),
|
|
194
|
+
pricePerUnit: z
|
|
195
|
+
.number()
|
|
196
|
+
.min(0.01)
|
|
197
|
+
.max(10000000000)
|
|
198
|
+
.nullable()
|
|
199
|
+
.optional()
|
|
200
|
+
.openapi({ example: 2000 }),
|
|
201
|
+
totalUnits: z
|
|
202
|
+
.number()
|
|
203
|
+
.min(1)
|
|
204
|
+
.max(10000000000)
|
|
205
|
+
.nullable()
|
|
206
|
+
.optional()
|
|
207
|
+
.openapi({ example: 5200 }),
|
|
208
|
+
yield: z
|
|
209
|
+
.number()
|
|
210
|
+
.min(0.01)
|
|
211
|
+
.max(10000000000)
|
|
212
|
+
.nullable()
|
|
213
|
+
.optional()
|
|
214
|
+
.openapi({ example: 1200 }),
|
|
215
|
+
duration: z
|
|
216
|
+
.number()
|
|
217
|
+
.min(1)
|
|
218
|
+
.max(1000)
|
|
219
|
+
.nullable()
|
|
220
|
+
.optional()
|
|
221
|
+
.openapi({ example: 1 }),
|
|
222
|
+
durationType: z
|
|
223
|
+
.nativeEnum(DurationType)
|
|
224
|
+
.nullable()
|
|
225
|
+
.optional()
|
|
226
|
+
.openapi({ example: DurationType.DAY }),
|
|
227
|
+
template: z
|
|
228
|
+
.nativeEnum(AssetTemplateType)
|
|
229
|
+
.default(AssetTemplateType.STANDARD)
|
|
230
|
+
.openapi({ example: AssetTemplateType.STANDARD })
|
|
231
|
+
.nullable()
|
|
232
|
+
.optional(),
|
|
233
|
+
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
234
|
+
enableBonus: z.boolean().optional(),
|
|
235
|
+
}),
|
|
236
|
+
);
|
|
179
237
|
export type PatchOffering = z.infer<typeof PatchOffering>;
|
|
180
238
|
|
|
181
|
-
export const PostComplianceOffering =
|
|
239
|
+
export const PostComplianceOffering = PatchOfferingBase.merge(
|
|
182
240
|
z.object({
|
|
183
241
|
accountId: accountIdSchema,
|
|
242
|
+
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
243
|
+
assetName: z.string().min(2).max(50).openapi({ example: 'Asset name' }),
|
|
244
|
+
assetType: z.nativeEnum(AssetType).openapi({ example: AssetType.STOCK }),
|
|
245
|
+
pricePerUnit: z
|
|
246
|
+
.number()
|
|
247
|
+
.min(0.01)
|
|
248
|
+
.max(10000000000)
|
|
249
|
+
.nullable()
|
|
250
|
+
.openapi({ example: 2000 }),
|
|
251
|
+
totalUnits: z
|
|
252
|
+
.number()
|
|
253
|
+
.min(1)
|
|
254
|
+
.max(10000000000)
|
|
255
|
+
.nullable()
|
|
256
|
+
.openapi({ example: 5200 }),
|
|
257
|
+
yield: z
|
|
258
|
+
.number()
|
|
259
|
+
.min(0.01)
|
|
260
|
+
.max(10000000000)
|
|
261
|
+
.nullable()
|
|
262
|
+
.optional()
|
|
263
|
+
.openapi({ example: 1200 }),
|
|
264
|
+
duration: z
|
|
265
|
+
.number()
|
|
266
|
+
.min(1)
|
|
267
|
+
.max(1000)
|
|
268
|
+
.nullable()
|
|
269
|
+
.optional()
|
|
270
|
+
.openapi({ example: 1 }),
|
|
271
|
+
durationType: z
|
|
272
|
+
.nativeEnum(DurationType)
|
|
273
|
+
.nullable()
|
|
274
|
+
.optional()
|
|
275
|
+
.openapi({ example: DurationType.DAY }),
|
|
276
|
+
template: z
|
|
277
|
+
.nativeEnum(AssetTemplateType)
|
|
278
|
+
.default(AssetTemplateType.STANDARD)
|
|
279
|
+
.openapi({ example: AssetTemplateType.STANDARD }),
|
|
280
|
+
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
281
|
+
enableBonus: z.boolean().default(false).optional(),
|
|
184
282
|
}),
|
|
185
|
-
).
|
|
186
|
-
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
187
|
-
});
|
|
283
|
+
).superRefine(postAssetRefinement);
|
|
188
284
|
export type PostComplianceOffering = z.infer<typeof PostComplianceOffering>;
|
|
189
285
|
|
|
190
286
|
export const offeringsInclude = z.enum([
|
|
@@ -251,15 +347,7 @@ export const OfferingFiltersZod = z.object({
|
|
|
251
347
|
issuerId: z.lazy(() => issuerIdSchema).optional(),
|
|
252
348
|
type: z.nativeEnum(OfferingType).optional(),
|
|
253
349
|
status: z.nativeEnum(ComplianceReview).optional(),
|
|
254
|
-
enabled:
|
|
255
|
-
(val) =>
|
|
256
|
-
val === 'true' || val === '1'
|
|
257
|
-
? true
|
|
258
|
-
: val === 'false' || val === '0'
|
|
259
|
-
? false
|
|
260
|
-
: val,
|
|
261
|
-
z.boolean().optional(),
|
|
262
|
-
),
|
|
350
|
+
enabled: StringToBooleanSchema.optional(),
|
|
263
351
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
264
352
|
versioningType: z.nativeEnum(OfferingVersioningType).optional(),
|
|
265
353
|
combinedStatus: z.nativeEnum(OfferingStatus).optional(),
|
|
@@ -546,11 +634,9 @@ export type PaginatedPendingOfferingSummaryResponse = z.infer<
|
|
|
546
634
|
>;
|
|
547
635
|
|
|
548
636
|
export type OfferingUpdateFields = {
|
|
549
|
-
platform?: string;
|
|
550
|
-
platformSettings?: string | null;
|
|
551
637
|
managedBy?: ManagedByType | null;
|
|
552
|
-
enabled?: boolean;
|
|
553
638
|
showTotalRaised?: boolean;
|
|
639
|
+
enabled?: boolean;
|
|
554
640
|
};
|
|
555
641
|
|
|
556
642
|
export const ReviewOfferingOnboarding = z.object({
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
AccountStatus,
|
|
6
6
|
AccountZod,
|
|
7
7
|
IPaginationMeta,
|
|
8
|
+
StringToBooleanSchema,
|
|
8
9
|
UrlSchema,
|
|
9
10
|
} from './common.types';
|
|
10
11
|
import { accountIdSchema } from './account.types';
|
|
@@ -73,15 +74,7 @@ export const SitesParamSchema = z.object({
|
|
|
73
74
|
export const SitesFiltersZod = z.object({
|
|
74
75
|
url: z.string().optional(),
|
|
75
76
|
accountId: accountIdSchema.optional(),
|
|
76
|
-
enabled:
|
|
77
|
-
(val) =>
|
|
78
|
-
val === 'true' || val === '1'
|
|
79
|
-
? true
|
|
80
|
-
: val === 'false' || val === '0'
|
|
81
|
-
? false
|
|
82
|
-
: val,
|
|
83
|
-
z.boolean().optional(),
|
|
84
|
-
),
|
|
77
|
+
enabled: StringToBooleanSchema.optional(),
|
|
85
78
|
});
|
|
86
79
|
|
|
87
80
|
const sitesInclude = z.enum(['account']);
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
IPaginationMeta,
|
|
9
9
|
OfferingType,
|
|
10
10
|
SignatureStatus,
|
|
11
|
+
StringToBooleanSchema,
|
|
11
12
|
} from './common.types';
|
|
12
13
|
import { fileIdSchema } from './file.types';
|
|
13
14
|
import { accountIdSchema } from './account.types';
|
|
@@ -107,15 +108,7 @@ export type TradeLineItemQuery = z.infer<typeof TradeLineItemQuery>;
|
|
|
107
108
|
|
|
108
109
|
export const TradeLineItemFiltersQuery = z.object({
|
|
109
110
|
accountId: accountIdSchema.optional(),
|
|
110
|
-
hasSubdoc:
|
|
111
|
-
(val) =>
|
|
112
|
-
val === 'true' || val === '1'
|
|
113
|
-
? true
|
|
114
|
-
: val === 'false' || val === '0'
|
|
115
|
-
? false
|
|
116
|
-
: val,
|
|
117
|
-
z.boolean().optional(),
|
|
118
|
-
),
|
|
111
|
+
hasSubdoc: StringToBooleanSchema.optional(),
|
|
119
112
|
saStatus: z.nativeEnum(SignatureStatus).optional(),
|
|
120
113
|
offeringId: z.lazy(() => offeringIdSchema).optional(),
|
|
121
114
|
search: z.string().max(50).optional(),
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
import {
|
|
40
40
|
tradeLineItemIdSchema,
|
|
41
41
|
TradeLineItemZod,
|
|
42
|
-
} from './trade-line-item.
|
|
42
|
+
} from './trade-line-item.types';
|
|
43
43
|
import { TradeAdjustmentZod } from './trade-adjustment.type';
|
|
44
44
|
import { TransactionZod } from './transaction.types';
|
|
45
45
|
import { accountIdSchema } from './account.types';
|
|
@@ -55,8 +55,71 @@ import {
|
|
|
55
55
|
} from './secondary-trade.types';
|
|
56
56
|
import { InvestorAccount } from '../../investor-accounts/entities/investor-account.entity';
|
|
57
57
|
import { Trade } from '../../trades/entities/trade.entity';
|
|
58
|
+
import { fileIdSchema } from './file.types';
|
|
58
59
|
|
|
59
60
|
extendZodWithOpenApi(z);
|
|
61
|
+
|
|
62
|
+
// Zod schemas for attach subdoc endpoints
|
|
63
|
+
export const PostAttachSubdocBody = z.object({
|
|
64
|
+
lineItemId: tradeLineItemIdSchema.openapi({
|
|
65
|
+
example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja',
|
|
66
|
+
}),
|
|
67
|
+
fileId: z
|
|
68
|
+
.lazy(() => fileIdSchema)
|
|
69
|
+
.openapi({ example: 'file_01je6ht4b8fbmttkzh2hs82xqp' }),
|
|
70
|
+
primarySignatureStatus: z
|
|
71
|
+
.nativeEnum(SignatureStatus)
|
|
72
|
+
.openapi({ example: 'SIGNED' }),
|
|
73
|
+
secondarySignatureStatus: z
|
|
74
|
+
.nativeEnum(SignatureStatus)
|
|
75
|
+
.optional()
|
|
76
|
+
.openapi({ example: 'SIGNED' }),
|
|
77
|
+
});
|
|
78
|
+
export type PostAttachSubdocBody = z.infer<typeof PostAttachSubdocBody>;
|
|
79
|
+
|
|
80
|
+
export const PutAttachSubdocBody = z.object({
|
|
81
|
+
lineItemId: tradeLineItemIdSchema
|
|
82
|
+
.optional()
|
|
83
|
+
.openapi({ example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja' }),
|
|
84
|
+
fileId: z
|
|
85
|
+
.lazy(() => fileIdSchema)
|
|
86
|
+
.optional()
|
|
87
|
+
.openapi({ example: 'file_01je6ht4b8fbmttkzh2hs82xqp' }),
|
|
88
|
+
primarySignatureStatus: z
|
|
89
|
+
.nativeEnum(SignatureStatus)
|
|
90
|
+
.optional()
|
|
91
|
+
.openapi({ example: 'SIGNED' }),
|
|
92
|
+
secondarySignatureStatus: z
|
|
93
|
+
.nativeEnum(SignatureStatus)
|
|
94
|
+
.optional()
|
|
95
|
+
.openapi({ example: 'SIGNED' }),
|
|
96
|
+
});
|
|
97
|
+
export type PutAttachSubdocBody = z.infer<typeof PutAttachSubdocBody>;
|
|
98
|
+
|
|
99
|
+
export const PatchSubdocSignatureBody = z.object({
|
|
100
|
+
lineItemId: tradeLineItemIdSchema.optional().openapi({
|
|
101
|
+
example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja',
|
|
102
|
+
description:
|
|
103
|
+
'Optional. If not provided, updates the first line item with an attached subdoc. Required for trades with multiple line items.',
|
|
104
|
+
}),
|
|
105
|
+
primarySignatureStatus: z.nativeEnum(SignatureStatus).optional().openapi({
|
|
106
|
+
example: 'SIGNED',
|
|
107
|
+
description: 'Primary signer signature status',
|
|
108
|
+
}),
|
|
109
|
+
secondarySignatureStatus: z.nativeEnum(SignatureStatus).optional().openapi({
|
|
110
|
+
example: 'SIGNED',
|
|
111
|
+
description:
|
|
112
|
+
'Secondary signer signature status. Only applicable for JOINT investor accounts.',
|
|
113
|
+
}),
|
|
114
|
+
});
|
|
115
|
+
export type PatchSubdocSignatureBody = z.infer<typeof PatchSubdocSignatureBody>;
|
|
116
|
+
|
|
117
|
+
export const AttachSubdocResponse = z.object({
|
|
118
|
+
success: z.boolean(),
|
|
119
|
+
message: z.string(),
|
|
120
|
+
});
|
|
121
|
+
export type AttachSubdocResponse = z.infer<typeof AttachSubdocResponse>;
|
|
122
|
+
|
|
60
123
|
export const CheckResultsSchema = z.object({
|
|
61
124
|
fundingStatus: z.boolean(),
|
|
62
125
|
agreementStatus: z.boolean(),
|
|
@@ -202,6 +265,13 @@ export const PatchSaLogSchema = z.object({
|
|
|
202
265
|
|
|
203
266
|
export type PatchSaLogSchema = z.infer<typeof PatchSaLogSchema>;
|
|
204
267
|
|
|
268
|
+
export const TradeBalanceResultZod = z.object({
|
|
269
|
+
tradeAdjustments: z.number().multipleOf(0.01),
|
|
270
|
+
chargedAmount: z.number().multipleOf(0.01),
|
|
271
|
+
balance: z.number().multipleOf(0.01),
|
|
272
|
+
});
|
|
273
|
+
export type TradeBalanceResultZod = z.infer<typeof TradeBalanceResultZod>;
|
|
274
|
+
|
|
205
275
|
export const TradeZod = IBaseEntity.extend({
|
|
206
276
|
investorAccountId: z.lazy(() => investorAccountIdSchema.nullable()),
|
|
207
277
|
accountId: accountIdSchema.nullable(),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
1
3
|
import { TypeID } from 'typeid-js';
|
|
2
4
|
import {
|
|
3
5
|
dateSchema,
|
|
4
6
|
InvestorAccountType,
|
|
5
7
|
numberPrecisionSchema,
|
|
6
8
|
} from './common.types';
|
|
7
|
-
import { z } from 'zod';
|
|
8
9
|
import { IBaseEntity } from './entity.types';
|
|
9
10
|
import { accountIdSchema } from './account.types';
|
|
10
11
|
import {
|
|
@@ -18,7 +19,9 @@ import {
|
|
|
18
19
|
investorAccountIdSchema,
|
|
19
20
|
} from './investor-account.types';
|
|
20
21
|
import { TransactionStatus, TransactionType } from './common.types';
|
|
22
|
+
import { userIdSchema } from './user.types';
|
|
21
23
|
export { TransactionStatus, TransactionType };
|
|
24
|
+
extendZodWithOpenApi(z);
|
|
22
25
|
|
|
23
26
|
export enum RefundPaymentMethod {
|
|
24
27
|
CHECK = 'CHECK',
|
|
@@ -115,6 +118,14 @@ export type InvestorPostTransactionZod = z.infer<
|
|
|
115
118
|
typeof InvestorPostTransactionZod
|
|
116
119
|
>;
|
|
117
120
|
|
|
121
|
+
export const ClientPostTransactionZod = InvestorPostTransactionZod.extend({
|
|
122
|
+
userId: z
|
|
123
|
+
.lazy(() => userIdSchema)
|
|
124
|
+
.openapi({ example: 'user_01j5y5ghx5fg68d663j1fvy2x7' }),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export type ClientPostTransactionZod = z.infer<typeof ClientPostTransactionZod>;
|
|
128
|
+
|
|
118
129
|
export const refundTransactionIdSchema = z.string().refine(
|
|
119
130
|
(value) => {
|
|
120
131
|
try {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
3
|
import {
|
|
3
4
|
AccountStatus,
|
|
4
5
|
AccountWithoutUsersZod,
|
|
@@ -7,12 +8,11 @@ import {
|
|
|
7
8
|
ManagedByType,
|
|
8
9
|
OfferingType,
|
|
9
10
|
PortalType,
|
|
11
|
+
StringToBooleanSchema,
|
|
10
12
|
UserRole,
|
|
11
|
-
UserStatus,
|
|
12
13
|
UserType,
|
|
13
14
|
} from './common.types';
|
|
14
15
|
import { dateOrString, IBaseEntity } from './entity.types';
|
|
15
|
-
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
16
16
|
import { PhoneZodSchema } from './phone.type';
|
|
17
17
|
import { IInvestorAccount } from './investor-account.types';
|
|
18
18
|
import { TradeZod } from './trade.types';
|
|
@@ -51,6 +51,11 @@ export const UserDeleteResponse = z.object({
|
|
|
51
51
|
});
|
|
52
52
|
export type UserDeleteResponse = z.infer<typeof UserDeleteResponse>;
|
|
53
53
|
|
|
54
|
+
export const UserRestoreResponse = z.object({
|
|
55
|
+
message: z.string(),
|
|
56
|
+
});
|
|
57
|
+
export type UserRestoreResponse = z.infer<typeof UserRestoreResponse>;
|
|
58
|
+
|
|
54
59
|
export const GetMeResponse = IBaseEntity.extend({
|
|
55
60
|
accountId: z.string().nullable(),
|
|
56
61
|
accountName: z.string().nullable(),
|
|
@@ -59,7 +64,7 @@ export const GetMeResponse = IBaseEntity.extend({
|
|
|
59
64
|
email: z.string().email(),
|
|
60
65
|
provider: z.string(),
|
|
61
66
|
active: z.boolean(),
|
|
62
|
-
|
|
67
|
+
locked: z.boolean(),
|
|
63
68
|
lastLoginAt: dateOrString.nullable(),
|
|
64
69
|
loginCount: z.number(),
|
|
65
70
|
role: z.string(),
|
|
@@ -157,7 +162,7 @@ export const UserZod = IBaseEntity.extend({
|
|
|
157
162
|
onboarding: z.string().nullable(),
|
|
158
163
|
account: AccountWithoutUsersZod.optional(),
|
|
159
164
|
active: z.boolean(),
|
|
160
|
-
|
|
165
|
+
locked: z.boolean(),
|
|
161
166
|
userLogin: IBaseEntity.extend({
|
|
162
167
|
firstName: z.string(),
|
|
163
168
|
lastName: z.string(),
|
|
@@ -179,27 +184,9 @@ export const UserFiltersZod = z.object({
|
|
|
179
184
|
search: z.string().max(50).optional(),
|
|
180
185
|
role: z.nativeEnum(UserRole).optional(),
|
|
181
186
|
portal: z.string().optional(),
|
|
182
|
-
|
|
183
|
-
active:
|
|
184
|
-
|
|
185
|
-
.optional()
|
|
186
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
187
|
-
message: 'active must be a boolean string',
|
|
188
|
-
})
|
|
189
|
-
.transform((v) => {
|
|
190
|
-
if (!v) return undefined;
|
|
191
|
-
return v === 'true';
|
|
192
|
-
}),
|
|
193
|
-
twoFactorEnabled: z
|
|
194
|
-
.string()
|
|
195
|
-
.optional()
|
|
196
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
197
|
-
message: 'twoFactorEnabled must be a boolean string',
|
|
198
|
-
})
|
|
199
|
-
.transform((v) => {
|
|
200
|
-
if (!v) return undefined;
|
|
201
|
-
return v === 'true';
|
|
202
|
-
}),
|
|
187
|
+
locked: StringToBooleanSchema.optional(),
|
|
188
|
+
active: StringToBooleanSchema.optional(),
|
|
189
|
+
twoFactorEnabled: StringToBooleanSchema.optional(),
|
|
203
190
|
});
|
|
204
191
|
|
|
205
192
|
const usersInclude = z.enum(['account', 'role']);
|
|
@@ -274,7 +261,7 @@ export type IssuerUsersStatusUpdateResponse = z.infer<
|
|
|
274
261
|
>;
|
|
275
262
|
|
|
276
263
|
export const UpdateLockedStatus = z.object({
|
|
277
|
-
|
|
264
|
+
locked: z.boolean(),
|
|
278
265
|
});
|
|
279
266
|
|
|
280
267
|
export type UpdateLockedStatus = z.infer<typeof UpdateLockedStatus>;
|
|
@@ -285,7 +272,7 @@ export const UsersSummaryFilterZod = z.object({
|
|
|
285
272
|
portalType: z.nativeEnum(PortalType).optional(),
|
|
286
273
|
search: z.string().trim().max(50).optional(),
|
|
287
274
|
selectRole: z.nativeEnum(UserRole).optional(),
|
|
288
|
-
|
|
275
|
+
locked: StringToBooleanSchema.optional(),
|
|
289
276
|
});
|
|
290
277
|
export type UsersSummaryFilterZod = z.infer<typeof UsersSummaryFilterZod>;
|
|
291
278
|
|
|
@@ -299,7 +286,7 @@ export const UsersSummaryZod = z.object({
|
|
|
299
286
|
portalType: z.string(),
|
|
300
287
|
loginCount: z.number().int(),
|
|
301
288
|
lastLogin: z.date(),
|
|
302
|
-
|
|
289
|
+
locked: z.boolean(),
|
|
303
290
|
});
|
|
304
291
|
export type UsersSummaryZod = z.infer<typeof UsersSummaryZod>;
|
|
305
292
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
UnauthorizedError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
BadRequestError,
|
|
8
|
+
InternalError,
|
|
9
|
+
TradeZod,
|
|
10
|
+
userIdSchema,
|
|
11
|
+
tradeIdSchema,
|
|
12
|
+
} from '../../../common/types';
|
|
13
|
+
import {
|
|
14
|
+
PatchCartBody,
|
|
15
|
+
ClientPlacetradeBody,
|
|
16
|
+
PlaceTradeResponse,
|
|
17
|
+
} from '../../../common/types/cart.types';
|
|
18
|
+
|
|
19
|
+
const c = initContract();
|
|
20
|
+
|
|
21
|
+
export const cartContract = c.router(
|
|
22
|
+
{
|
|
23
|
+
getTradeCart: {
|
|
24
|
+
summary: 'Get carts (Trade.status = CART)',
|
|
25
|
+
method: 'GET',
|
|
26
|
+
path: '',
|
|
27
|
+
metadata: {
|
|
28
|
+
auth: true,
|
|
29
|
+
},
|
|
30
|
+
query: z.object({
|
|
31
|
+
userId: userIdSchema,
|
|
32
|
+
}),
|
|
33
|
+
responses: {
|
|
34
|
+
200: TradeZod,
|
|
35
|
+
401: UnauthorizedError,
|
|
36
|
+
403: ForbiddenError,
|
|
37
|
+
404: NotFoundError,
|
|
38
|
+
500: InternalError,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
postCheckout: {
|
|
42
|
+
summary: 'Place a trade (checkout button)',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/checkout',
|
|
45
|
+
metadata: {
|
|
46
|
+
auth: true,
|
|
47
|
+
},
|
|
48
|
+
body: ClientPlacetradeBody,
|
|
49
|
+
responses: {
|
|
50
|
+
200: PlaceTradeResponse,
|
|
51
|
+
400: BadRequestError,
|
|
52
|
+
401: UnauthorizedError,
|
|
53
|
+
403: ForbiddenError,
|
|
54
|
+
500: InternalError,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
patchCart: {
|
|
58
|
+
summary: 'Patch a cart',
|
|
59
|
+
method: 'PATCH',
|
|
60
|
+
path: '/:id',
|
|
61
|
+
metadata: {
|
|
62
|
+
auth: true,
|
|
63
|
+
},
|
|
64
|
+
pathParams: z.object({
|
|
65
|
+
id: tradeIdSchema,
|
|
66
|
+
}),
|
|
67
|
+
body: PatchCartBody,
|
|
68
|
+
responses: {
|
|
69
|
+
200: TradeZod,
|
|
70
|
+
400: BadRequestError,
|
|
71
|
+
401: UnauthorizedError,
|
|
72
|
+
403: ForbiddenError,
|
|
73
|
+
500: InternalError,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
pathPrefix: 'carts',
|
|
79
|
+
},
|
|
80
|
+
);
|
|
@@ -3,6 +3,7 @@ import { accountsContract } from './accounts';
|
|
|
3
3
|
import { apiKeysContract } from './api-keys';
|
|
4
4
|
import { clientApiKeyLogsContract } from './api-key-logs';
|
|
5
5
|
import { assetsContract } from './assets';
|
|
6
|
+
import { cartContract } from './cart';
|
|
6
7
|
import { filesContract } from './files';
|
|
7
8
|
import { individualsContract } from './individuals';
|
|
8
9
|
import { investorAccountsContract } from './investor-accounts';
|
|
@@ -15,6 +16,10 @@ import { secureRequestContract } from './secure-requests';
|
|
|
15
16
|
import { aicContract } from './aic';
|
|
16
17
|
import { authContract } from './auth';
|
|
17
18
|
import { sitesContract } from './sites';
|
|
19
|
+
import { paymentMethodsContract } from './payment-methods';
|
|
20
|
+
import { issuerPaymentMethodsContract } from './issuer-payment-methods';
|
|
21
|
+
import { tradeLineItemsContract } from './trade-line-items';
|
|
22
|
+
import { clientsTransactionsContract } from './transactions';
|
|
18
23
|
|
|
19
24
|
const c = initContract();
|
|
20
25
|
|
|
@@ -27,16 +32,21 @@ export const clientsContract = c.router(
|
|
|
27
32
|
apiKeys: apiKeysContract,
|
|
28
33
|
apiKeyLogs: clientApiKeyLogsContract,
|
|
29
34
|
assets: assetsContract,
|
|
35
|
+
cart: cartContract,
|
|
30
36
|
files: filesContract,
|
|
31
37
|
filesPublic: filesPublicContract,
|
|
32
38
|
individuals: individualsContract,
|
|
33
39
|
investorAccounts: investorAccountsContract,
|
|
40
|
+
issuerPaymentMethods: issuerPaymentMethodsContract,
|
|
34
41
|
issuers: issuersContract,
|
|
35
42
|
legalEntities: legalEntityContract,
|
|
36
43
|
offerings: offeringsContract,
|
|
44
|
+
paymentMethods: paymentMethodsContract,
|
|
37
45
|
secureRequests: secureRequestContract,
|
|
38
46
|
sites: sitesContract,
|
|
47
|
+
tradeLineItems: tradeLineItemsContract,
|
|
39
48
|
trades: tradesContract,
|
|
49
|
+
transactions: clientsTransactionsContract,
|
|
40
50
|
},
|
|
41
51
|
{
|
|
42
52
|
pathPrefix: '/clients/api/v1/',
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import {
|
|
3
|
+
ForbiddenError,
|
|
4
|
+
InternalError,
|
|
5
|
+
NotFoundError,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
GetIssuerPaymentMethodZod,
|
|
8
|
+
IPaginatedIssuerPaymentMethod,
|
|
9
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
10
|
+
PaginationOptionsZod,
|
|
11
|
+
} from '../../../common/types';
|
|
12
|
+
|
|
13
|
+
const c = initContract();
|
|
14
|
+
|
|
15
|
+
export const issuerPaymentMethodsContract = c.router(
|
|
16
|
+
{
|
|
17
|
+
getIssuerPaymentMethods: {
|
|
18
|
+
summary: 'Get issuer payment methods',
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '',
|
|
21
|
+
metadata: {
|
|
22
|
+
auth: true,
|
|
23
|
+
},
|
|
24
|
+
query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(
|
|
25
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
26
|
+
),
|
|
27
|
+
responses: {
|
|
28
|
+
200: IPaginatedIssuerPaymentMethod,
|
|
29
|
+
401: UnauthorizedError,
|
|
30
|
+
403: ForbiddenError,
|
|
31
|
+
404: NotFoundError,
|
|
32
|
+
500: InternalError,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pathPrefix: 'issuer-payment-methods',
|
|
38
|
+
},
|
|
39
|
+
);
|