@stamhoofd/backend 2.118.1 → 2.120.0

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 (362) hide show
  1. package/package.json +32 -22
  2. package/src/audit-logs/ModelLogger.ts +4 -2
  3. package/src/audit-logs/OrderLogger.ts +1 -1
  4. package/src/boot.ts +32 -14
  5. package/src/crons/balance-emails.ts +4 -2
  6. package/src/crons/clearExcelCache.test.ts +8 -8
  7. package/src/crons/update-cached-balances.ts +40 -14
  8. package/src/debug.ts +3 -2
  9. package/src/decoders/StringArrayDecoder.ts +1 -1
  10. package/src/decoders/StringNullableDecoder.ts +1 -1
  11. package/src/email-recipient-loaders/documents.ts +2 -1
  12. package/src/email-recipient-loaders/members.ts +2 -1
  13. package/src/email-recipient-loaders/orders.ts +2 -1
  14. package/src/email-recipient-loaders/payments.ts +6 -3
  15. package/src/email-recipient-loaders/receivable-balances.ts +2 -1
  16. package/src/email-recipient-loaders/registrations.ts +2 -1
  17. package/src/email-replacements/getEmailReplacementsForPayment.ts +8 -7
  18. package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +7 -6
  19. package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +3 -2
  20. package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +2 -1
  21. package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +4 -3
  22. package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +3 -2
  23. package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +7 -5
  24. package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +12 -10
  25. package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +4 -3
  26. package/src/endpoints/auth/CreateAdminEndpoint.ts +8 -6
  27. package/src/endpoints/auth/CreateTokenEndpoint.ts +14 -12
  28. package/src/endpoints/auth/DeleteTokenEndpoint.ts +2 -1
  29. package/src/endpoints/auth/DeleteUserEndpoint.ts +2 -1
  30. package/src/endpoints/auth/ForgotPasswordEndpoint.ts +5 -4
  31. package/src/endpoints/auth/GetOtherUserEndpoint.ts +3 -2
  32. package/src/endpoints/auth/GetUserEndpoint.ts +3 -2
  33. package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +2 -1
  34. package/src/endpoints/auth/OpenIDConnectCallbackEndpoint.ts +4 -2
  35. package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +3 -2
  36. package/src/endpoints/auth/PatchUserEndpoint.ts +15 -12
  37. package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +3 -2
  38. package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +3 -2
  39. package/src/endpoints/auth/SignupEndpoint.ts +5 -4
  40. package/src/endpoints/auth/VerifyEmailEndpoint.ts +6 -5
  41. package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +3 -2
  42. package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +8 -5
  43. package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +5 -3
  44. package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +8 -5
  45. package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +9 -7
  46. package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +4 -3
  47. package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +4 -2
  48. package/src/endpoints/global/email/CreateEmailEndpoint.ts +9 -7
  49. package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +2 -1
  50. package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +22 -19
  51. package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +6 -4
  52. package/src/endpoints/global/email/GetEmailEndpoint.ts +4 -3
  53. package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +3 -2
  54. package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +7 -4
  55. package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +7 -5
  56. package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +11 -11
  57. package/src/endpoints/global/email/PatchEmailEndpoint.ts +14 -11
  58. package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +3 -2
  59. package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +2 -1
  60. package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +8 -5
  61. package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +7 -5
  62. package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +4 -3
  63. package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +3 -2
  64. package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +9 -6
  65. package/src/endpoints/global/events/GetEventsEndpoint.ts +7 -4
  66. package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +4 -2
  67. package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +17 -15
  68. package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +4 -2
  69. package/src/endpoints/global/events/PatchEventsEndpoint.ts +28 -26
  70. package/src/endpoints/global/files/ExportToExcelEndpoint.ts +8 -5
  71. package/src/endpoints/global/files/GetFileCache.ts +5 -3
  72. package/src/endpoints/global/files/UploadFile.ts +10 -4
  73. package/src/endpoints/global/files/UploadImage.ts +4 -2
  74. package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +4 -2
  75. package/src/endpoints/global/groups/GetGroupsEndpoint.ts +8 -5
  76. package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +7 -5
  77. package/src/endpoints/global/members/GetMembersCountEndpoint.ts +3 -2
  78. package/src/endpoints/global/members/GetMembersEndpoint.test.ts +4 -2
  79. package/src/endpoints/global/members/GetMembersEndpoint.ts +10 -8
  80. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +257 -6
  81. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +162 -107
  82. package/src/endpoints/global/members/helpers/validateGroupFilter.ts +4 -3
  83. package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +3 -2
  84. package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +3 -2
  85. package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +3 -2
  86. package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +8 -7
  87. package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +5 -3
  88. package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +5 -3
  89. package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +8 -5
  90. package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +4 -2
  91. package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +2 -1
  92. package/src/endpoints/global/platform/GetPlatformEndpoint.ts +3 -2
  93. package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +3 -2
  94. package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +7 -4
  95. package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +47 -0
  96. package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +206 -0
  97. package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +3 -2
  98. package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +2 -1
  99. package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +10 -7
  100. package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +4 -2
  101. package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +4 -2
  102. package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +3 -2
  103. package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +2 -1
  104. package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +5 -3
  105. package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +13 -9
  106. package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +50 -49
  107. package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +25 -22
  108. package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -5
  109. package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +9 -7
  110. package/src/endpoints/global/sso/GetSSOEndpoint.ts +4 -2
  111. package/src/endpoints/global/sso/SetSSOEndpoint.ts +3 -2
  112. package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +4 -2
  113. package/src/endpoints/global/webshops/GetWebshopsCountEndpoint.ts +43 -0
  114. package/src/endpoints/global/webshops/GetWebshopsEndpoint.test.ts +808 -0
  115. package/src/endpoints/global/webshops/GetWebshopsEndpoint.ts +221 -0
  116. package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +4 -3
  117. package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +3 -2
  118. package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +6 -4
  119. package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +15 -13
  120. package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +4 -2
  121. package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +4 -2
  122. package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +2 -1
  123. package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +3 -2
  124. package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +3 -2
  125. package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +7 -4
  126. package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +3 -2
  127. package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +7 -4
  128. package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +9 -7
  129. package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +4 -2
  130. package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +7 -5
  131. package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +3 -2
  132. package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +36 -1
  133. package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +13 -4
  134. package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +4 -2
  135. package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +7 -5
  136. package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +3 -2
  137. package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +6 -4
  138. package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +5 -3
  139. package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +4 -2
  140. package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +6 -3
  141. package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +4 -2
  142. package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +2 -1
  143. package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +2 -1
  144. package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +4 -2
  145. package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +3 -2
  146. package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +2 -1
  147. package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +5 -3
  148. package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +22 -19
  149. package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +5 -3
  150. package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +11 -9
  151. package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +8 -7
  152. package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +2 -1
  153. package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +3 -2
  154. package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +7 -5
  155. package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +18 -16
  156. package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +2 -1
  157. package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +3 -2
  158. package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +5 -3
  159. package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +2 -1
  160. package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +8 -5
  161. package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +4 -2
  162. package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +4 -2
  163. package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +32 -29
  164. package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +6 -3
  165. package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +3 -2
  166. package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +3 -2
  167. package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +5 -3
  168. package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +2 -1
  169. package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +5 -3
  170. package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +3 -2
  171. package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +4 -3
  172. package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +4 -3
  173. package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +3 -2
  174. package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +2 -1
  175. package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +6 -4
  176. package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +7 -6
  177. package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +3 -2
  178. package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +4 -2
  179. package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +3 -2
  180. package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +7 -4
  181. package/src/endpoints/organization/dashboard/webshops/{GetWebshopTicketsCountEndpoint → GetWebshopTicketsCountEndpoint.ts} +7 -7
  182. package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +9 -6
  183. package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +4 -2
  184. package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +6 -4
  185. package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +13 -12
  186. package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +4 -2
  187. package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +5 -3
  188. package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +6 -4
  189. package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -1
  190. package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +6 -4
  191. package/src/endpoints/organization/shared/GetDocumentHtml.ts +4 -3
  192. package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +4 -3
  193. package/src/endpoints/organization/shared/GetUitpasNumberDetailsEndpoint.ts +3 -2
  194. package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +3 -2
  195. package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +4 -3
  196. package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +5 -4
  197. package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +4 -3
  198. package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +7 -5
  199. package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +4 -3
  200. package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +7 -3
  201. package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +11 -10
  202. package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +5 -4
  203. package/src/endpoints/system/HealthEndpoint.test.ts +44 -0
  204. package/src/endpoints/system/HealthEndpoint.ts +14 -6
  205. package/src/excel-loaders/balance-items.ts +19 -17
  206. package/src/excel-loaders/event-notifications.ts +15 -13
  207. package/src/excel-loaders/index.ts +1 -0
  208. package/src/excel-loaders/members.ts +45 -43
  209. package/src/excel-loaders/organizations.ts +26 -25
  210. package/src/excel-loaders/payments.ts +44 -42
  211. package/src/excel-loaders/platform-memberships.ts +202 -0
  212. package/src/excel-loaders/receivable-balances.ts +25 -23
  213. package/src/excel-loaders/registrations.ts +30 -28
  214. package/src/helpers/AddressValidator.test.ts +2 -1
  215. package/src/helpers/AddressValidator.ts +13 -10
  216. package/src/helpers/AdminPermissionChecker.ts +193 -95
  217. package/src/helpers/AuthenticatedStructures.ts +13 -11
  218. package/src/helpers/BuckarooHelper.ts +3 -2
  219. package/src/helpers/Context.ts +8 -6
  220. package/src/helpers/CookieHelper.ts +2 -2
  221. package/src/helpers/FileCache.ts +9 -9
  222. package/src/helpers/ForwardHandler.ts +3 -2
  223. package/src/helpers/GlobalHelper.ts +2 -0
  224. package/src/helpers/GroupBuilder.ts +2 -1
  225. package/src/helpers/GroupedThrottledQueue.test.ts +19 -19
  226. package/src/helpers/LimitedFilteredRequestHelper.ts +1 -1
  227. package/src/helpers/MemberCharger.ts +2 -1
  228. package/src/helpers/MemberUserSyncer.ts +6 -3
  229. package/src/helpers/MembershipCharger.ts +2 -2
  230. package/src/helpers/OrganizationCharger.ts +2 -1
  231. package/src/helpers/PeriodHelper.ts +2 -1
  232. package/src/helpers/SQLTranslatedString.ts +3 -2
  233. package/src/helpers/ServiceFeeHelper.ts +1 -1
  234. package/src/helpers/SetupStepUpdater.ts +6 -5
  235. package/src/helpers/StripeHelper.ts +9 -8
  236. package/src/helpers/TagHelper.test.ts +5 -5
  237. package/src/helpers/TagHelper.ts +2 -1
  238. package/src/helpers/TemporaryMemberAccess.ts +2 -1
  239. package/src/helpers/ThrottledQueue.test.ts +20 -20
  240. package/src/helpers/UitpasTokenRepository.ts +7 -7
  241. package/src/helpers/ViesHelper.ts +5 -4
  242. package/src/helpers/XlsxTransformerColumnHelper.ts +21 -19
  243. package/src/helpers/email-html-helpers.ts +13 -12
  244. package/src/helpers/fetchToAsyncIterator.ts +1 -1
  245. package/src/helpers/outstandingBalanceJoin.ts +2 -1
  246. package/src/helpers/updateMemberDetailsUitpasNumber.ts +5 -4
  247. package/src/middleware/ContextMiddleware.ts +1 -1
  248. package/src/migrate.ts +21 -4
  249. package/src/seeds/0000000003-default-email-templates.ts +1 -1
  250. package/src/seeds/0000000004-single-organization.ts +2 -1
  251. package/src/seeds/1752848561-groups-registration-periods.ts +3 -2
  252. package/src/seeds/1754560914-groups-prices.test.ts +2 -1
  253. package/src/seeds/1754560914-groups-prices.ts +2 -1
  254. package/src/seeds/1755790070-fill-email-recipient-errors.ts +6 -6
  255. package/src/seeds/1755876819-remove-duplicate-members.ts +2 -1
  256. package/src/seeds/1765896674-document-update-year.test.ts +2 -1
  257. package/src/seeds/1773754928-force-save-members.ts +15 -0
  258. package/src/services/AuditLogService.ts +3 -2
  259. package/src/services/BalanceItemPaymentService.ts +2 -2
  260. package/src/services/BalanceItemService.ts +2 -1
  261. package/src/services/BootChecksService.test.ts +33 -0
  262. package/src/services/BootChecksService.ts +21 -0
  263. package/src/services/DatabaseCollationService.test.ts +18 -0
  264. package/src/services/DatabaseCollationService.ts +81 -0
  265. package/src/services/DocumentService.ts +1 -1
  266. package/src/services/EventNotificationService.ts +5 -4
  267. package/src/services/FileSignService.ts +2 -2
  268. package/src/services/InvoiceService.ts +3 -3
  269. package/src/services/MemberNumberService.ts +6 -4
  270. package/src/services/MemberRecordStore.ts +28 -19
  271. package/src/services/PaymentReallocationService.test.ts +2 -1
  272. package/src/services/PaymentReallocationService.ts +2 -1
  273. package/src/services/PaymentService.ts +28 -26
  274. package/src/services/RegistrationService.ts +65 -3
  275. package/src/services/SSOService.ts +13 -9
  276. package/src/services/STPackageService.ts +7 -5
  277. package/src/services/StartupHealthService.ts +15 -0
  278. package/src/services/uitpas/PassholderEndpoints.ts +2 -2
  279. package/src/services/uitpas/UitpasService.ts +11 -8
  280. package/src/services/uitpas/cancelTicketSales.ts +1 -1
  281. package/src/services/uitpas/checkPermissionsFor.ts +9 -9
  282. package/src/services/uitpas/getSocialTariffForEvent.ts +4 -4
  283. package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +5 -5
  284. package/src/services/uitpas/handleUitpasResponse.ts +1 -1
  285. package/src/services/uitpas/registerTicketSales.ts +4 -4
  286. package/src/services/uitpas/searchUitpasEvents.ts +3 -3
  287. package/src/services/uitpas/searchUitpasOrganizers.ts +3 -3
  288. package/src/sql-filters/audit-logs.ts +2 -1
  289. package/src/sql-filters/balance-item-payments.ts +2 -1
  290. package/src/sql-filters/balance-items.ts +2 -1
  291. package/src/sql-filters/base-registration-filter-compilers.ts +6 -4
  292. package/src/sql-filters/document-templates.ts +2 -1
  293. package/src/sql-filters/documents.ts +2 -1
  294. package/src/sql-filters/email-recipients.ts +2 -1
  295. package/src/sql-filters/emails.ts +2 -1
  296. package/src/sql-filters/event-notifications.ts +2 -1
  297. package/src/sql-filters/events.ts +2 -1
  298. package/src/sql-filters/groups.ts +2 -1
  299. package/src/sql-filters/invoiced-balance-items.ts +2 -1
  300. package/src/sql-filters/invoices.ts +2 -1
  301. package/src/sql-filters/member-responsibility-records.ts +2 -1
  302. package/src/sql-filters/members.ts +8 -7
  303. package/src/sql-filters/orders.ts +3 -2
  304. package/src/sql-filters/organization-registration-periods.ts +2 -1
  305. package/src/sql-filters/organizations.ts +2 -1
  306. package/src/sql-filters/payments.ts +2 -1
  307. package/src/sql-filters/platform-memberships.ts +67 -0
  308. package/src/sql-filters/receivable-balances.ts +2 -1
  309. package/src/sql-filters/registration-periods.ts +2 -1
  310. package/src/sql-filters/registrations.ts +2 -1
  311. package/src/sql-filters/tickets.ts +2 -1
  312. package/src/sql-filters/users.ts +2 -1
  313. package/src/sql-filters/webshops.ts +38 -0
  314. package/src/sql-sorters/audit-logs.ts +3 -2
  315. package/src/sql-sorters/balance-items.ts +3 -2
  316. package/src/sql-sorters/document-templates.ts +3 -2
  317. package/src/sql-sorters/documents.ts +3 -2
  318. package/src/sql-sorters/email-recipients.ts +3 -2
  319. package/src/sql-sorters/emails.ts +3 -2
  320. package/src/sql-sorters/event-notifications.ts +3 -2
  321. package/src/sql-sorters/events.ts +3 -2
  322. package/src/sql-sorters/groups.ts +3 -2
  323. package/src/sql-sorters/invoices.ts +3 -2
  324. package/src/sql-sorters/members.ts +3 -2
  325. package/src/sql-sorters/orders.ts +3 -2
  326. package/src/sql-sorters/organization-registration-periods.ts +3 -2
  327. package/src/sql-sorters/organizations.ts +3 -2
  328. package/src/sql-sorters/payments.ts +3 -2
  329. package/src/sql-sorters/platform-memberships.ts +40 -0
  330. package/src/sql-sorters/receivable-balances.ts +3 -2
  331. package/src/sql-sorters/registration-periods.ts +3 -2
  332. package/src/sql-sorters/registrations.ts +3 -2
  333. package/src/sql-sorters/tickets.ts +3 -2
  334. package/src/sql-sorters/webshops.ts +40 -0
  335. package/tests/actions/patchOrganizationMember.ts +5 -4
  336. package/tests/actions/patchPaymentStatus.ts +2 -2
  337. package/tests/actions/patchUserMember.ts +6 -4
  338. package/tests/e2e/api-rate-limits.test.ts +4 -5
  339. package/tests/e2e/bundle-discounts.test.ts +3 -2
  340. package/tests/e2e/charge-members.test.ts +7 -5
  341. package/tests/e2e/documents.test.ts +3 -2
  342. package/tests/e2e/private-files.test.ts +11 -13
  343. package/tests/e2e/register.test.ts +6 -5
  344. package/tests/e2e/stock.test.ts +6 -8
  345. package/tests/e2e/tickets.test.ts +4 -2
  346. package/tests/helpers/StripeMocker.ts +3 -3
  347. package/tests/init/initAdmin.ts +4 -2
  348. package/tests/init/initBundleDiscount.ts +3 -2
  349. package/tests/init/initPayconiq.ts +1 -1
  350. package/tests/init/initPermissionRole.ts +4 -2
  351. package/tests/init/initPlatformRecordCategory.ts +1 -1
  352. package/tests/init/initStripe.ts +1 -1
  353. package/tests/vitest.global.setup.ts +26 -0
  354. package/tests/{jest.setup.ts → vitest.setup.ts} +4 -3
  355. package/tsconfig.build.json +17 -0
  356. package/tsconfig.json +10 -41
  357. package/tsconfig.test.json +17 -0
  358. package/vitest.config.js +13 -0
  359. package/eslint.config.mjs +0 -5
  360. package/jest.config.cjs +0 -27
  361. package/tests/jest.global.setup.ts +0 -33
  362. package/tests/toMatchMap.ts +0 -68
