@dalmore/api-contracts 0.0.0-dev.d07da18 → 0.0.0-dev.d29fb02

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.
Files changed (205) hide show
  1. package/README.md +23 -19
  2. package/common/types/account-contact.types.ts +2 -1
  3. package/common/types/account-manager.types.ts +3 -7
  4. package/common/types/account-setting.types.ts +65 -0
  5. package/common/types/account.types.ts +1 -0
  6. package/common/types/activity.types.ts +1 -1
  7. package/common/types/auth.types.ts +7 -18
  8. package/common/types/bonus-tier.types.ts +33 -0
  9. package/common/types/cart.types.ts +4 -1
  10. package/common/types/common.types.ts +38 -6
  11. package/common/types/contact-us.types.ts +6 -2
  12. package/common/types/covered-person.types.ts +2 -1
  13. package/common/types/dashboard.types.ts +2 -9
  14. package/common/types/disbursements.types.ts +119 -3
  15. package/common/types/escrow-account.types.ts +3 -3
  16. package/common/types/file.types.ts +17 -1
  17. package/common/types/i-will-do-it-later.types.ts +68 -0
  18. package/common/types/index.ts +2 -0
  19. package/common/types/individuals.types.ts +5 -17
  20. package/common/types/investor-account.types.ts +2 -1
  21. package/common/types/invite.types.ts +27 -1
  22. package/common/types/issuer-offering.types.ts +13 -17
  23. package/common/types/issuer-payment-method.types.ts +41 -0
  24. package/common/types/issuer.types.ts +9 -0
  25. package/common/types/legal-entity.types.ts +3 -2
  26. package/common/types/mail-template.types.ts +34 -0
  27. package/common/types/note.types.ts +1 -1
  28. package/common/types/notification.types.ts +525 -29
  29. package/common/types/offering.types.ts +4 -9
  30. package/common/types/site-settings.types.ts +2 -1
  31. package/common/types/site.types.ts +2 -9
  32. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  33. package/common/types/trade.types.ts +48 -2
  34. package/common/types/transaction.types.ts +12 -1
  35. package/common/types/trusted-contact.types.ts +7 -7
  36. package/common/types/user.types.ts +17 -33
  37. package/contracts/clients/cart/index.ts +21 -1
  38. package/contracts/clients/index.ts +6 -0
  39. package/contracts/{investors → clients}/issuer-payment-methods/index.ts +5 -2
  40. package/contracts/{compliance → clients}/payment-methods/index.ts +40 -12
  41. package/contracts/clients/trade-line-items/index.ts +1 -1
  42. package/contracts/clients/trades/index.ts +1 -1
  43. package/contracts/{investors → clients}/transactions/index.ts +3 -3
  44. package/index.ts +10 -0
  45. package/package.json +23 -32
  46. package/contracts/compliance/account-contacts/index.ts +0 -82
  47. package/contracts/compliance/account-managers/index.ts +0 -142
  48. package/contracts/compliance/accounts/index.ts +0 -187
  49. package/contracts/compliance/activities/index.ts +0 -55
  50. package/contracts/compliance/aic/index.ts +0 -60
  51. package/contracts/compliance/api-keys/index.ts +0 -91
  52. package/contracts/compliance/assets/index.ts +0 -122
  53. package/contracts/compliance/auth/index.ts +0 -134
  54. package/contracts/compliance/batch-jobs/index.ts +0 -62
  55. package/contracts/compliance/bonus-tiers/index.ts +0 -55
  56. package/contracts/compliance/checklist/index.ts +0 -87
  57. package/contracts/compliance/checklist-items/index.ts +0 -86
  58. package/contracts/compliance/covered-persons/index.ts +0 -97
  59. package/contracts/compliance/dashboard/index.ts +0 -111
  60. package/contracts/compliance/data-records/index.ts +0 -116
  61. package/contracts/compliance/data-rooms/index.ts +0 -113
  62. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  63. package/contracts/compliance/disbursement/index.ts +0 -165
  64. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  65. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  66. package/contracts/compliance/domain-filters/index.ts +0 -117
  67. package/contracts/compliance/email-themes/index.ts +0 -284
  68. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  69. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  70. package/contracts/compliance/exchange-imports/index.ts +0 -137
  71. package/contracts/compliance/files/index.ts +0 -267
  72. package/contracts/compliance/files-public/index.ts +0 -188
  73. package/contracts/compliance/health/index.ts +0 -26
  74. package/contracts/compliance/index.ts +0 -147
  75. package/contracts/compliance/individuals/index.ts +0 -57
  76. package/contracts/compliance/investor-accounts/index.ts +0 -141
  77. package/contracts/compliance/invites/index.ts +0 -137
  78. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  79. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  80. package/contracts/compliance/issuers/index.ts +0 -97
  81. package/contracts/compliance/job-items/index.ts +0 -58
  82. package/contracts/compliance/jobs/index.ts +0 -59
  83. package/contracts/compliance/kyb/index.ts +0 -54
  84. package/contracts/compliance/kyc/index.ts +0 -77
  85. package/contracts/compliance/legal-entities/index.ts +0 -57
  86. package/contracts/compliance/login-histories/index.ts +0 -37
  87. package/contracts/compliance/notes/index.ts +0 -69
  88. package/contracts/compliance/notion-databases/index.ts +0 -107
  89. package/contracts/compliance/notion-pages/index.ts +0 -105
  90. package/contracts/compliance/offering-reports/index.ts +0 -149
  91. package/contracts/compliance/offerings/index.ts +0 -233
  92. package/contracts/compliance/pages/index.ts +0 -178
  93. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  94. package/contracts/compliance/review/index.ts +0 -169
  95. package/contracts/compliance/roles/index.ts +0 -34
  96. package/contracts/compliance/secondary-customers/index.ts +0 -77
  97. package/contracts/compliance/secondary-orders/index.ts +0 -60
  98. package/contracts/compliance/secondary-trades/index.ts +0 -100
  99. package/contracts/compliance/secure-requests/index.ts +0 -54
  100. package/contracts/compliance/signer/index.ts +0 -369
  101. package/contracts/compliance/site-links/index.ts +0 -128
  102. package/contracts/compliance/site-settings/index.ts +0 -669
  103. package/contracts/compliance/sites/index.ts +0 -56
  104. package/contracts/compliance/state-machine/index.ts +0 -94
  105. package/contracts/compliance/tasks/index.ts +0 -91
  106. package/contracts/compliance/third-parties/index.ts +0 -52
  107. package/contracts/compliance/trade-line-items/index.ts +0 -59
  108. package/contracts/compliance/trades/index.ts +0 -230
  109. package/contracts/compliance/transactions/index.ts +0 -161
  110. package/contracts/compliance/user-manuals/index.ts +0 -271
  111. package/contracts/compliance/user-settings/index.ts +0 -189
  112. package/contracts/compliance/users/index.ts +0 -200
  113. package/contracts/compliance/webhooks/index.ts +0 -41
  114. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  115. package/contracts/compliance-apikey/index.ts +0 -14
  116. package/contracts/index.ts +0 -6
  117. package/contracts/investors/account-contacts/index.ts +0 -58
  118. package/contracts/investors/aic/index.ts +0 -59
  119. package/contracts/investors/assets/index.ts +0 -61
  120. package/contracts/investors/auth/index.ts +0 -116
  121. package/contracts/investors/bonus-tiers/index.ts +0 -37
  122. package/contracts/investors/cart/index.ts +0 -75
  123. package/contracts/investors/contact-us/index.ts +0 -48
  124. package/contracts/investors/data-records/index.ts +0 -113
  125. package/contracts/investors/data-rooms/index.ts +0 -96
  126. package/contracts/investors/files/index.ts +0 -167
  127. package/contracts/investors/files-public/index.ts +0 -185
  128. package/contracts/investors/index.ts +0 -72
  129. package/contracts/investors/individuals/index.ts +0 -99
  130. package/contracts/investors/investor-accounts/index.ts +0 -110
  131. package/contracts/investors/issuers/index.ts +0 -30
  132. package/contracts/investors/legal-entities/index.ts +0 -93
  133. package/contracts/investors/notes/index.ts +0 -69
  134. package/contracts/investors/offerings/index.ts +0 -93
  135. package/contracts/investors/pages/index.ts +0 -88
  136. package/contracts/investors/payment-methods/index.ts +0 -149
  137. package/contracts/investors/portfolios/index.ts +0 -53
  138. package/contracts/investors/sites/index.ts +0 -96
  139. package/contracts/investors/tasks/index.ts +0 -111
  140. package/contracts/investors/trade-line-items/index.ts +0 -75
  141. package/contracts/investors/trades/index.ts +0 -114
  142. package/contracts/investors/trusted-contacts/index.ts +0 -93
  143. package/contracts/investors/user-manuals/index.ts +0 -62
  144. package/contracts/investors/user-settings/index.ts +0 -170
  145. package/contracts/investors/users/index.ts +0 -45
  146. package/contracts/investors/webhooks/index.ts +0 -30
  147. package/contracts/issuers/account-contacts/index.ts +0 -76
  148. package/contracts/issuers/account-integrations/index.ts +0 -97
  149. package/contracts/issuers/accounts/index.ts +0 -97
  150. package/contracts/issuers/activities/index.ts +0 -54
  151. package/contracts/issuers/aic/index.ts +0 -39
  152. package/contracts/issuers/api-key-logs/index.ts +0 -53
  153. package/contracts/issuers/api-keys/index.ts +0 -93
  154. package/contracts/issuers/assets/index.ts +0 -122
  155. package/contracts/issuers/auth/index.ts +0 -152
  156. package/contracts/issuers/bonus-tiers/index.ts +0 -55
  157. package/contracts/issuers/contact-us/index.ts +0 -48
  158. package/contracts/issuers/covered-persons/index.ts +0 -136
  159. package/contracts/issuers/dashboard/index.ts +0 -72
  160. package/contracts/issuers/data-records/index.ts +0 -257
  161. package/contracts/issuers/data-rooms/index.ts +0 -134
  162. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  163. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  164. package/contracts/issuers/disbursements/index.ts +0 -153
  165. package/contracts/issuers/email-themes/index.ts +0 -242
  166. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  167. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  168. package/contracts/issuers/files/index.ts +0 -166
  169. package/contracts/issuers/files-public/index.ts +0 -166
  170. package/contracts/issuers/health/index.ts +0 -24
  171. package/contracts/issuers/index.ts +0 -112
  172. package/contracts/issuers/investor-accounts/index.ts +0 -148
  173. package/contracts/issuers/invites/index.ts +0 -129
  174. package/contracts/issuers/issuer/index.ts +0 -94
  175. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  176. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  177. package/contracts/issuers/kyc/index.ts +0 -38
  178. package/contracts/issuers/login-histories/index.ts +0 -51
  179. package/contracts/issuers/notes/index.ts +0 -69
  180. package/contracts/issuers/offerings/index.ts +0 -206
  181. package/contracts/issuers/pages/index.ts +0 -138
  182. package/contracts/issuers/payment-methods/index.ts +0 -61
  183. package/contracts/issuers/portfolios/index.ts +0 -36
  184. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  185. package/contracts/issuers/review/index.ts +0 -63
  186. package/contracts/issuers/secondary-customers/index.ts +0 -55
  187. package/contracts/issuers/secondary-orders/index.ts +0 -57
  188. package/contracts/issuers/secondary-trades/index.ts +0 -57
  189. package/contracts/issuers/secure-requests/index.ts +0 -34
  190. package/contracts/issuers/site-links/index.ts +0 -116
  191. package/contracts/issuers/site-settings/index.ts +0 -585
  192. package/contracts/issuers/sites/index.ts +0 -32
  193. package/contracts/issuers/tasks/index.ts +0 -111
  194. package/contracts/issuers/trades/index.ts +0 -132
  195. package/contracts/issuers/transactions/index.ts +0 -158
  196. package/contracts/issuers/user-manuals/index.ts +0 -62
  197. package/contracts/issuers/user-settings/index.ts +0 -170
  198. package/contracts/issuers/users/index.ts +0 -126
  199. package/contracts/secondaries/accounts/index.ts +0 -58
  200. package/contracts/secondaries/index.ts +0 -23
  201. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  202. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  203. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  204. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  205. package/contracts/secondaries/secondary-trades/index.ts +0 -56
