@dalmore/api-contracts 0.0.0-dev.58a860b → 0.0.0-dev.ab1033d
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/asset.types.ts +14 -14
- package/common/types/issuer-offering.types.ts +100 -13
- package/common/types/offering.types.ts +102 -11
- package/common/types/trade.types.ts +63 -0
- package/contracts/clients/cart/index.ts +40 -0
- package/contracts/clients/index.ts +2 -0
- package/contracts/clients/trades/index.ts +64 -0
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ export const assetIdSchema = z.string().refine(
|
|
|
29
29
|
message: `Invalid asset ID format. Must be a valid TypeID with "asset" prefix. Example: asset_01j5y5ghx5fg68d663j1fvy2x7`,
|
|
30
30
|
},
|
|
31
31
|
);
|
|
32
|
-
export enum
|
|
32
|
+
export enum AssetTemplateType {
|
|
33
33
|
STANDARD = 'STANDARD',
|
|
34
34
|
TIERED = 'TIERED',
|
|
35
35
|
}
|
|
@@ -51,7 +51,7 @@ export const IAsset = IBaseEntity.extend({
|
|
|
51
51
|
.lazy(() => IOffering)
|
|
52
52
|
.optional()
|
|
53
53
|
.nullable(), // Use z.lazy here
|
|
54
|
-
template: z.nativeEnum(
|
|
54
|
+
template: z.nativeEnum(AssetTemplateType),
|
|
55
55
|
tiers: z.array(z.number().positive()).nullable(),
|
|
56
56
|
enableBonus: z.boolean(),
|
|
57
57
|
});
|
|
@@ -102,16 +102,16 @@ const PostAssetBase = z.object({
|
|
|
102
102
|
.optional()
|
|
103
103
|
.openapi({ example: DurationType.DAY }),
|
|
104
104
|
template: z
|
|
105
|
-
.nativeEnum(
|
|
106
|
-
.default(
|
|
107
|
-
.openapi({ example:
|
|
105
|
+
.nativeEnum(AssetTemplateType)
|
|
106
|
+
.default(AssetTemplateType.STANDARD)
|
|
107
|
+
.openapi({ example: AssetTemplateType.STANDARD }),
|
|
108
108
|
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
109
109
|
enableBonus: z.boolean().default(false).openapi({ example: false }),
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
const postAssetRefinement = (data: any, ctx: any) => {
|
|
112
|
+
export const postAssetRefinement = (data: any, ctx: any) => {
|
|
113
113
|
// If type is bond, yield and duration must be provided (cannot be null or undefined)
|
|
114
|
-
if (data.type === AssetType.BOND) {
|
|
114
|
+
if (data.assetType === AssetType.BOND || data.type === AssetType.BOND) {
|
|
115
115
|
if (data.yield === null || data.yield === undefined) {
|
|
116
116
|
ctx.addIssue({
|
|
117
117
|
path: ['yield'],
|
|
@@ -139,7 +139,7 @@ const postAssetRefinement = (data: any, ctx: any) => {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// If type is stock, yield and duration must be either null or undefined
|
|
142
|
-
if (data.type === AssetType.STOCK) {
|
|
142
|
+
if (data.assetType === AssetType.STOCK || data.type === AssetType.STOCK) {
|
|
143
143
|
if (data.yield !== null && data.yield !== undefined) {
|
|
144
144
|
ctx.addIssue({
|
|
145
145
|
path: ['yield'],
|
|
@@ -162,7 +162,7 @@ const postAssetRefinement = (data: any, ctx: any) => {
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
if (data.template ===
|
|
165
|
+
if (data.template === AssetTemplateType.TIERED) {
|
|
166
166
|
if (data.tiers === null || data.tiers === undefined) {
|
|
167
167
|
ctx.addIssue({
|
|
168
168
|
path: ['tiers'],
|
|
@@ -172,7 +172,7 @@ const postAssetRefinement = (data: any, ctx: any) => {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
// If template is STANDARD, tiers must be null or undefined
|
|
175
|
-
if (data.template ===
|
|
175
|
+
if (data.template === AssetTemplateType.STANDARD) {
|
|
176
176
|
if (data.tiers !== null && data.tiers !== undefined) {
|
|
177
177
|
ctx.addIssue({
|
|
178
178
|
path: ['tiers'],
|
|
@@ -233,9 +233,9 @@ export const PutAsset = z.object({
|
|
|
233
233
|
.optional()
|
|
234
234
|
.openapi({ example: DurationType.DAY }),
|
|
235
235
|
template: z
|
|
236
|
-
.nativeEnum(
|
|
237
|
-
.default(
|
|
238
|
-
.openapi({ example:
|
|
236
|
+
.nativeEnum(AssetTemplateType)
|
|
237
|
+
.default(AssetTemplateType.STANDARD)
|
|
238
|
+
.openapi({ example: AssetTemplateType.STANDARD })
|
|
239
239
|
.nullable()
|
|
240
240
|
.optional(),
|
|
241
241
|
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
@@ -262,7 +262,7 @@ export const AssetsIncludeQuery = z.object({
|
|
|
262
262
|
assetsInclude.options.includes(include as any),
|
|
263
263
|
),
|
|
264
264
|
{
|
|
265
|
-
message: `Invalid include option provided. Valid options are: ${assetsInclude.options.join(',
|
|
265
|
+
message: `Invalid include option provided. Valid options are: ${assetsInclude.options.join(',')}`,
|
|
266
266
|
},
|
|
267
267
|
)
|
|
268
268
|
.openapi({
|
|
@@ -8,10 +8,12 @@ import {
|
|
|
8
8
|
ManagedByType,
|
|
9
9
|
OfferingVersioningType,
|
|
10
10
|
ComplianceReview,
|
|
11
|
+
DurationType,
|
|
12
|
+
AssetType,
|
|
11
13
|
} from './common.types';
|
|
12
14
|
import { IBaseEntity } from './entity.types';
|
|
13
15
|
import { IIssuer, issuerIdSchema } from './issuer.types';
|
|
14
|
-
import { IAsset } from './asset.types';
|
|
16
|
+
import { IAsset, postAssetRefinement, AssetTemplateType } from './asset.types';
|
|
15
17
|
import { fileIdSchema, FileZod } from './file.types';
|
|
16
18
|
import { accountIdSchema } from './account.types';
|
|
17
19
|
|
|
@@ -128,20 +130,59 @@ export const PostIssuerOffering = z
|
|
|
128
130
|
.nullable()
|
|
129
131
|
.openapi({ example: 'This is a description of the offering.' }),
|
|
130
132
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
133
|
+
assetName: z.string().min(2).max(50).openapi({ example: 'Asset name' }),
|
|
134
|
+
assetType: z.nativeEnum(AssetType).openapi({ example: AssetType.STOCK }),
|
|
135
|
+
pricePerUnit: z
|
|
136
|
+
.number()
|
|
137
|
+
.min(0.01)
|
|
138
|
+
.max(10000000000)
|
|
139
|
+
.nullable()
|
|
140
|
+
.openapi({ example: 2000 }),
|
|
141
|
+
totalUnits: z
|
|
142
|
+
.number()
|
|
143
|
+
.min(1)
|
|
144
|
+
.max(10000000000)
|
|
145
|
+
.nullable()
|
|
146
|
+
.openapi({ example: 5200 }),
|
|
147
|
+
yield: z
|
|
148
|
+
.number()
|
|
149
|
+
.min(0.01)
|
|
150
|
+
.max(10000000000)
|
|
151
|
+
.nullable()
|
|
152
|
+
.optional()
|
|
153
|
+
.openapi({ example: 1200 }),
|
|
154
|
+
duration: z
|
|
155
|
+
.number()
|
|
156
|
+
.min(1)
|
|
157
|
+
.max(1000)
|
|
158
|
+
.nullable()
|
|
159
|
+
.optional()
|
|
160
|
+
.openapi({ example: 1 }),
|
|
161
|
+
durationType: z
|
|
162
|
+
.nativeEnum(DurationType)
|
|
163
|
+
.nullable()
|
|
164
|
+
.optional()
|
|
165
|
+
.openapi({ example: DurationType.DAY }),
|
|
166
|
+
template: z
|
|
167
|
+
.nativeEnum(AssetTemplateType)
|
|
168
|
+
.default(AssetTemplateType.STANDARD)
|
|
169
|
+
.openapi({ example: AssetTemplateType.STANDARD }),
|
|
170
|
+
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
131
171
|
})
|
|
132
|
-
.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (data.minInvestment
|
|
136
|
-
|
|
172
|
+
.superRefine((data, ctx) => {
|
|
173
|
+
// Check if both values are present, and if so, ensure minInvestment is less than maxInvestment
|
|
174
|
+
if (data.minInvestment && data.maxInvestment) {
|
|
175
|
+
if (data.minInvestment >= data.maxInvestment) {
|
|
176
|
+
ctx.addIssue({
|
|
177
|
+
path: ['minInvestment'],
|
|
178
|
+
message: 'Minimum investment must be less than maximum investment.',
|
|
179
|
+
code: z.ZodIssueCode.custom,
|
|
180
|
+
});
|
|
137
181
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
path: ['minInvestment'],
|
|
143
|
-
},
|
|
144
|
-
);
|
|
182
|
+
}
|
|
183
|
+
// Apply asset-specific refinements
|
|
184
|
+
postAssetRefinement(data, ctx);
|
|
185
|
+
});
|
|
145
186
|
|
|
146
187
|
export type PostIssuerOffering = z.infer<typeof PostIssuerOffering>;
|
|
147
188
|
export const PatchIssuerOffering = z.object({
|
|
@@ -212,6 +253,52 @@ export const PatchIssuerOffering = z.object({
|
|
|
212
253
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
213
254
|
showTotalRaised: z.boolean().optional(),
|
|
214
255
|
issuerId: issuerIdSchema.optional(),
|
|
256
|
+
assetName: z.string().min(2).max(50).optional().openapi({ example: 'Z' }),
|
|
257
|
+
assetType: z
|
|
258
|
+
.nativeEnum(AssetType)
|
|
259
|
+
.optional()
|
|
260
|
+
.openapi({ example: AssetType.STOCK }),
|
|
261
|
+
pricePerUnit: z
|
|
262
|
+
.number()
|
|
263
|
+
.min(0.01)
|
|
264
|
+
.max(10000000000)
|
|
265
|
+
.nullable()
|
|
266
|
+
.optional()
|
|
267
|
+
.openapi({ example: 2000 }),
|
|
268
|
+
totalUnits: z
|
|
269
|
+
.number()
|
|
270
|
+
.min(1)
|
|
271
|
+
.max(10000000000)
|
|
272
|
+
.nullable()
|
|
273
|
+
.optional()
|
|
274
|
+
.openapi({ example: 5200 }),
|
|
275
|
+
yield: z
|
|
276
|
+
.number()
|
|
277
|
+
.min(0.01)
|
|
278
|
+
.max(10000000000)
|
|
279
|
+
.nullable()
|
|
280
|
+
.optional()
|
|
281
|
+
.openapi({ example: 1200 }),
|
|
282
|
+
duration: z
|
|
283
|
+
.number()
|
|
284
|
+
.min(1)
|
|
285
|
+
.max(1000)
|
|
286
|
+
.nullable()
|
|
287
|
+
.optional()
|
|
288
|
+
.openapi({ example: 1 }),
|
|
289
|
+
durationType: z
|
|
290
|
+
.nativeEnum(DurationType)
|
|
291
|
+
.nullable()
|
|
292
|
+
.optional()
|
|
293
|
+
.openapi({ example: DurationType.DAY }),
|
|
294
|
+
template: z
|
|
295
|
+
.nativeEnum(AssetTemplateType)
|
|
296
|
+
.default(AssetTemplateType.STANDARD)
|
|
297
|
+
.openapi({ example: AssetTemplateType.STANDARD })
|
|
298
|
+
.nullable()
|
|
299
|
+
.optional(),
|
|
300
|
+
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
301
|
+
enabled: z.boolean().optional(),
|
|
215
302
|
});
|
|
216
303
|
export type PatchIssuerOffering = z.infer<typeof PatchIssuerOffering>;
|
|
217
304
|
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
SortBy,
|
|
16
16
|
OfferingVersioningType,
|
|
17
17
|
OfferingOnboardingStatus,
|
|
18
|
+
AssetType,
|
|
19
|
+
DurationType,
|
|
18
20
|
} from './common.types';
|
|
19
21
|
import { IBaseEntity } from './entity.types';
|
|
20
22
|
import { fileIdSchema, FileZod } from './file.types';
|
|
@@ -24,6 +26,7 @@ import {
|
|
|
24
26
|
InvestorsOfferingsIncludeQuery,
|
|
25
27
|
} from './investors-offering.types';
|
|
26
28
|
import { OfferingStatus } from './issuer-offering.types';
|
|
29
|
+
import { postAssetRefinement, AssetTemplateType } from './asset.types';
|
|
27
30
|
|
|
28
31
|
export enum OfferingFeeType {
|
|
29
32
|
FIXED = 'FIXED',
|
|
@@ -115,7 +118,7 @@ export const IPaginatedOffering = z.object({
|
|
|
115
118
|
});
|
|
116
119
|
export type IPaginatedOffering = z.infer<typeof IPaginatedOffering>;
|
|
117
120
|
|
|
118
|
-
export const
|
|
121
|
+
export const PatchOfferingBase = z.object({
|
|
119
122
|
name: z.string().optional(),
|
|
120
123
|
description: z.string().nullable().optional(),
|
|
121
124
|
tid: z.string().optional(),
|
|
@@ -148,8 +151,8 @@ export const PatchOffering = z.object({
|
|
|
148
151
|
.openapi({ example: 5000 })
|
|
149
152
|
.optional()
|
|
150
153
|
.nullable(),
|
|
151
|
-
startAt: dateSchema.optional(),
|
|
152
|
-
endAt: dateSchema.optional(),
|
|
154
|
+
startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
|
|
155
|
+
endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
|
|
153
156
|
platform: z.string().optional(),
|
|
154
157
|
coverArtId: z
|
|
155
158
|
.lazy(() => fileIdSchema)
|
|
@@ -175,16 +178,106 @@ export const PatchOffering = z.object({
|
|
|
175
178
|
showTotalRaised: z.boolean().optional(),
|
|
176
179
|
issuerId: issuerIdSchema.optional(),
|
|
177
180
|
});
|
|
178
|
-
|
|
181
|
+
export const PatchOffering = PatchOfferingBase.merge(
|
|
182
|
+
z.object({
|
|
183
|
+
assetName: z
|
|
184
|
+
.string()
|
|
185
|
+
.min(2)
|
|
186
|
+
.max(50)
|
|
187
|
+
.optional()
|
|
188
|
+
.openapi({ example: 'Asset name' }),
|
|
189
|
+
assetType: z
|
|
190
|
+
.nativeEnum(AssetType)
|
|
191
|
+
.optional()
|
|
192
|
+
.openapi({ example: AssetType.STOCK }),
|
|
193
|
+
pricePerUnit: z
|
|
194
|
+
.number()
|
|
195
|
+
.min(0.01)
|
|
196
|
+
.max(10000000000)
|
|
197
|
+
.nullable()
|
|
198
|
+
.optional()
|
|
199
|
+
.openapi({ example: 2000 }),
|
|
200
|
+
totalUnits: z
|
|
201
|
+
.number()
|
|
202
|
+
.min(1)
|
|
203
|
+
.max(10000000000)
|
|
204
|
+
.nullable()
|
|
205
|
+
.optional()
|
|
206
|
+
.openapi({ example: 5200 }),
|
|
207
|
+
yield: z
|
|
208
|
+
.number()
|
|
209
|
+
.min(0.01)
|
|
210
|
+
.max(10000000000)
|
|
211
|
+
.nullable()
|
|
212
|
+
.optional()
|
|
213
|
+
.openapi({ example: 1200 }),
|
|
214
|
+
duration: z
|
|
215
|
+
.number()
|
|
216
|
+
.min(1)
|
|
217
|
+
.max(1000)
|
|
218
|
+
.nullable()
|
|
219
|
+
.optional()
|
|
220
|
+
.openapi({ example: 1 }),
|
|
221
|
+
durationType: z
|
|
222
|
+
.nativeEnum(DurationType)
|
|
223
|
+
.nullable()
|
|
224
|
+
.optional()
|
|
225
|
+
.openapi({ example: DurationType.DAY }),
|
|
226
|
+
template: z
|
|
227
|
+
.nativeEnum(AssetTemplateType)
|
|
228
|
+
.default(AssetTemplateType.STANDARD)
|
|
229
|
+
.openapi({ example: AssetTemplateType.STANDARD })
|
|
230
|
+
.nullable()
|
|
231
|
+
.optional(),
|
|
232
|
+
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
233
|
+
}),
|
|
234
|
+
);
|
|
179
235
|
export type PatchOffering = z.infer<typeof PatchOffering>;
|
|
180
236
|
|
|
181
|
-
export const PostComplianceOffering =
|
|
237
|
+
export const PostComplianceOffering = PatchOfferingBase.merge(
|
|
182
238
|
z.object({
|
|
183
239
|
accountId: accountIdSchema,
|
|
240
|
+
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
241
|
+
assetName: z.string().min(2).max(50).openapi({ example: 'Asset name' }),
|
|
242
|
+
assetType: z.nativeEnum(AssetType).openapi({ example: AssetType.STOCK }),
|
|
243
|
+
pricePerUnit: z
|
|
244
|
+
.number()
|
|
245
|
+
.min(0.01)
|
|
246
|
+
.max(10000000000)
|
|
247
|
+
.nullable()
|
|
248
|
+
.openapi({ example: 2000 }),
|
|
249
|
+
totalUnits: z
|
|
250
|
+
.number()
|
|
251
|
+
.min(1)
|
|
252
|
+
.max(10000000000)
|
|
253
|
+
.nullable()
|
|
254
|
+
.openapi({ example: 5200 }),
|
|
255
|
+
yield: z
|
|
256
|
+
.number()
|
|
257
|
+
.min(0.01)
|
|
258
|
+
.max(10000000000)
|
|
259
|
+
.nullable()
|
|
260
|
+
.optional()
|
|
261
|
+
.openapi({ example: 1200 }),
|
|
262
|
+
duration: z
|
|
263
|
+
.number()
|
|
264
|
+
.min(1)
|
|
265
|
+
.max(1000)
|
|
266
|
+
.nullable()
|
|
267
|
+
.optional()
|
|
268
|
+
.openapi({ example: 1 }),
|
|
269
|
+
durationType: z
|
|
270
|
+
.nativeEnum(DurationType)
|
|
271
|
+
.nullable()
|
|
272
|
+
.optional()
|
|
273
|
+
.openapi({ example: DurationType.DAY }),
|
|
274
|
+
template: z
|
|
275
|
+
.nativeEnum(AssetTemplateType)
|
|
276
|
+
.default(AssetTemplateType.STANDARD)
|
|
277
|
+
.openapi({ example: AssetTemplateType.STANDARD }),
|
|
278
|
+
tiers: z.array(z.number().positive()).nullable().optional(),
|
|
184
279
|
}),
|
|
185
|
-
).
|
|
186
|
-
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
187
|
-
});
|
|
280
|
+
).superRefine(postAssetRefinement);
|
|
188
281
|
export type PostComplianceOffering = z.infer<typeof PostComplianceOffering>;
|
|
189
282
|
|
|
190
283
|
export const offeringsInclude = z.enum([
|
|
@@ -546,11 +639,9 @@ export type PaginatedPendingOfferingSummaryResponse = z.infer<
|
|
|
546
639
|
>;
|
|
547
640
|
|
|
548
641
|
export type OfferingUpdateFields = {
|
|
549
|
-
platform?: string;
|
|
550
|
-
platformSettings?: string | null;
|
|
551
642
|
managedBy?: ManagedByType | null;
|
|
552
|
-
enabled?: boolean;
|
|
553
643
|
showTotalRaised?: boolean;
|
|
644
|
+
enabled?: boolean;
|
|
554
645
|
};
|
|
555
646
|
|
|
556
647
|
export const ReviewOfferingOnboarding = z.object({
|
|
@@ -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(),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
UnauthorizedError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
BadRequestError,
|
|
7
|
+
InternalError,
|
|
8
|
+
TradeZod,
|
|
9
|
+
tradeIdSchema,
|
|
10
|
+
} from '../../../common/types';
|
|
11
|
+
import { PatchCartBody } from '../../../common/types/cart.types';
|
|
12
|
+
|
|
13
|
+
const c = initContract();
|
|
14
|
+
|
|
15
|
+
export const cartContract = c.router(
|
|
16
|
+
{
|
|
17
|
+
patchCart: {
|
|
18
|
+
summary: 'Patch a cart',
|
|
19
|
+
method: 'PATCH',
|
|
20
|
+
path: '/:id',
|
|
21
|
+
metadata: {
|
|
22
|
+
auth: true,
|
|
23
|
+
},
|
|
24
|
+
pathParams: z.object({
|
|
25
|
+
id: tradeIdSchema,
|
|
26
|
+
}),
|
|
27
|
+
body: PatchCartBody,
|
|
28
|
+
responses: {
|
|
29
|
+
200: TradeZod,
|
|
30
|
+
400: BadRequestError,
|
|
31
|
+
401: UnauthorizedError,
|
|
32
|
+
403: ForbiddenError,
|
|
33
|
+
500: InternalError,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
pathPrefix: 'carts',
|
|
39
|
+
},
|
|
40
|
+
);
|
|
@@ -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';
|
|
@@ -27,6 +28,7 @@ export const clientsContract = c.router(
|
|
|
27
28
|
apiKeys: apiKeysContract,
|
|
28
29
|
apiKeyLogs: clientApiKeyLogsContract,
|
|
29
30
|
assets: assetsContract,
|
|
31
|
+
cart: cartContract,
|
|
30
32
|
files: filesContract,
|
|
31
33
|
filesPublic: filesPublicContract,
|
|
32
34
|
individuals: individualsContract,
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
tradeIdOrTidSchema,
|
|
17
17
|
TradesIncludeQuery,
|
|
18
18
|
TradeZod,
|
|
19
|
+
PostAttachSubdocBody,
|
|
20
|
+
PutAttachSubdocBody,
|
|
21
|
+
PatchSubdocSignatureBody,
|
|
22
|
+
AttachSubdocResponse,
|
|
19
23
|
} from '../../../common/types/trade.types';
|
|
20
24
|
import { z } from 'zod';
|
|
21
25
|
import {
|
|
@@ -115,6 +119,66 @@ export const tradesContract = c.router(
|
|
|
115
119
|
500: InternalError,
|
|
116
120
|
},
|
|
117
121
|
},
|
|
122
|
+
postAttachSubdoc: {
|
|
123
|
+
summary: 'Attach subdoc to trade',
|
|
124
|
+
method: 'POST',
|
|
125
|
+
path: '/:id/attach-subdoc',
|
|
126
|
+
pathParams: z.object({
|
|
127
|
+
id: tradeIdOrTidSchema,
|
|
128
|
+
}),
|
|
129
|
+
metadata: {
|
|
130
|
+
auth: true,
|
|
131
|
+
},
|
|
132
|
+
body: PostAttachSubdocBody,
|
|
133
|
+
responses: {
|
|
134
|
+
200: AttachSubdocResponse,
|
|
135
|
+
400: BadRequestError,
|
|
136
|
+
401: UnauthorizedError,
|
|
137
|
+
403: ForbiddenError,
|
|
138
|
+
404: NotFoundError,
|
|
139
|
+
500: InternalError,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
putAttachSubdoc: {
|
|
143
|
+
summary: 'Update attached subdoc for trade',
|
|
144
|
+
method: 'PUT',
|
|
145
|
+
path: '/:id/attach-subdoc',
|
|
146
|
+
pathParams: z.object({
|
|
147
|
+
id: tradeIdOrTidSchema,
|
|
148
|
+
}),
|
|
149
|
+
metadata: {
|
|
150
|
+
auth: true,
|
|
151
|
+
},
|
|
152
|
+
body: PutAttachSubdocBody,
|
|
153
|
+
responses: {
|
|
154
|
+
200: AttachSubdocResponse,
|
|
155
|
+
400: BadRequestError,
|
|
156
|
+
401: UnauthorizedError,
|
|
157
|
+
403: ForbiddenError,
|
|
158
|
+
404: NotFoundError,
|
|
159
|
+
500: InternalError,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
patchSubdocSign: {
|
|
163
|
+
summary: 'Update subdoc signature statuses for trade',
|
|
164
|
+
method: 'PATCH',
|
|
165
|
+
path: '/:id/sign',
|
|
166
|
+
pathParams: z.object({
|
|
167
|
+
id: tradeIdOrTidSchema,
|
|
168
|
+
}),
|
|
169
|
+
metadata: {
|
|
170
|
+
auth: true,
|
|
171
|
+
},
|
|
172
|
+
body: PatchSubdocSignatureBody,
|
|
173
|
+
responses: {
|
|
174
|
+
200: AttachSubdocResponse,
|
|
175
|
+
400: BadRequestError,
|
|
176
|
+
401: UnauthorizedError,
|
|
177
|
+
403: ForbiddenError,
|
|
178
|
+
404: NotFoundError,
|
|
179
|
+
500: InternalError,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
118
182
|
},
|
|
119
183
|
{
|
|
120
184
|
pathPrefix: 'trades',
|
package/package.json
CHANGED