@@ -1,7 +1,9 @@
1
- import { Decoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder } from '@simonbackx/simple-encoding';
2
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
3
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
4
  import { SimpleError } from '@simonbackx/simple-errors';
4
- import { BalanceItem, Organization, Platform, STPackage } from '@stamhoofd/models';
5
+ import type { BalanceItem} from '@stamhoofd/models';
6
+ import { Organization, Platform, STPackage } from '@stamhoofd/models';
5
7
  import { CheckoutResponse, PackageCheckout, Payment as PaymentStruct, STPackageBundleHelper, STPackageStruct } from '@stamhoofd/structures';
6
8
  import { Context } from '../../../helpers/Context.js';
7
9
  import { PaymentService } from '../../../services/PaymentService.js';
@@ -16,7 +18,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
16
18
  bodyDecoder = PackageCheckout as Decoder<Body>;
17
19
 
18
20
  protected doesMatch(request: Request): [true, Params] | [false] {
19
- if (request.method != 'POST') {
21
+ if (request.method !== 'POST') {
20
22
  return [false];
21
23
  }
22
24
 
@@ -48,7 +50,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
48
50
  if (!foundCompany) {
49
51
  throw new SimpleError({
50
52
  code: 'invalid_data',
51
- message: $t(`0ab71307-8f4f-4701-b120-b552a1b6bdd0`),
53
+ message: $t(`%w1`),
52
54
  });
53
55
  }
54
56
  }
@@ -100,7 +102,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
100
102
  throw new SimpleError({
101
103
  code: 'not_found',
102
104
  message: 'Package not found',
103
- human: $t('0e5baf7f-89be-4665-a3dd-b1603b5a6627'),
105
+ human: $t('%1L1'),
104
106
  });
105
107
  }