@@ -1,271 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- BadRequestError,
4
- ForbiddenError,
5
- InternalError,
6
- NotFoundError,
7
- UnauthorizedError,
8
- } from '../../../common/types';
9
- import {
10
- GetUserManualCategoryZod,
11
- IPaginatedUserManualCategory,
12
- IUserManualCategory,
13
- IUserManualPage,
14
- userManualCategoriesIncludeQuery,
15
- userManualCategorySchema,
16
- userManualPageSchema,
17
- PostUserManualCategoryZod,
18
- PostUserManualPageZod,
19
- PatchUserManualCategoryZod,
20
- PatchUserManualPageZod,
21
- IUserManualPageUrl,
22
- PatchUserManualPageUrlZod,
23
- OrderUserManualCategoriesZod,
24
- UserManualOrderResponseZod,
25
- OrderUserManualPagesZod,
26
- userManualPageUrlSchema,
27
- PostUserManualPageUrlZod,
28
- UserManualsPaginationOptionsZod,
29
- } from '../../../common/types/user-manual.types';
30
- import { z } from 'zod';
31
-
32
- const c = initContract();
33
-
34
- export const userManualsContract = c.router(
35
- {
36
- getUserManualCategories: {
37
- summary: 'Get user manual Categories',
38
- method: 'GET',
39
- path: '/categories',
40
- metadata: {
41
- auth: true,
42
- },
43
- query: UserManualsPaginationOptionsZod.merge(
44
- userManualCategoriesIncludeQuery,
45
- ).merge(GetUserManualCategoryZod),
46
- responses: {
47
- 200: IPaginatedUserManualCategory,
48
- 400: BadRequestError,
49
- 401: UnauthorizedError,
50
- 403: ForbiddenError,
51
- },
52
- },
53
- getUserManualCategory: {
54
- summary: 'Get user manual category',
55
- method: 'GET',
56
- path: '/categories/:id',
57
- metadata: {
58
- auth: true,
59
- },
60
- pathParams: z.object({
61
- id: userManualCategorySchema,
62
- }),
63
- query: z.object({}).merge(userManualCategoriesIncludeQuery),
64
- responses: {
65
- 200: IUserManualCategory,
66
- 400: BadRequestError,
67
- 401: UnauthorizedError,
68
- 403: ForbiddenError,
69
- 404: NotFoundError,
70
- },
71
- },
72
- postUserManualCategory: {
73
- summary: '[ADMIN] Create user manual category',
74
- method: 'POST',
75
- path: '/categories',
76
- metadata: {
77
- auth: true,
78
- },
79
- body: PostUserManualCategoryZod,
80
- responses: {
81
- 201: IUserManualCategory,
82
- 400: BadRequestError,
83
- 401: UnauthorizedError,
84
- 403: ForbiddenError,
85
- 500: InternalError,
86
- },
87
- },
88
- patchUserManualCategory: {
89
- summary: '[ADMIN] Update user manual category',
90
- method: 'PATCH',
91
- path: '/categories/:id',
92
- metadata: {
93
- auth: true,
94
- },
95
- pathParams: z.object({
96
- id: userManualCategorySchema,
97
- }),
98
- body: PatchUserManualCategoryZod,
99
- responses: {
100
- 200: IUserManualCategory,
101
- 400: BadRequestError,
102
- 401: UnauthorizedError,
103
- 403: ForbiddenError,
104
- 404: NotFoundError,
105
- 500: InternalError,
106
- },
107
- },
108
- deleteUserManualCategory: {
109
- summary: '[ADMIN] Delete user manual category',
110
- method: 'DELETE',
111
- path: '/categories/:id',
112
- metadata: {
113
- auth: true,
114
- },
115
- pathParams: z.object({
116
- id: userManualCategorySchema,
117
- }),
118
- responses: {
119
- 200: UserManualOrderResponseZod,
120
- 400: BadRequestError,
121
- 401: UnauthorizedError,
122
- 403: ForbiddenError,
123
- 404: NotFoundError,
124
- },
125
- },
126
- patchUserManualCategoriesOrder: {
127
- summary: '[ADMIN] Update user manual categories order',
128
- method: 'PATCH',
129
- path: '/categories/order',
130
- metadata: {
131
- auth: true,
132
- },
133
- body: OrderUserManualCategoriesZod,
134
- responses: {
135
- 200: UserManualOrderResponseZod,
136
- 400: BadRequestError,
137
- 401: UnauthorizedError,
138
- 403: ForbiddenError,
139
- 500: InternalError,
140
- },
141
- },
142
- postUserManualPage: {
143
- summary: '[ADMIN] Create user manual page',
144
- method: 'POST',
145
- path: '/pages',
146
- metadata: {
147
- auth: true,
148
- },
149
- body: PostUserManualPageZod,
150
- responses: {
151
- 201: IUserManualPage,
152
- 400: BadRequestError,
153
- 401: UnauthorizedError,
154
- 403: ForbiddenError,
155
- 500: InternalError,
156
- },
157
- },
158
-
159
- deleteUserManualPage: {
160
- summary: '[ADMIN] Delete user manual page',
161
- method: 'DELETE',
162
- path: '/pages/:id',
163
- metadata: {
164
- auth: true,
165
- },
166
- pathParams: z.object({
167
- id: userManualPageSchema,
168
- }),
169
- responses: {
170
- 200: UserManualOrderResponseZod,
171
- 400: BadRequestError,
172
- 401: UnauthorizedError,
173
- 403: ForbiddenError,
174
- 404: NotFoundError,
175
- },
176
- },
177
- patchUserManualPagesOrder: {
178
- summary: '[ADMIN] Update user manual pages order',
179
- method: 'PATCH',
180
- path: '/pages/order',
181
- metadata: {
182
- auth: true,
183
- },
184
- body: OrderUserManualPagesZod,
185
- responses: {
186
- 200: UserManualOrderResponseZod,
187
- 400: BadRequestError,
188
- 401: UnauthorizedError,
189
- 403: ForbiddenError,
190
- 500: InternalError,
191
- },
192
- },
193
- patchUserManualPage: {
194
- summary: '[ADMIN] Update user manual page',
195
- method: 'PATCH',
196
- path: '/pages/:id',
197
- metadata: {
198
- auth: true,
199
- },
200
- pathParams: z.object({
201
- id: userManualPageSchema,
202
- }),
203
- body: PatchUserManualPageZod,
204
- responses: {
205
- 200: IUserManualPage,
206
- 400: BadRequestError,
207
- 401: UnauthorizedError,
208
- 403: ForbiddenError,
209
- 404: NotFoundError,
210
- 500: InternalError,
211
- },
212
- },
213
- patchUserManualPageUrl: {
214
- summary: '[ADMIN] Update user manual page url',
215
- method: 'PATCH',
216
- path: '/page-urls/:id',
217
- metadata: {
218
- auth: true,
219
- },
220
- pathParams: z.object({
221
- id: userManualPageUrlSchema,
222
- }),
223
- body: PatchUserManualPageUrlZod,
224
- responses: {
225
- 200: IUserManualPageUrl,
226
- 400: BadRequestError,
227
- 401: UnauthorizedError,
228
- 403: ForbiddenError,
229
- 404: NotFoundError,
230
- 500: InternalError,
231
- },
232
- },
233
- postUserManualPageUrl: {
234
- summary: '[ADMIN] Create user manual page url',
235
- method: 'POST',
236
- path: '/page-urls',
237
- metadata: {
238
- auth: true,
239
- },
240
- body: PostUserManualPageUrlZod,
241
- responses: {
242
- 201: IUserManualPageUrl,
243
- 400: BadRequestError,
244
- 401: UnauthorizedError,
245
- 403: ForbiddenError,
246
- 500: InternalError,
247
- },
248
- },
249
- deleteUserManualPageUrl: {
250
- summary: '[ADMIN] Delete user manual page url',
251
- method: 'DELETE',
252
- path: '/page-urls/:id',
253
- metadata: {
254
- auth: true,
255
- },
256
- pathParams: z.object({
257
- id: userManualPageUrlSchema,
258
- }),
259
- responses: {
260
- 200: UserManualOrderResponseZod,
261
- 400: BadRequestError,
262
- 401: UnauthorizedError,
263
- 403: ForbiddenError,
264
- 404: NotFoundError,
265
- },
266
- },
267
- },
268
- {
269
- pathPrefix: 'user-manuals',
270
- },
271
- );
@@ -1,189 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- BadRequestError,
4
- ForbiddenError,
5
- InternalError,
6
- NotFoundError,
7
- UnauthorizedError,
8
- UserZod,
9
- } from '../../../common/types';
10
- import {
11
- disableTwoFactorBody,
12
- sendEmailVerificationBody,
13
- sendEmailVerificationResponse,
14
- sendVerificationCodeBody,
15
- sendVerificationCodeResponse,
16
- setupPhoneNumberBody,
17
- setupPhoneNumberResponse,
18
- setupTwoFactorResponse,
19
- userSettingsZod,
20
- validPhoneNumberBody,
21
- validPhoneNumberResponse,
22
- verifyEmailBody,
23
- verifyEmailResponse,
24
- verifyPhoneNumberBody,
25
- verifyPhoneNumberResponse,
26
- verifyTwoFactorBody,
27
- verifyTwoFactorResponse,
28
- } from '../../../common/types/user-setting.types';
29
-
30
- const c = initContract();
31
-
32
- export const userSettingsContract = c.router(
33
- {
34
- getUserSettings: {
35
- summary: 'Get current user settings',
36
- method: 'GET',
37
- path: '',
38
- metadata: {
39
- auth: true,
40
- },
41
- responses: {
42
- 200: userSettingsZod,
43
- 401: UnauthorizedError,
44
- 404: NotFoundError,
45
- 500: InternalError,
46
- },
47
- },
48
- validPhoneNumber: {
49
- summary: 'Validate phone number',
50
- method: 'POST',
51
- path: '/valid-phone-number',
52
- metadata: {
53
- auth: true,
54
- },
55
- body: validPhoneNumberBody,
56
- responses: {
57
- 200: validPhoneNumberResponse,
58
- 400: BadRequestError,
59
- 401: UnauthorizedError,
60
- 404: NotFoundError,
61
- 500: InternalError,
62
- },
63
- },
64
- setupPhoneNumber: {
65
- summary: 'Setup phone number',
66
- method: 'POST',
67
- path: '/setup-phone-number',
68
- metadata: {
69
- auth: true,
70
- },
71
- body: setupPhoneNumberBody,
72
- responses: {
73
- 200: setupPhoneNumberResponse,
74
- 400: BadRequestError,
75
- 401: UnauthorizedError,
76
- 404: NotFoundError,
77
- 500: InternalError,
78
- },
79
- },
80
- verifyPhoneNumber: {
81
- summary: 'Verify phone number',
82
- method: 'POST',
83
- path: '/verify-phone-number',
84
- metadata: {
85
- auth: true,
86
- },
87
- body: verifyPhoneNumberBody,
88
- responses: {
89
- 200: verifyPhoneNumberResponse,
90
- 400: BadRequestError,
91
- 401: UnauthorizedError,
92
- 404: NotFoundError,
93
- 500: InternalError,
94
- },
95
- },
96
- sendVerificationCode: {
97
- summary: 'Send verification code',
98
- method: 'POST',
99
- path: '/send-verification-code',
100
- metadata: {
101
- auth: true,
102
- },
103
- body: sendVerificationCodeBody,
104
- responses: {
105
- 200: sendVerificationCodeResponse,
106
- 400: BadRequestError,
107
- 401: UnauthorizedError,
108
- 404: NotFoundError,
109
- 500: InternalError,
110
- },
111
- },
112
- setupTwoFactorAuthenticator: {
113
- summary: 'Setup 2FA',
114
- method: 'GET',
115
- path: '/setup-authenticator',
116
- metadata: {
117
- auth: true,
118
- },
119
- responses: {
120
- 201: setupTwoFactorResponse,
121
- 400: BadRequestError,
122
- 401: UnauthorizedError,
123
- 500: InternalError,
124
- },
125
- },
126
- verifyTwoFactorAuthenticator: {
127
- summary: 'Verify 2FA',
128
- method: 'POST',
129
- path: '/verify-authenticator',
130
- body: verifyTwoFactorBody,
131
- responses: {
132
- 201: verifyTwoFactorResponse,
133
- 400: BadRequestError,
134
- 401: UnauthorizedError,
135
- 500: InternalError,
136
- },
137
- },
138
- sendEmailVerification: {
139
- summary: 'Send email verification code',
140
- method: 'POST',
141
- path: '/send-email-verification',
142
- metadata: {
143
- auth: true,
144
- },
145
- body: sendEmailVerificationBody,
146
- responses: {
147
- 200: sendEmailVerificationResponse,
148
- 400: BadRequestError,
149
- 401: UnauthorizedError,
150
- 429: BadRequestError,
151
- 500: InternalError,
152
- },
153
- },
154
- verifyEmail: {
155
- summary: 'Verify email with code',
156
- method: 'POST',
157
- path: '/verify-email',
158
- metadata: {
159
- auth: true,
160
- },
161
- body: verifyEmailBody,
162
- responses: {
163
- 200: verifyEmailResponse,
164
- 400: BadRequestError,
165
- 401: UnauthorizedError,
166
- 500: InternalError,
167
- },
168
- },
169
- disableTwoFactor: {
170
- summary: '[ADMIN] Disable 2FA for user',
171
- method: 'POST',
172
- path: '/disable-2fa',
173
- metadata: {
174
- auth: true,
175
- },
176
- body: disableTwoFactorBody,
177
- responses: {
178
- 201: UserZod,
179
- 400: BadRequestError,
180
- 401: UnauthorizedError,
181
- 403: ForbiddenError,
182
- 500: InternalError,
183
- },
184
- },
185
- },
186
- {
187
- pathPrefix: 'user-settings',
188
- },
189
- );
@@ -1,200 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- ForbiddenError,
4
- GetMeResponse,
5
- InternalError,
6
- IPaginatedUser,
7
- NotFoundError,
8
- PaginationOptionsZod,
9
- UnauthorizedError,
10
- UserFiltersZod,
11
- UserMeUpdateZod,
12
- UsersIncludeQuery,
13
- UserUpdateZod,
14
- UserWithoutPasswordZod,
15
- UserZod,
16
- UsersSummaryFilterZod,
17
- IPaginatedUsersSummaryResponse,
18
- BadRequestError,
19
- userIdSchema,
20
- UserDeleteResponse,
21
- IssuersActiveStatusUpdateZod,
22
- UpdateLockedStatus,
23
- UpdateUserRoleZod,
24
- } from '../../../common/types';
25
- import { z } from 'zod';
26
-
27
- const c = initContract();
28
-
29
- export const usersContract = c.router(
30
- {
31
- me: {
32
- summary: 'Get current user',
33
- method: 'GET',
34
- path: '/me',
35
- metadata: {
36
- auth: true,
37
- },
38
- responses: {
39
- 200: GetMeResponse,
40
- 401: UnauthorizedError,
41
- 404: NotFoundError,
42
- 500: InternalError,
43
- },
44
- },
45
- updateMe: {
46
- summary: 'Update current user',
47
- method: 'PATCH',
48
- path: '/me',
49
- metadata: {
50
- auth: true,
51
- },
52
- body: UserMeUpdateZod,
53
- responses: {
54
- 201: UserWithoutPasswordZod,
55
- 401: UnauthorizedError,
56
- 404: NotFoundError,
57
- 500: InternalError,
58
- },
59
- },
60
- getUsersSummary: {
61
- summary: 'Get users summary with pagination',
62
- method: 'GET',
63
- path: '/summary',
64
- metadata: {
65
- auth: true,
66
- },
67
- query: PaginationOptionsZod.merge(UsersSummaryFilterZod),
68
- responses: {
69
- 200: IPaginatedUsersSummaryResponse,
70
- 404: NotFoundError,
71
- 401: UnauthorizedError,
72
- 403: ForbiddenError,
73
- 500: InternalError,
74
- },
75
- },
76
- getUsers: {
77
- summary: 'Get users',
78
- method: 'GET',
79
- path: '',
80
- metadata: {
81
- auth: true,
82
- },
83
- query:
84
- PaginationOptionsZod.merge(UserFiltersZod).merge(UsersIncludeQuery),
85
- responses: {
86
- 200: IPaginatedUser,
87
- 401: UnauthorizedError,
88
- 403: ForbiddenError,
89
- },
90
- },
91
- getUser: {
92
- summary: 'Get user by id',
93
- method: 'GET',
94
- path: '/:id',
95
- metadata: {
96
- auth: true,
97
- },
98
- query: z.object({}).merge(UsersIncludeQuery),
99
- pathParams: z.object({
100
- id: z.string(),
101
- }),
102
- responses: {
103
- 200: UserZod,
104
- 401: UnauthorizedError,
105
- 404: NotFoundError,
106
- },
107
- },
108
- updateUser: {
109
- summary: 'Update user by id',
110
- method: 'PATCH',
111
- path: '/admin/:id',
112
- metadata: {
113
- auth: true,
114
- },
115
- pathParams: z.object({
116
- id: z.string(),
117
- }),
118
- body: UserUpdateZod,
119
- responses: {
120
- 200: UserWithoutPasswordZod,
121
- 404: NotFoundError,
122
- 401: UnauthorizedError,
123
- 403: ForbiddenError,
124
- 500: InternalError,
125
- },
126
- },
127
- deleteUser: {
128
- summary: 'Delete user by id',
129
- method: 'DELETE',
130
- path: '/:id',
131
- metadata: {
132
- auth: true,
133
- },
134
- pathParams: z.object({
135
- id: userIdSchema,
136
- }),
137
- responses: {
138
- 200: UserDeleteResponse,
139
- 400: BadRequestError,
140
- 401: UnauthorizedError,
141
- 403: ForbiddenError,
142
- 404: NotFoundError,
143
- 500: InternalError,
144
- },
145
- },
146
- updateActiveStatus: {
147
- summary: '[Admin] Update user active status',
148
- method: 'PATCH',
149
- path: '/active/:id',
150
- metadata: {
151
- auth: true,
152
- },
153
- pathParams: z.object({ id: userIdSchema }),
154
- body: IssuersActiveStatusUpdateZod,
155
- responses: {
156
- 201: z.object({ message: z.string() }),
157
- 401: UnauthorizedError,
158
- 404: NotFoundError,
159
- 500: InternalError,
160
- },
161
- },
162
- updateRole: {
163
- summary:
164
- '[Admin] Update user role for compliance as well as other portals ',
165
- method: 'PATCH',
166
- path: '/role',
167
- metadata: {
168
- auth: true,
169
- },
170
- body: UpdateUserRoleZod,
171
- responses: {
172
- 201: UserWithoutPasswordZod,
173
- 400: BadRequestError,
174
- 401: UnauthorizedError,
175
- 403: ForbiddenError,
176
- 404: NotFoundError,
177
- 500: InternalError,
178
- },
179
- },
180
- updateLockedStatus: {
181
- summary: '[Admin] Update user locked status',
182
- method: 'PATCH',
183
- path: '/:id/locked',
184
- metadata: {
185
- auth: true,
186
- },
187
- pathParams: z.object({ id: userIdSchema }),
188
- body: UpdateLockedStatus,
189
- responses: {
190
- 201: z.object({ message: z.string() }),
191
- 401: UnauthorizedError,
192
- 404: NotFoundError,
193
- 500: InternalError,
194
- },
195
- },
196
- },
197
- {
198
- pathPrefix: 'users',
199
- },
200
- );
@@ -1,41 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import { StripeWebhookEvent } from '../../../common/types/webhook.types';
3
- import { z } from 'zod';
4
-
5
- const c = initContract();
6
-
7
- export const webhooksContract = c.router(
8
- {
9
- postWebHookStripe: {
10
- summary: '[Stripe] webhook',
11
- method: 'POST',
12
- path: '/stripe',
13
- metadata: {
14
- auth: true,
15
- },
16
- body: StripeWebhookEvent, // TODO: remove schema validation instead do it in the service
17
- responses: {
18
- 200: z.object({
19
- received: z.boolean(),
20
- }),
21
- },
22
- },
23
- postWebHookPersona: {
24
- summary: '[Persona] webhook',
25
- method: 'POST',
26
- path: '/persona',
27
- metadata: {
28
- auth: true,
29
- },
30
- body: z.any(), // schema is validated in the service to prevent 400 response to sender
31
- responses: {
32
- 200: z.object({
33
- received: z.boolean(),
34
- }),
35
- },
36
- },
37
- },
38
- {
39
- pathPrefix: 'webhooks',
40
- },
41
- );