@dalmore/api-contracts 0.0.0-dev.d8ef117 → 0.0.0-dev.e6235a7
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-contact.types.ts +2 -1
- package/common/types/account-manager.types.ts +3 -7
- package/common/types/account-setting.types.ts +65 -0
- package/common/types/account.types.ts +1 -0
- package/common/types/auth.types.ts +7 -18
- package/common/types/bonus-tier.types.ts +9 -0
- package/common/types/common.types.ts +32 -6
- package/common/types/contact-us.types.ts +6 -2
- package/common/types/covered-person.types.ts +2 -1
- package/common/types/dashboard.types.ts +2 -9
- package/common/types/escrow-account.types.ts +3 -3
- package/common/types/individuals.types.ts +3 -2
- package/common/types/investor-account.types.ts +2 -1
- package/common/types/invite.types.ts +27 -1
- package/common/types/issuer-offering.types.ts +11 -17
- package/common/types/legal-entity.types.ts +3 -2
- package/common/types/notification.types.ts +515 -29
- package/common/types/offering.types.ts +2 -9
- package/common/types/site-settings.types.ts +2 -1
- 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 +1 -1
- package/common/types/trusted-contact.types.ts +7 -7
- package/common/types/user.types.ts +11 -32
- package/contracts/clients/trade-line-items/index.ts +1 -1
- package/contracts/clients/trades/index.ts +1 -1
- package/contracts/compliance/account-settings/index.ts +59 -0
- package/contracts/compliance/auth/index.ts +4 -3
- package/contracts/compliance/bonus-tiers/index.ts +2 -2
- package/contracts/compliance/index.ts +4 -0
- package/contracts/compliance/invites/index.ts +4 -12
- package/contracts/compliance/notification-channels/index.ts +251 -0
- package/contracts/compliance/trade-line-items/index.ts +1 -1
- package/contracts/investors/trade-line-items/index.ts +1 -1
- package/contracts/issuers/account-settings/index.ts +36 -0
- package/contracts/issuers/auth/index.ts +4 -3
- package/contracts/issuers/disbursements/index.ts +17 -17
- package/contracts/issuers/index.ts +4 -0
- package/contracts/issuers/notification-channels/index.ts +251 -0
- package/package.json +1 -1
|
@@ -2,7 +2,11 @@ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
|
2
2
|
import { TypeID } from 'typeid-js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { IBaseEntity } from './entity.types';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
EmailSchema,
|
|
7
|
+
IPaginationMeta,
|
|
8
|
+
TrustedContactRelationship,
|
|
9
|
+
} from './common.types';
|
|
6
10
|
import { PhoneZodSchema } from './phone.type';
|
|
7
11
|
import { AddressSchema } from './address.types';
|
|
8
12
|
import { investorAccountIdSchema } from './investor-account.types';
|
|
@@ -68,7 +72,7 @@ export const PostTrustedContactZod = z
|
|
|
68
72
|
.object({
|
|
69
73
|
firstName: z.string().min(1).max(255).openapi({ example: 'John' }),
|
|
70
74
|
lastName: z.string().min(1).max(255).openapi({ example: 'Doe' }),
|
|
71
|
-
email:
|
|
75
|
+
email: EmailSchema.openapi({ example: 'john.doe@example.com' }),
|
|
72
76
|
phone: PhoneZodSchema.nullable().optional(),
|
|
73
77
|
relationship: z
|
|
74
78
|
.nativeEnum(TrustedContactRelationship)
|
|
@@ -92,11 +96,7 @@ export const PatchTrustedContactZod = z
|
|
|
92
96
|
.optional()
|
|
93
97
|
.openapi({ example: 'John' }),
|
|
94
98
|
lastName: z.string().min(1).max(255).optional().openapi({ example: 'Doe' }),
|
|
95
|
-
email:
|
|
96
|
-
.string()
|
|
97
|
-
.email()
|
|
98
|
-
.optional()
|
|
99
|
-
.openapi({ example: 'john.doe@example.com' }),
|
|
99
|
+
email: EmailSchema.optional(),
|
|
100
100
|
phone: PhoneZodSchema.nullable().optional(),
|
|
101
101
|
relationship: z.nativeEnum(TrustedContactRelationship).optional().openapi({
|
|
102
102
|
example: TrustedContactRelationship.CHILD,
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
ManagedByType,
|
|
9
9
|
OfferingType,
|
|
10
10
|
PortalType,
|
|
11
|
+
StringToBooleanSchema,
|
|
11
12
|
UserRole,
|
|
12
|
-
UserStatus,
|
|
13
13
|
UserType,
|
|
14
|
+
EmailSchema,
|
|
14
15
|
} from './common.types';
|
|
15
16
|
import { dateOrString, IBaseEntity } from './entity.types';
|
|
16
17
|
import { PhoneZodSchema } from './phone.type';
|
|
@@ -64,7 +65,7 @@ export const GetMeResponse = IBaseEntity.extend({
|
|
|
64
65
|
email: z.string().email(),
|
|
65
66
|
provider: z.string(),
|
|
66
67
|
active: z.boolean(),
|
|
67
|
-
|
|
68
|
+
locked: z.boolean(),
|
|
68
69
|
lastLoginAt: dateOrString.nullable(),
|
|
69
70
|
loginCount: z.number(),
|
|
70
71
|
role: z.string(),
|
|
@@ -147,11 +148,7 @@ export const UserMeUpdateZod = z.object({
|
|
|
147
148
|
firstName: z.string().optional(),
|
|
148
149
|
lastName: z.string().optional(),
|
|
149
150
|
password: z.string().min(6).optional(),
|
|
150
|
-
email:
|
|
151
|
-
.string()
|
|
152
|
-
.email()
|
|
153
|
-
.transform((val) => val.toLowerCase())
|
|
154
|
-
.optional(),
|
|
151
|
+
email: EmailSchema.optional(),
|
|
155
152
|
});
|
|
156
153
|
|
|
157
154
|
export const UserZod = IBaseEntity.extend({
|
|
@@ -162,7 +159,7 @@ export const UserZod = IBaseEntity.extend({
|
|
|
162
159
|
onboarding: z.string().nullable(),
|
|
163
160
|
account: AccountWithoutUsersZod.optional(),
|
|
164
161
|
active: z.boolean(),
|
|
165
|
-
|
|
162
|
+
locked: z.boolean(),
|
|
166
163
|
userLogin: IBaseEntity.extend({
|
|
167
164
|
firstName: z.string(),
|
|
168
165
|
lastName: z.string(),
|
|
@@ -184,27 +181,9 @@ export const UserFiltersZod = z.object({
|
|
|
184
181
|
search: z.string().max(50).optional(),
|
|
185
182
|
role: z.nativeEnum(UserRole).optional(),
|
|
186
183
|
portal: z.string().optional(),
|
|
187
|
-
|
|
188
|
-
active:
|
|
189
|
-
|
|
190
|
-
.optional()
|
|
191
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
192
|
-
message: 'active must be a boolean string',
|
|
193
|
-
})
|
|
194
|
-
.transform((v) => {
|
|
195
|
-
if (!v) return undefined;
|
|
196
|
-
return v === 'true';
|
|
197
|
-
}),
|
|
198
|
-
twoFactorEnabled: z
|
|
199
|
-
.string()
|
|
200
|
-
.optional()
|
|
201
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
202
|
-
message: 'twoFactorEnabled must be a boolean string',
|
|
203
|
-
})
|
|
204
|
-
.transform((v) => {
|
|
205
|
-
if (!v) return undefined;
|
|
206
|
-
return v === 'true';
|
|
207
|
-
}),
|
|
184
|
+
locked: StringToBooleanSchema.optional(),
|
|
185
|
+
active: StringToBooleanSchema.optional(),
|
|
186
|
+
twoFactorEnabled: StringToBooleanSchema.optional(),
|
|
208
187
|
});
|
|
209
188
|
|
|
210
189
|
const usersInclude = z.enum(['account', 'role']);
|
|
@@ -279,7 +258,7 @@ export type IssuerUsersStatusUpdateResponse = z.infer<
|
|
|
279
258
|
>;
|
|
280
259
|
|
|
281
260
|
export const UpdateLockedStatus = z.object({
|
|
282
|
-
|
|
261
|
+
locked: z.boolean(),
|
|
283
262
|
});
|
|
284
263
|
|
|
285
264
|
export type UpdateLockedStatus = z.infer<typeof UpdateLockedStatus>;
|
|
@@ -290,7 +269,7 @@ export const UsersSummaryFilterZod = z.object({
|
|
|
290
269
|
portalType: z.nativeEnum(PortalType).optional(),
|
|
291
270
|
search: z.string().trim().max(50).optional(),
|
|
292
271
|
selectRole: z.nativeEnum(UserRole).optional(),
|
|
293
|
-
|
|
272
|
+
locked: StringToBooleanSchema.optional(),
|
|
294
273
|
});
|
|
295
274
|
export type UsersSummaryFilterZod = z.infer<typeof UsersSummaryFilterZod>;
|
|
296
275
|
|
|
@@ -304,7 +283,7 @@ export const UsersSummaryZod = z.object({
|
|
|
304
283
|
portalType: z.string(),
|
|
305
284
|
loginCount: z.number().int(),
|
|
306
285
|
lastLogin: z.date(),
|
|
307
|
-
|
|
286
|
+
locked: z.boolean(),
|
|
308
287
|
});
|
|
309
288
|
export type UsersSummaryZod = z.infer<typeof UsersSummaryZod>;
|
|
310
289
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
accountSettingIdSchema,
|
|
5
|
+
AccountSettingsFilters,
|
|
6
|
+
AccountSettingsIncludeQuery,
|
|
7
|
+
IAccountSettingZod,
|
|
8
|
+
IPaginatedAccountSetting,
|
|
9
|
+
} from '../../../common/types/account-setting.types';
|
|
10
|
+
import {
|
|
11
|
+
InternalError,
|
|
12
|
+
NotFoundError,
|
|
13
|
+
PaginationOptionsZod,
|
|
14
|
+
UnauthorizedError,
|
|
15
|
+
} from '../../../common/types';
|
|
16
|
+
|
|
17
|
+
const c = initContract();
|
|
18
|
+
|
|
19
|
+
export const accountSettingsContract = c.router(
|
|
20
|
+
{
|
|
21
|
+
getAccountSettings: {
|
|
22
|
+
summary: 'Get account settings',
|
|
23
|
+
method: 'GET',
|
|
24
|
+
path: '',
|
|
25
|
+
metadata: {
|
|
26
|
+
auth: true,
|
|
27
|
+
},
|
|
28
|
+
query: PaginationOptionsZod.merge(AccountSettingsFilters).merge(
|
|
29
|
+
AccountSettingsIncludeQuery,
|
|
30
|
+
),
|
|
31
|
+
responses: {
|
|
32
|
+
200: IPaginatedAccountSetting,
|
|
33
|
+
401: UnauthorizedError,
|
|
34
|
+
500: InternalError,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
getAccountSetting: {
|
|
38
|
+
summary: 'Get account setting by id',
|
|
39
|
+
method: 'GET',
|
|
40
|
+
path: '/:id',
|
|
41
|
+
metadata: {
|
|
42
|
+
auth: true,
|
|
43
|
+
},
|
|
44
|
+
pathParams: z.object({
|
|
45
|
+
id: accountSettingIdSchema,
|
|
46
|
+
}),
|
|
47
|
+
query: z.object({}).merge(AccountSettingsIncludeQuery),
|
|
48
|
+
responses: {
|
|
49
|
+
200: IAccountSettingZod,
|
|
50
|
+
401: UnauthorizedError,
|
|
51
|
+
404: NotFoundError,
|
|
52
|
+
500: InternalError,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
pathPrefix: 'account-settings',
|
|
58
|
+
},
|
|
59
|
+
);
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
LoginBody2FA,
|
|
11
11
|
NotFoundError,
|
|
12
12
|
UnauthorizedError,
|
|
13
|
+
EmailSchema,
|
|
13
14
|
} from '../../../common/types';
|
|
14
15
|
import { z } from 'zod';
|
|
15
16
|
|
|
@@ -49,7 +50,7 @@ export const authContract = c.router(
|
|
|
49
50
|
method: 'POST',
|
|
50
51
|
path: 'forgot-password',
|
|
51
52
|
body: z.object({
|
|
52
|
-
email:
|
|
53
|
+
email: EmailSchema,
|
|
53
54
|
}),
|
|
54
55
|
responses: {
|
|
55
56
|
200: null,
|
|
@@ -75,7 +76,7 @@ export const authContract = c.router(
|
|
|
75
76
|
method: 'POST',
|
|
76
77
|
path: 'reset-password/verify',
|
|
77
78
|
body: z.object({
|
|
78
|
-
email:
|
|
79
|
+
email: EmailSchema,
|
|
79
80
|
code: z.string(),
|
|
80
81
|
}),
|
|
81
82
|
responses: {
|
|
@@ -90,7 +91,7 @@ export const authContract = c.router(
|
|
|
90
91
|
method: 'POST',
|
|
91
92
|
path: 'reset-password',
|
|
92
93
|
body: z.object({
|
|
93
|
-
email:
|
|
94
|
+
email: EmailSchema,
|
|
94
95
|
code: z.string(),
|
|
95
96
|
password: z.string().min(6),
|
|
96
97
|
}),
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
UnauthorizedError,
|
|
7
7
|
} from '../../../common/types';
|
|
8
8
|
import {
|
|
9
|
+
ComplianceEstimateBonusTierCalculationZod,
|
|
9
10
|
CompliancePostBonusTierZod,
|
|
10
11
|
EstimateBonusTierCalculationResponseZod,
|
|
11
|
-
EstimateBonusTierCalculationZod,
|
|
12
12
|
IBonusTierList,
|
|
13
13
|
PurchaseCalculationResponseZod,
|
|
14
14
|
PurchaseCalculationZod,
|
|
@@ -25,7 +25,7 @@ export const bonusTiersContract = c.router(
|
|
|
25
25
|
metadata: {
|
|
26
26
|
auth: true,
|
|
27
27
|
},
|
|
28
|
-
body:
|
|
28
|
+
body: ComplianceEstimateBonusTierCalculationZod,
|
|
29
29
|
responses: {
|
|
30
30
|
200: EstimateBonusTierCalculationResponseZod,
|
|
31
31
|
400: BadRequestError,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { accountsContract } from './accounts';
|
|
2
2
|
import { accountContactsContract } from './account-contacts';
|
|
3
3
|
import { accountManagersContract } from './account-managers';
|
|
4
|
+
import { accountSettingsContract } from './account-settings';
|
|
4
5
|
import { activitiesContract } from './activities';
|
|
5
6
|
import { apiKeysContract } from './api-keys';
|
|
6
7
|
import { assetsContract } from './assets';
|
|
@@ -31,6 +32,7 @@ import { kycsContract } from './kyc';
|
|
|
31
32
|
import { legalEntitiesContract } from './legal-entities';
|
|
32
33
|
import { loginHistoriesContract } from './login-histories';
|
|
33
34
|
import { notesContract } from './notes';
|
|
35
|
+
import { notificationChannelsContract } from './notification-channels';
|
|
34
36
|
import { offeringsContract } from './offerings';
|
|
35
37
|
import { pagesContract } from './pages';
|
|
36
38
|
import { paymentMethodsContract } from './payment-methods';
|
|
@@ -75,6 +77,7 @@ export const complianceContract = c.router(
|
|
|
75
77
|
accounts: accountsContract,
|
|
76
78
|
accountContacts: accountContactsContract,
|
|
77
79
|
accountManagers: accountManagersContract,
|
|
80
|
+
accountSettings: accountSettingsContract,
|
|
78
81
|
activities: activitiesContract,
|
|
79
82
|
apiKeys: apiKeysContract,
|
|
80
83
|
assets: assetsContract,
|
|
@@ -112,6 +115,7 @@ export const complianceContract = c.router(
|
|
|
112
115
|
legalEntities: legalEntitiesContract,
|
|
113
116
|
loginHistories: loginHistoriesContract,
|
|
114
117
|
notes: notesContract,
|
|
118
|
+
notificationChannels: notificationChannelsContract,
|
|
115
119
|
offerings: offeringsContract,
|
|
116
120
|
pages: pagesContract,
|
|
117
121
|
paymentMethods: paymentMethodsContract,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { initContract } from '@ts-rest/core';
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
|
+
CompliancePostInviteZod,
|
|
4
5
|
ForbiddenError,
|
|
5
6
|
InternalError,
|
|
6
7
|
inviteIdSchema,
|
|
@@ -10,9 +11,8 @@ import {
|
|
|
10
11
|
NotFoundError,
|
|
11
12
|
PaginationOptionsZod,
|
|
12
13
|
PatchInviteForComplianceZod,
|
|
13
|
-
|
|
14
|
+
PostInviteZod,
|
|
14
15
|
UnauthorizedError,
|
|
15
|
-
UserRole,
|
|
16
16
|
} from '../../../common/types';
|
|
17
17
|
import { z } from 'zod';
|
|
18
18
|
|
|
@@ -42,12 +42,7 @@ export const invitesContract = c.router(
|
|
|
42
42
|
metadata: {
|
|
43
43
|
auth: true,
|
|
44
44
|
},
|
|
45
|
-
body:
|
|
46
|
-
email: z.string().email(),
|
|
47
|
-
role: z.nativeEnum(UserRole),
|
|
48
|
-
accountId: z.string().optional(),
|
|
49
|
-
portalType: z.nativeEnum(PortalType).optional(),
|
|
50
|
-
}),
|
|
45
|
+
body: PostInviteZod,
|
|
51
46
|
responses: {
|
|
52
47
|
201: InviteWithUrl,
|
|
53
48
|
400: BadRequestError,
|
|
@@ -62,10 +57,7 @@ export const invitesContract = c.router(
|
|
|
62
57
|
metadata: {
|
|
63
58
|
auth: true,
|
|
64
59
|
},
|
|
65
|
-
body:
|
|
66
|
-
email: z.string().email(),
|
|
67
|
-
role: z.nativeEnum(UserRole),
|
|
68
|
-
}),
|
|
60
|
+
body: CompliancePostInviteZod,
|
|
69
61
|
responses: {
|
|
70
62
|
201: InviteWithUrl,
|
|
71
63
|
400: BadRequestError,
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
CreateChannelInputSchema,
|
|
5
|
+
CreateTriggerInputSchema,
|
|
6
|
+
IAvailableTriggersResponse,
|
|
7
|
+
INotificationChannelTriggerZod,
|
|
8
|
+
INotificationChannelZod,
|
|
9
|
+
INotificationRecordZod,
|
|
10
|
+
IPaginatedNotificationChannel,
|
|
11
|
+
IPaginatedNotificationRecord,
|
|
12
|
+
NotificationChannelFilters,
|
|
13
|
+
NotificationChannelsIncludeQuery,
|
|
14
|
+
notificationChannelIdSchema,
|
|
15
|
+
notificationChannelTriggerIdSchema,
|
|
16
|
+
NotificationRecordFilters,
|
|
17
|
+
NotificationRecordsIncludeQuery,
|
|
18
|
+
notificationRecordIdSchema,
|
|
19
|
+
UpdateChannelInputSchema,
|
|
20
|
+
} from '../../../common/types/notification.types';
|
|
21
|
+
import {
|
|
22
|
+
BadRequestError,
|
|
23
|
+
InternalError,
|
|
24
|
+
NotFoundError,
|
|
25
|
+
PaginationOptionsZod,
|
|
26
|
+
UnauthorizedError,
|
|
27
|
+
} from '../../../common/types';
|
|
28
|
+
|
|
29
|
+
const c = initContract();
|
|
30
|
+
|
|
31
|
+
export const notificationChannelsContract = c.router(
|
|
32
|
+
{
|
|
33
|
+
getChannels: {
|
|
34
|
+
summary: 'Get notification channels',
|
|
35
|
+
method: 'GET',
|
|
36
|
+
path: '',
|
|
37
|
+
metadata: {
|
|
38
|
+
auth: true,
|
|
39
|
+
},
|
|
40
|
+
query: PaginationOptionsZod.merge(NotificationChannelFilters).merge(
|
|
41
|
+
NotificationChannelsIncludeQuery,
|
|
42
|
+
),
|
|
43
|
+
responses: {
|
|
44
|
+
200: IPaginatedNotificationChannel,
|
|
45
|
+
401: UnauthorizedError,
|
|
46
|
+
500: InternalError,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
getChannel: {
|
|
50
|
+
summary: 'Get notification channel by id',
|
|
51
|
+
method: 'GET',
|
|
52
|
+
path: '/:id',
|
|
53
|
+
metadata: {
|
|
54
|
+
auth: true,
|
|
55
|
+
},
|
|
56
|
+
pathParams: z.object({
|
|
57
|
+
id: notificationChannelIdSchema,
|
|
58
|
+
}),
|
|
59
|
+
query: z.object({}).merge(NotificationChannelsIncludeQuery),
|
|
60
|
+
responses: {
|
|
61
|
+
200: INotificationChannelZod,
|
|
62
|
+
401: UnauthorizedError,
|
|
63
|
+
404: NotFoundError,
|
|
64
|
+
500: InternalError,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
createChannel: {
|
|
68
|
+
summary: 'Create notification channel',
|
|
69
|
+
method: 'POST',
|
|
70
|
+
path: '',
|
|
71
|
+
metadata: {
|
|
72
|
+
auth: true,
|
|
73
|
+
},
|
|
74
|
+
body: CreateChannelInputSchema,
|
|
75
|
+
responses: {
|
|
76
|
+
201: INotificationChannelZod,
|
|
77
|
+
400: BadRequestError,
|
|
78
|
+
401: UnauthorizedError,
|
|
79
|
+
500: InternalError,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
updateChannel: {
|
|
83
|
+
summary: 'Update notification channel',
|
|
84
|
+
method: 'PATCH',
|
|
85
|
+
path: '/:id',
|
|
86
|
+
metadata: {
|
|
87
|
+
auth: true,
|
|
88
|
+
},
|
|
89
|
+
pathParams: z.object({
|
|
90
|
+
id: notificationChannelIdSchema,
|
|
91
|
+
}),
|
|
92
|
+
body: UpdateChannelInputSchema,
|
|
93
|
+
responses: {
|
|
94
|
+
200: INotificationChannelZod,
|
|
95
|
+
400: BadRequestError,
|
|
96
|
+
401: UnauthorizedError,
|
|
97
|
+
404: NotFoundError,
|
|
98
|
+
500: InternalError,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
deleteChannel: {
|
|
102
|
+
summary: 'Delete notification channel',
|
|
103
|
+
method: 'DELETE',
|
|
104
|
+
path: '/:id',
|
|
105
|
+
metadata: {
|
|
106
|
+
auth: true,
|
|
107
|
+
},
|
|
108
|
+
pathParams: z.object({
|
|
109
|
+
id: notificationChannelIdSchema,
|
|
110
|
+
}),
|
|
111
|
+
body: z.object({}),
|
|
112
|
+
responses: {
|
|
113
|
+
200: z.object({ success: z.boolean() }),
|
|
114
|
+
401: UnauthorizedError,
|
|
115
|
+
404: NotFoundError,
|
|
116
|
+
500: InternalError,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
createTrigger: {
|
|
120
|
+
summary: 'Create notification channel trigger',
|
|
121
|
+
method: 'POST',
|
|
122
|
+
path: '/:id/triggers',
|
|
123
|
+
metadata: {
|
|
124
|
+
auth: true,
|
|
125
|
+
},
|
|
126
|
+
pathParams: z.object({
|
|
127
|
+
id: notificationChannelIdSchema,
|
|
128
|
+
}),
|
|
129
|
+
body: CreateTriggerInputSchema.omit({ notificationChannelId: true }),
|
|
130
|
+
responses: {
|
|
131
|
+
201: INotificationChannelTriggerZod,
|
|
132
|
+
400: BadRequestError,
|
|
133
|
+
401: UnauthorizedError,
|
|
134
|
+
404: NotFoundError,
|
|
135
|
+
500: InternalError,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
getAvailableTriggers: {
|
|
139
|
+
summary: 'Get all available triggers for a channel',
|
|
140
|
+
method: 'GET',
|
|
141
|
+
path: '/:id/triggers/available',
|
|
142
|
+
metadata: {
|
|
143
|
+
auth: true,
|
|
144
|
+
},
|
|
145
|
+
pathParams: z.object({
|
|
146
|
+
id: notificationChannelIdSchema,
|
|
147
|
+
}),
|
|
148
|
+
responses: {
|
|
149
|
+
200: IAvailableTriggersResponse,
|
|
150
|
+
401: UnauthorizedError,
|
|
151
|
+
404: NotFoundError,
|
|
152
|
+
500: InternalError,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
updateTrigger: {
|
|
156
|
+
summary: 'Update notification channel trigger',
|
|
157
|
+
method: 'PATCH',
|
|
158
|
+
path: '/:id/triggers/:triggerId',
|
|
159
|
+
metadata: {
|
|
160
|
+
auth: true,
|
|
161
|
+
},
|
|
162
|
+
pathParams: z.object({
|
|
163
|
+
id: notificationChannelIdSchema,
|
|
164
|
+
triggerId: notificationChannelTriggerIdSchema,
|
|
165
|
+
}),
|
|
166
|
+
body: z.object({ enabled: z.boolean() }),
|
|
167
|
+
responses: {
|
|
168
|
+
200: INotificationChannelTriggerZod,
|
|
169
|
+
400: BadRequestError,
|
|
170
|
+
401: UnauthorizedError,
|
|
171
|
+
404: NotFoundError,
|
|
172
|
+
500: InternalError,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
deleteTrigger: {
|
|
176
|
+
summary: 'Delete notification channel trigger',
|
|
177
|
+
method: 'DELETE',
|
|
178
|
+
path: '/:id/triggers/:triggerId',
|
|
179
|
+
metadata: {
|
|
180
|
+
auth: true,
|
|
181
|
+
},
|
|
182
|
+
pathParams: z.object({
|
|
183
|
+
id: notificationChannelIdSchema,
|
|
184
|
+
triggerId: notificationChannelTriggerIdSchema,
|
|
185
|
+
}),
|
|
186
|
+
body: z.object({}),
|
|
187
|
+
responses: {
|
|
188
|
+
200: z.object({ success: z.boolean() }),
|
|
189
|
+
401: UnauthorizedError,
|
|
190
|
+
404: NotFoundError,
|
|
191
|
+
500: InternalError,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
getRecords: {
|
|
195
|
+
summary: 'Get notification records',
|
|
196
|
+
method: 'GET',
|
|
197
|
+
path: '/records',
|
|
198
|
+
metadata: {
|
|
199
|
+
auth: true,
|
|
200
|
+
},
|
|
201
|
+
query: PaginationOptionsZod.merge(NotificationRecordFilters).merge(
|
|
202
|
+
NotificationRecordsIncludeQuery,
|
|
203
|
+
),
|
|
204
|
+
responses: {
|
|
205
|
+
200: IPaginatedNotificationRecord,
|
|
206
|
+
401: UnauthorizedError,
|
|
207
|
+
500: InternalError,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
getRecord: {
|
|
211
|
+
summary: 'Get notification record by id',
|
|
212
|
+
method: 'GET',
|
|
213
|
+
path: '/records/:recordId',
|
|
214
|
+
metadata: {
|
|
215
|
+
auth: true,
|
|
216
|
+
},
|
|
217
|
+
pathParams: z.object({
|
|
218
|
+
recordId: notificationRecordIdSchema,
|
|
219
|
+
}),
|
|
220
|
+
query: z.object({}).merge(NotificationRecordsIncludeQuery),
|
|
221
|
+
responses: {
|
|
222
|
+
200: INotificationRecordZod,
|
|
223
|
+
401: UnauthorizedError,
|
|
224
|
+
404: NotFoundError,
|
|
225
|
+
500: InternalError,
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
retryRecord: {
|
|
229
|
+
summary: 'Retry failed notification record',
|
|
230
|
+
method: 'POST',
|
|
231
|
+
path: '/records/:recordId/retry',
|
|
232
|
+
metadata: {
|
|
233
|
+
auth: true,
|
|
234
|
+
},
|
|
235
|
+
pathParams: z.object({
|
|
236
|
+
recordId: notificationRecordIdSchema,
|
|
237
|
+
}),
|
|
238
|
+
body: z.object({}),
|
|
239
|
+
responses: {
|
|
240
|
+
200: INotificationRecordZod,
|
|
241
|
+
400: BadRequestError,
|
|
242
|
+
401: UnauthorizedError,
|
|
243
|
+
404: NotFoundError,
|
|
244
|
+
500: InternalError,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
pathPrefix: 'notification-channels',
|
|
250
|
+
},
|
|
251
|
+
);
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ReviewTradeLineItemStatus,
|
|
14
14
|
TradeLineItemFiltersQuery,
|
|
15
15
|
TradeLineItemResponse,
|
|
16
|
-
} from '../../../common/types/trade-line-item.
|
|
16
|
+
} from '../../../common/types/trade-line-item.types';
|
|
17
17
|
|
|
18
18
|
import { z } from 'zod';
|
|
19
19
|
const c = initContract();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
AccountSettingsIncludeQuery,
|
|
5
|
+
IAccountSettingZod,
|
|
6
|
+
} from '../../../common/types/account-setting.types';
|
|
7
|
+
import {
|
|
8
|
+
InternalError,
|
|
9
|
+
NotFoundError,
|
|
10
|
+
UnauthorizedError,
|
|
11
|
+
} from '../../../common/types';
|
|
12
|
+
|
|
13
|
+
const c = initContract();
|
|
14
|
+
|
|
15
|
+
export const issuerAccountSettingsContract = c.router(
|
|
16
|
+
{
|
|
17
|
+
getAccountSettings: {
|
|
18
|
+
summary: 'Get account settings for current account',
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '',
|
|
21
|
+
metadata: {
|
|
22
|
+
auth: true,
|
|
23
|
+
},
|
|
24
|
+
query: z.object({}).merge(AccountSettingsIncludeQuery),
|
|
25
|
+
responses: {
|
|
26
|
+
200: IAccountSettingZod,
|
|
27
|
+
401: UnauthorizedError,
|
|
28
|
+
404: NotFoundError,
|
|
29
|
+
500: InternalError,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
pathPrefix: 'account-settings',
|
|
35
|
+
},
|
|
36
|
+
);
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SelectAccountIssuersResponse,
|
|
14
14
|
SwitchAccountIssuersBody,
|
|
15
15
|
UnauthorizedError,
|
|
16
|
+
EmailSchema,
|
|
16
17
|
} from '../../../common/types';
|
|
17
18
|
import { z } from 'zod';
|
|
18
19
|
|
|
@@ -78,7 +79,7 @@ export const authContract = c.router(
|
|
|
78
79
|
method: 'POST',
|
|
79
80
|
path: 'forgot-password',
|
|
80
81
|
body: z.object({
|
|
81
|
-
email:
|
|
82
|
+
email: EmailSchema,
|
|
82
83
|
}),
|
|
83
84
|
responses: {
|
|
84
85
|
200: z.string(),
|
|
@@ -92,7 +93,7 @@ export const authContract = c.router(
|
|
|
92
93
|
method: 'POST',
|
|
93
94
|
path: 'reset-password/verify',
|
|
94
95
|
body: z.object({
|
|
95
|
-
email:
|
|
96
|
+
email: EmailSchema,
|
|
96
97
|
code: z.string(),
|
|
97
98
|
}),
|
|
98
99
|
responses: {
|
|
@@ -108,7 +109,7 @@ export const authContract = c.router(
|
|
|
108
109
|
method: 'POST',
|
|
109
110
|
path: 'reset-password',
|
|
110
111
|
body: z.object({
|
|
111
|
-
email:
|
|
112
|
+
email: EmailSchema,
|
|
112
113
|
code: z.string(),
|
|
113
114
|
password: z.string().min(6),
|
|
114
115
|
}),
|