106
108
 
@@ -181,7 +183,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
181
183
  throw new SimpleError({
182
184
  code: 'missing_data',
183
185
  message: 'Checkout was empty',
184
- human: $t('c5cf0531-9751-4be0-be0c-31ccfac1722d'),
186
+ human: $t('%1L2'),
185
187
  });
186
188
  }
187
189
 
@@ -1,4 +1,5 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
2
3
  import { SimpleError } from '@simonbackx/simple-errors';
3
4
  import { STPackage } from '@stamhoofd/models';
4
5
 
@@ -39,7 +40,7 @@ export class DeactivatePackageEndpoint extends Endpoint<Params, Query, Body, Res
39
40
  throw new SimpleError({
40
41
  code: 'not_found',
41
42
  message: 'Package not found',
42
- human: $t('c6adb3c8-c494-4f2a-8287-6bcac853a88a'),
43
+ human: $t('%1L3'),
43
44
  statusCode: 404,
44
45
  });
45
46
  }
@@ -48,7 +49,7 @@ export class DeactivatePackageEndpoint extends Endpoint<Params, Query, Body, Res
48
49
  throw new SimpleError({
49
50
  code: 'not_allowed',
50
51
  message: "Can't deactivate this package",
51
- human: $t('242cee92-c0ea-4736-a8c8-6d82c8faf342'),
52
+ human: $t('%1L4'),
52
53
  });
53
54
  }
54
55
 
@@ -1,5 +1,7 @@
1
- import { AutoEncoder, Decoder, field, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder} from '@simonbackx/simple-encoding';
2
+ import { AutoEncoder, field, StringDecoder } from '@simonbackx/simple-encoding';
3
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
4
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
5
  import { SimpleError } from '@simonbackx/simple-errors';
4
6
  import { Organization, Webshop } from '@stamhoofd/models';
5
7
  type Params = Record<string, never>;
@@ -1,7 +1,9 @@
1
- import { Decoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder } from '@simonbackx/simple-encoding';
2
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
3
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
4
  import { Email, Platform, RateLimiter } from '@stamhoofd/models';
4
- import { EmailPreview, EmailStatus, Email as EmailStruct, EmailTemplate as EmailTemplateStruct } from '@stamhoofd/structures';
5
+ import type { EmailPreview} from '@stamhoofd/structures';
6
+ import { EmailStatus, Email as EmailStruct, EmailTemplate as EmailTemplateStruct } from '@stamhoofd/structures';
5
7
 
6
8
  import { Context } from '../../../helpers/Context.js';
7
9
  import { SimpleError } from '@simonbackx/simple-errors';
@@ -68,7 +70,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
68
70
  if (!await Context.auth.canSendEmails(organization)) {
69
71
  throw Context.auth.error({
70
72
  message: 'Cannot send emails',
71
- human: $t('f7b7ac75-f7df-49cc-8961-b2478d9683e3'),
73
+ human: $t('%1Cv'),
72
74
  });
73
75
  }
74
76
 
@@ -98,7 +100,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
98
100
  if (!await Context.auth.canSendEmailsFrom(organization, sender.id)) {
99
101
  throw Context.auth.error({
100
102
  message: 'Cannot send emails from this sender',
101
- human: $t('1b509614-30b0-484c-af72-57d4bc9ea788'),
103
+ human: $t('%1Cw'),
102
104
  });
103
105
  }
104
106
  model.senderId = sender.id;
@@ -110,7 +112,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
110
112
  throw new SimpleError({
111
113
  code: 'invalid_sender',
112
114
  message: 'Sender not found',
113
- human: $t(`94adb4e0-2ef1-4ee8-9f02-5a76efa51c1d`),
115
+ human: $t(`%1Cx`),
114
116
  statusCode: 400,
115
117
  });
116
118
  }
@@ -134,7 +136,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
134
136
  if (!await Context.auth.canSendEmail(model)) {
135
137
  throw Context.auth.error({
136
138
  message: 'Cannot send emails from this sender',
137
- human: $t('1b509614-30b0-484c-af72-57d4bc9ea788'),
139
+ human: $t('%1Cw'),
138
140
  });
139
141
  }
140
142
  await model.queueForSending();
@@ -1,5 +1,6 @@
1
1
  import { Request } from '@simonbackx/simple-endpoints';
2
- import { Email, EmailRecipient, MemberFactory, Organization, OrganizationFactory, RegistrationPeriod, RegistrationPeriodFactory, Token, User, UserFactory } from '@stamhoofd/models';
2
+ import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
3
+ import { Email, EmailRecipient, MemberFactory, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
3
4
  import { EmailStatus, LimitedFilteredRequest, PermissionLevel, Permissions, Replacement } from '@stamhoofd/structures';
4
5
  import { TestUtils } from '@stamhoofd/test-utils';
5
6
  import { testServer } from '../../../../tests/helpers/TestServer.js';
@@ -1,10 +1,13 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
2
- import { assertSort, CountFilteredRequest, EmailPreview, EmailStatus, getSortFilter, LimitedFilteredRequest, mergeFilters, PaginatedResponse, PermissionLevel, StamhoofdFilter } from '@stamhoofd/structures';
1
+ import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
+ import type { CountFilteredRequest, EmailPreview, StamhoofdFilter } from '@stamhoofd/structures';
4
+ import { assertSort, EmailStatus, getSortFilter, LimitedFilteredRequest, mergeFilters, PaginatedResponse, PermissionLevel } from '@stamhoofd/structures';
3
5
 
4
- import { Decoder } from '@simonbackx/simple-encoding';
6
+ import type { Decoder } from '@simonbackx/simple-encoding';
5
7
  import { SimpleError } from '@simonbackx/simple-errors';
6
8
  import { Email, Platform } from '@stamhoofd/models';
7
- import { applySQLSorter, compileToSQLFilter, SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
9
+ import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
10
+ import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
8
11
  import { Context } from '../../../helpers/Context.js';
9
12
  import { emailFilterCompilers } from '../../../sql-filters/emails.js';
10
13
  import { emailSorters } from '../../../sql-sorters/emails.js';
@@ -58,24 +61,24 @@ export class GetAdminEmailsEndpoint extends Endpoint<Params, Query, Body, Respon
58
61
  ids.push(sender.id);
59
62
  }
60
63
  }
61
- if (ids.length === 0) {
62
- throw Context.auth.error();
63
- }
64
64
 
65
- scopeFilter = mergeFilters([scopeFilter, {
66
- $or: [
67
- {
68
- senderId: {
69
- $in: ids,
70
- },
71
- status: {
72
- $neq: EmailStatus.Draft,
73
- },
65
+ const filters: StamhoofdFilter[] = [{
66
+ userId: user.id,
67
+ }];
68
+
69
+ if (ids.length !== 0) {
70
+ filters.push({
71
+ senderId: {
72
+ $in: ids,
74
73
  },
75
- {
76
- userId: user.id,
74
+ status: {
75
+ $neq: EmailStatus.Draft,
77
76
  },
78
- ],
77
+ });
78
+ }
79
+
80
+ scopeFilter = mergeFilters([scopeFilter, {
81
+ $or: filters,
79
82
  }]);
80
83
  }
81
84
  else {
@@ -1,5 +1,7 @@
1
- import { AutoEncoder, Decoder, field, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder} from '@simonbackx/simple-encoding';
2
+ import { AutoEncoder, field, StringDecoder } from '@simonbackx/simple-encoding';
3
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
4
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
5
  import { SimpleError } from '@simonbackx/simple-errors';
4
6
  import { EmailAddress } from '@stamhoofd/email';
5
7
  import { Organization } from '@stamhoofd/models';
@@ -53,7 +55,7 @@ export class GetEmailAddressEndpoint extends Endpoint<Params, Query, Body, Respo
53
55
  throw new SimpleError({
54
56
  code: 'invalid_fields',
55
57
  message: 'Invalid token or id',
56
- human: $t(`ceacb5a8-7777-4366-abcb-9dd90ffb832e`),
58
+ human: $t(`%DQ`),
57
59
  });
58
60
  }
59
61
 
@@ -95,7 +97,7 @@ export class GetEmailAddressEndpoint extends Endpoint<Params, Query, Body, Respo
95
97
  throw new SimpleError({
96
98
  code: 'not_found',
97
99
  message: 'Email not found',
98
- human: $t(`9ddb6616-f62d-4c91-82a9-e5cf398e4c4a`),
100
+ human: $t(`%DR`),
99
101
  statusCode: 404,
100
102
  });
101
103
  }
@@ -1,6 +1,7 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
2
3
  import { Email } from '@stamhoofd/models';
3
- import { EmailPreview } from '@stamhoofd/structures';
4
+ import type { EmailPreview } from '@stamhoofd/structures';
4
5
 
5
6
  import { SimpleError } from '@simonbackx/simple-errors';
6
7
  import { Context } from '../../../helpers/Context.js';
@@ -41,7 +42,7 @@ export class GetEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBody
41
42
  throw new SimpleError({
42
43
  code: 'not_found',
43
44
  message: 'Email not found',
44
- human: $t(`9ddb6616-f62d-4c91-82a9-e5cf398e4c4a`),
45
+ human: $t(`%DR`),
45
46
  statusCode: 404,
46
47
  });
47
48
  }
@@ -1,5 +1,6 @@
1
1
  import { Request } from '@simonbackx/simple-endpoints';
2
- import { Email, EmailRecipient, MemberFactory, Organization, OrganizationFactory, RegistrationPeriod, RegistrationPeriodFactory, Token, User, UserFactory } from '@stamhoofd/models';
2
+ import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
3
+ import { Email, EmailRecipient, MemberFactory, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
3
4
  import { EmailStatus, LimitedFilteredRequest, Replacement } from '@stamhoofd/structures';
4
5
  import { TestUtils } from '@stamhoofd/test-utils';
5
6
  import { testServer } from '../../../../tests/helpers/TestServer.js';
@@ -548,7 +549,7 @@ describe('Endpoint.GetUserEmails', () => {
548
549
  // Check balanceTable replacement
549
550
  const balanceTableReplacement = recipient.replacements.find(r => r.token === 'balanceTable');
550
551
  expect(balanceTableReplacement).toBeDefined();
551
- expect(balanceTableReplacement!.html).toBe('<p class="description">' + $t('4c4f6571-f7b5-469d-a16f-b1547b43a610') + '</p>');
552
+ expect(balanceTableReplacement!.html).toBe('<p class="description">' + $t('%hX') + '</p>');
552
553
  });
553
554
 
554
555
  test('Should return one recipient for each member the user is associated with, if the email is different for each member', async () => {
@@ -1,10 +1,13 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
2
- import { assertSort, CountFilteredRequest, EmailWithRecipients, EmailStatus, getSortFilter, LimitedFilteredRequest, mergeFilters, PaginatedResponse, StamhoofdFilter } from '@stamhoofd/structures';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
+ import type { CountFilteredRequest, EmailWithRecipients, StamhoofdFilter } from '@stamhoofd/structures';
4
+ import { assertSort, EmailStatus, getSortFilter, LimitedFilteredRequest, mergeFilters, PaginatedResponse } from '@stamhoofd/structures';
3
5
 
4
- import { Decoder } from '@simonbackx/simple-encoding';
6
+ import type { Decoder } from '@simonbackx/simple-encoding';
5
7
  import { SimpleError } from '@simonbackx/simple-errors';
6
8
  import { Email, Member } from '@stamhoofd/models';
7
- import { applySQLSorter, compileToSQLFilter, SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
9
+ import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
10
+ import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
8
11
  import { Context } from '../../../helpers/Context.js';
9
12
  import { emailFilterCompilers, userEmailFilterCompilers } from '../../../sql-filters/emails.js';
10
13
  import { emailSorters } from '../../../sql-sorters/emails.js';
@@ -1,5 +1,7 @@
1
- import { AutoEncoder, BooleanDecoder, Decoder, field, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder} from '@simonbackx/simple-encoding';
2
+ import { AutoEncoder, BooleanDecoder, field, StringDecoder } from '@simonbackx/simple-encoding';
3
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
4
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
5
  import { SimpleError } from '@simonbackx/simple-errors';
4
6
  import { Email, EmailAddress } from '@stamhoofd/email';
5
7
  import { Context } from '../../../helpers/Context.js';
@@ -81,7 +83,7 @@ export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, Re
81
83
  throw new SimpleError({
82
84
  code: 'invalid_fields',
83
85
  message: 'Invalid token or id',
84
- human: $t(`ceacb5a8-7777-4366-abcb-9dd90ffb832e`),
86
+ human: $t(`%DQ`),
85
87
  });
86
88
  }
87
89
 
@@ -120,7 +122,7 @@ export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, Re
120
122
  throw new SimpleError({
121
123
  code: 'not_found',
122
124
  message: 'Email not found',
123
- human: $t(`9ddb6616-f62d-4c91-82a9-e5cf398e4c4a`),
125
+ human: $t(`%DR`),
124
126
  statusCode: 404,
125
127
  });
126
128
  }
@@ -155,7 +157,7 @@ export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, Re
155
157
  throw new SimpleError({
156
158
  code: 'too_many_unblocks',
157
159
  message: 'Too many unblocks',
158
- human: $t(`ed5bd32c-7d9a-42d8-b9d0-da74d82ef3a9`),
160
+ human: $t(`%1L5`),
159
161
  });
160
162
  }
161
163
  }
@@ -1,7 +1,7 @@
1
- /* eslint-disable jest/no-conditional-expect */
2
- import { AutoEncoderPatchType } from '@simonbackx/simple-encoding';
1
+ import type { AutoEncoderPatchType } from '@simonbackx/simple-encoding';
3
2
  import { Request } from '@simonbackx/simple-endpoints';
4
- import { Email, EmailRecipient, GroupFactory, MemberFactory, Organization, OrganizationFactory, RegistrationFactory, RegistrationPeriod, RegistrationPeriodFactory, Token, User, UserFactory } from '@stamhoofd/models';
3
+ import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
4
+ import { Email, EmailRecipient, GroupFactory, MemberFactory, OrganizationFactory, RegistrationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
5
5
  import { AccessRight, EmailRecipientFilter, EmailRecipientFilterType, EmailRecipientSubfilter, EmailStatus, Email as EmailStruct, OrganizationEmail, Parent, PermissionLevel, Permissions, PermissionsResourceType, ResourcePermissions, UserPermissions, Version } from '@stamhoofd/structures';
6
6
  import { STExpect, TestUtils } from '@stamhoofd/test-utils';
7
7
  import { testServer } from '../../../../tests/helpers/TestServer.js';
@@ -146,7 +146,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
146
146
  senderId: 'invalid-sender-id',
147
147
  });
148
148
 
149
- await expect(async () => await patchEmail(body, token, organization))
149
+ await expect(patchEmail(body, token, organization))
150
150
  .rejects
151
151
  .toThrow(STExpect.errorWithCode('invalid_sender'));
152
152
  });
@@ -197,7 +197,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
197
197
  subject: 'new subject',
198
198
  });
199
199
 
200
- await expect(async () => await patchEmail(body, token, organization))
200
+ await expect(patchEmail(body, token, organization))
201
201
  .rejects
202
202
  .toThrow(STExpect.errorWithCode('permission_denied'));
203
203
  });
@@ -249,7 +249,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
249
249
  subject: 'new subject',
250
250
  });
251
251
 
252
- await expect(async () => await patchEmail(body, token, organization))
252
+ await expect(patchEmail(body, token, organization))
253
253
  .rejects
254
254
  .toThrow(STExpect.errorWithCode('permission_denied'));
255
255
  });
@@ -350,7 +350,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
350
350
  senderId: sender2.id,
351
351
  });
352
352
 
353
- await expect(async () => await patchEmail(body, token, organization))
353
+ await expect(patchEmail(body, token, organization))
354
354
  .rejects
355
355
  .toThrow(STExpect.errorWithCode('permission_denied'));
356
356
  });
@@ -402,7 +402,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
402
402
  status: EmailStatus.Sending,
403
403
  });
404
404
 
405
- await expect(async () => await patchEmail(body, token, organization))
405
+ await expect(patchEmail(body, token, organization))
406
406
  .rejects
407
407
  .toThrow(STExpect.errorWithCode('permission_denied'));
408
408
  });
@@ -448,7 +448,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
448
448
 
449
449
  const body = EmailStruct.patch({ id: email.id, senderId: sender.id, status: EmailStatus.Sending });
450
450
 
451
- await expect(async () => await patchEmail(body, token, organization))
451
+ await expect(patchEmail(body, token, organization))
452
452
  .rejects
453
453
  .toThrow(STExpect.errorWithCode('missing_unsubscribe_button'));
454
454
  });
@@ -494,7 +494,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
494
494
 
495
495
  const body = EmailStruct.patch({ id: email.id, senderId: sender.id, status: EmailStatus.Sending });
496
496
 
497
- await expect(async () => await patchEmail(body, token, organization))
497
+ await expect(patchEmail(body, token, organization))
498
498
  .rejects
499
499
  .toThrow(STExpect.errorWithCode('missing_unsubscribe_button'));
500
500
  });
@@ -707,7 +707,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
707
707
 
708
708
  const balanceTable = recipient.replacements.find(r => r.token === 'balanceTable');
709
709
  expect(balanceTable).toBeDefined();
710
- expect(balanceTable?.html).toInclude($t('4c4f6571-f7b5-469d-a16f-b1547b43a610'));
710
+ expect(balanceTable?.html).toMatch($t('%hX'));
711
711
 
712
712
  // Outstanding balance
713
713
  const outstandingBalance = recipient.replacements.find(r => r.token === 'outstandingBalance');
@@ -1,8 +1,11 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
2
3
  import { Email, Platform } from '@stamhoofd/models';
3
- import { EmailPreview, EmailRecipientsStatus, EmailStatus, Email as EmailStruct, PermissionLevel } from '@stamhoofd/structures';
4
+ import type { EmailPreview} from '@stamhoofd/structures';
5
+ import { EmailRecipientsStatus, EmailStatus, Email as EmailStruct, PermissionLevel } from '@stamhoofd/structures';
4
6
 
5
- import { AutoEncoderPatchType, Decoder, patchObject } from '@simonbackx/simple-encoding';
7
+ import type { AutoEncoderPatchType, Decoder} from '@simonbackx/simple-encoding';
8
+ import { patchObject } from '@simonbackx/simple-encoding';
6
9
  import { SimpleError } from '@simonbackx/simple-errors';
7
10
  import { Context } from '../../../helpers/Context.js';
8
11
 
@@ -41,7 +44,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
41
44
  throw new SimpleError({
42
45
  code: 'not_found',
43
46
  message: 'Email not found',
44
- human: $t(`9ddb6616-f62d-4c91-82a9-e5cf398e4c4a`),
47
+ human: $t(`%DR`),
45
48
  statusCode: 404,
46
49
  });
47
50
  }
@@ -63,7 +66,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
63
66
  if (!await Context.auth.canSendEmailsFrom(organization, sender.id)) {
64
67
  throw Context.auth.error({
65
68
  message: 'Cannot send emails from this sender',
66
- human: $t('1b509614-30b0-484c-af72-57d4bc9ea788'),
69
+ human: $t('%1Cw'),
67
70
  });
68
71
  }
69
72
  model.senderId = sender.id;
@@ -79,7 +82,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
79
82
  throw new SimpleError({
80
83
  code: 'invalid_sender',
81
84
  message: 'Sender not found',
82
- human: $t(`94adb4e0-2ef1-4ee8-9f02-5a76efa51c1d`),
85
+ human: $t(`%1Cx`),
83
86
  statusCode: 400,
84
87
  });
85
88
  }
@@ -96,7 +99,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
96
99
  throw new SimpleError({
97
100
  code: 'invalid_sender',
98
101
  message: 'Sender not found',
99
- human: $t(`f08cccb3-faf9-473f-b729-16120fadec9c`),
102
+ human: $t(`%1Cy`),
100
103
  statusCode: 400,
101
104
  });
102
105
  }
@@ -119,7 +122,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
119
122
  throw new SimpleError({
120
123
  code: 'not_draft',
121
124
  message: 'Email is not a draft',
122
- human: $t(`ace4d2e8-88d6-479f-bd8b-d576cc0ed1f2`),
125
+ human: $t(`%1Dy`),
123
126
  statusCode: 400,
124
127
  });
125
128
  }
@@ -128,7 +131,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
128
131
  throw new SimpleError({
129
132
  code: 'already_created',
130
133
  message: 'Recipients already created',
131
- human: $t(`457ecdaf-d1de-4136-9e82-682c18c5fa76`),
134
+ human: $t(`%1Ko`),
132
135
  statusCode: 400,
133
136
  });
134
137
  }
@@ -142,7 +145,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
142
145
  throw new SimpleError({
143
146
  code: 'not_draft',
144
147
  message: 'Email is not a draft',
145
- human: $t(`02b05c0d-908b-4200-8fb8-5fc01f539514`),
148
+ human: $t(`%1Dz`),
146
149
  statusCode: 400,
147
150
  });
148
151
  }
@@ -184,7 +187,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
184
187
  if (!await Context.auth.canSendEmail(model)) {
185
188
  throw Context.auth.error({
186
189
  message: 'Cannot send emails from this sender',
187
- human: $t('1b509614-30b0-484c-af72-57d4bc9ea788'),
190
+ human: $t('%1Cw'),
188
191
  });
189
192
  }
190
193
 
@@ -1,5 +1,6 @@
1
- import { Decoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder } from '@simonbackx/simple-encoding';
2
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
3
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
4
  import { CountFilteredRequest, CountResponse } from '@stamhoofd/structures';
4
5
 
5
6
  import { Context } from '../../../helpers/Context.js';
@@ -1,7 +1,8 @@
1
1
  import { STExpect, TestUtils } from '@stamhoofd/test-utils';
2
2
  import { GetEmailRecipientsEndpoint } from './GetEmailRecipientsEndpoint.js';
3
3
  import { AccessRight, EmailStatus, LimitedFilteredRequest, OrganizationEmail, PermissionLevel, Permissions, PermissionsResourceType, ResourcePermissions } from '@stamhoofd/structures';
4
- import { Email, EmailRecipient, Organization, OrganizationFactory, RegistrationPeriod, RegistrationPeriodFactory, Token, User, UserFactory } from '@stamhoofd/models';
4
+ import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
5
+ import { Email, EmailRecipient, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
5
6
  import { Request } from '@simonbackx/simple-endpoints';
6
7
  import { testServer } from '../../../../tests/helpers/TestServer.js';
7
8
 
@@ -1,10 +1,13 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
2
- import { assertSort, CountFilteredRequest, EmailRecipient as EmailRecipientStruct, getSortFilter, LimitedFilteredRequest, PaginatedResponse, PermissionLevel, StamhoofdFilter } from '@stamhoofd/structures';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
+ import type { CountFilteredRequest, EmailRecipient as EmailRecipientStruct, StamhoofdFilter } from '@stamhoofd/structures';
4
+ import { assertSort, getSortFilter, LimitedFilteredRequest, PaginatedResponse, PermissionLevel } from '@stamhoofd/structures';
3
5
 
4
- import { Decoder } from '@simonbackx/simple-encoding';
6
+ import type { Decoder } from '@simonbackx/simple-encoding';
5
7
  import { SimpleError } from '@simonbackx/simple-errors';
6
8
  import { EmailRecipient, fillRecipientReplacements } from '@stamhoofd/models';
7
- import { applySQLSorter, compileToSQLFilter, SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
9
+ import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
10
+ import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
8
11
  import { Context } from '../../../helpers/Context.js';
9
12
  import { emailRecipientsFilterCompilers } from '../../../sql-filters/email-recipients.js';
10
13
  import { emailRecipientSorters } from '../../../sql-sorters/email-recipients.js';
@@ -50,7 +53,7 @@ export class GetEmailRecipientsEndpoint extends Endpoint<Params, Query, Body, Re
50
53
  if (!await validateEmailRecipientFilter({ filter: q.filter, permissionLevel: PermissionLevel.Read })) {
51
54
  throw Context.auth.error({
52
55
  message: 'You do not have sufficient permissions to view all email recipients',
53
- human: $t(`d499972f-270c-44f6-ad7e-9d5359aef609`),
56
+ human: $t(`%1E0`),
54
57
  });
55
58
  }
56
59
  }
@@ -1,6 +1,8 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
2
3
  import { Email, EmailRecipient } from '@stamhoofd/models';
3
- import { EmailRecipient as EmailRecipientStruct, EmailStatus, PermissionLevel } from '@stamhoofd/structures';
4
+ import type { EmailRecipient as EmailRecipientStruct} from '@stamhoofd/structures';
5
+ import { EmailStatus, PermissionLevel } from '@stamhoofd/structures';
4
6
 
5
7
  import { SimpleError } from '@simonbackx/simple-errors';
6
8
  import { Context } from '../../../helpers/Context.js';
@@ -37,7 +39,7 @@ export class RetryEmailRecipientEndpoint extends Endpoint<Params, Query, Body, R
37
39
  throw new SimpleError({
38
40
  code: 'not_found',
39
41
  message: 'Email recipient not found',
40
- human: $t(`2e79bf4a-878b-43b0-902b-9d080c8b7fdf`),
42
+ human: $t(`%1GZ`),
41
43
  statusCode: 404,
42
44
  });
43
45
  }
@@ -47,7 +49,7 @@ export class RetryEmailRecipientEndpoint extends Endpoint<Params, Query, Body, R
47
49
  throw new SimpleError({
48
50
  code: 'not_found',
49
51
  message: 'Email not found',
50
- human: $t(`9ddb6616-f62d-4c91-82a9-e5cf398e4c4a`),
52
+ human: $t(`%DR`),
51
53
  statusCode: 404,
52
54
  });
53
55
  }
@@ -68,7 +70,7 @@ export class RetryEmailRecipientEndpoint extends Endpoint<Params, Query, Body, R
68
70
  throw new SimpleError({
69
71
  code: 'already_sent',
70
72
  message: 'Cant retry email recipient that is already sent',
71
- human: $t(`f3f837eb-d6f7-4c6e-9477-d566a03e09b1`),
73
+ human: $t(`%1Ga`),
72
74
  statusCode: 400,
73
75
  });
74
76
  }
@@ -1,6 +1,7 @@
1
1
  import { SimpleError } from '@simonbackx/simple-errors';
2
2
  import { Email } from '@stamhoofd/models';
3
- import { FilterWrapperMarker, PermissionLevel, StamhoofdFilter, unwrapFilter, WrapperFilter } from '@stamhoofd/structures';
3
+ import type { PermissionLevel, StamhoofdFilter, WrapperFilter } from '@stamhoofd/structures';
4
+ import { FilterWrapperMarker, unwrapFilter } from '@stamhoofd/structures';
4
5
  import { Context } from '../../../../helpers/Context.js';
5
6
 
6
7
  export async function validateEmailRecipientFilter({ filter, permissionLevel }: { filter: StamhoofdFilter; permissionLevel: PermissionLevel }) {
@@ -42,7 +43,7 @@ export async function validateEmailRecipientFilter({ filter, permissionLevel }:
42
43
  code: 'invalid_field',
43
44
  field: 'filter',
44
45
  message: 'You must filter on an email id of the email recipients you are trying to access',
45
- human: $t(`9f352fd4-5e4d-4899-81ce-b69889ebfe9d`),
46
+ human: $t(`%1E1`),
46
47
  });
47
48
  }
48
49
 
@@ -72,7 +73,7 @@ export async function validateEmailRecipientFilter({ filter, permissionLevel }:
72
73
  if (!await Context.auth.canAccessEmail(email, permissionLevel)) {
73
74
  throw Context.auth.error({
74
75
  message: 'You do not have access to this email',
75
- human: $t(`590a37ed-0f3a-4c66-8e20-08ac00ae761d`),
76
+ human: $t(`%1E2`),
76
77
  });
77
78
  }
78
79
  }
@@ -1,5 +1,6 @@
1
- import { Decoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Decoder } from '@simonbackx/simple-encoding';
2
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
3
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
4
  import { CountFilteredRequest, CountResponse } from '@stamhoofd/structures';
4
5
 
5
6
  import { Context } from '../../../helpers/Context.js';