@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
@@ -0,0 +1,221 @@
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';
4
+ import { SimpleError } from '@simonbackx/simple-errors';
5
+ import { Organization, Webshop } from '@stamhoofd/models';
6
+ import { SQL, applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
7
+ import type { CountFilteredRequest, StamhoofdFilter } from '@stamhoofd/structures';
8
+ import { LimitedFilteredRequest, PaginatedResponse, PermissionLevel, WebshopWithOrganization, assertSort, getSortFilter } from '@stamhoofd/structures';
9
+
10
+ import type { SQLResultNamespacedRow } from '@simonbackx/simple-database';
11
+ import { Formatter } from '@stamhoofd/utility';
12
+ import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures.js';
13
+ import { Context } from '../../../helpers/Context.js';
14
+ import { organizationFilterCompilers } from '../../../sql-filters/organizations.js';
15
+ import { webshopFilterCompilers } from '../../../sql-filters/webshops.js';
16
+ import { webshopSorters } from '../../../sql-sorters/webshops.js';
17
+
18
+ type Params = Record<string, never>;
19
+ type Query = LimitedFilteredRequest;
20
+ type Body = undefined;
21
+ type ResponseBody = PaginatedResponse<WebshopWithOrganization[], LimitedFilteredRequest>;
22
+
23
+ const sorters = webshopSorters;
24
+ const filterCompilers = webshopFilterCompilers;
25
+
26
+ export class GetWebshopsEndpoint extends Endpoint<Params, Query, Body, ResponseBody> {
27
+ queryDecoder = LimitedFilteredRequest as Decoder<LimitedFilteredRequest>;
28
+
29
+ protected doesMatch(request: Request): [true, Params] | [false] {
30
+ if (request.method !== 'GET') {
31
+ return [false];
32
+ }
33
+
34
+ const params = Endpoint.parseParameters(request.url, '/webshops', {});
35
+
36
+ if (params) {
37
+ return [true, params as Params];
38
+ }
39
+ return [false];
40
+ }
41
+
42
+ static async buildQuery(q: CountFilteredRequest | LimitedFilteredRequest) {
43
+ const organization = Context.organization;
44
+
45
+ const query = SQL
46
+ .select(
47
+ SQL.wildcard('webshops'),
48
+ )
49
+ .setMaxExecutionTime(15 * 1000)
50
+ .from(
51
+ SQL.table('webshops'),
52
+ );
53
+
54
+ if (organization) {
55
+ // Organization context: scope to this organization's webshops only
56
+ const scopeFilter: StamhoofdFilter = {
57
+ organizationId: {
58
+ $eq: organization.id,
59
+ },
60
+ };
61
+ query.where(await compileToSQLFilter(scopeFilter, filterCompilers));
62
+ }
63
+ else {
64
+ // Platform context: check platform access
65
+ const tags = Context.auth.getPlatformAccessibleOrganizationTags(PermissionLevel.Read);
66
+
67
+ if (tags !== 'all' && tags.length === 0) {
68
+ throw Context.auth.error();
69
+ }
70
+
71
+ if (tags !== 'all') {
72
+ // Join with organizations table to filter by accessible organization tags
73
+ query.join(
74
+ SQL.join(SQL.table('organizations'))
75
+ .where(
76
+ SQL.column('webshops', 'organizationId'),
77
+ SQL.column('organizations', 'id'),
78
+ ),
79
+ );
80
+
81
+ // Apply tag scope filter using the organizations filter compiler
82
+ const tagScopeFilter: StamhoofdFilter = {
83
+ tags: {
84
+ $in: tags,
85
+ },
86
+ };
87
+ query.where(await compileToSQLFilter(tagScopeFilter, organizationFilterCompilers));
88
+ }
89
+ }
90
+
91
+ if (q.filter) {
92
+ query.where(await compileToSQLFilter(q.filter, filterCompilers));
93
+ }
94
+
95
+ if (q.search) {
96
+ const searchFilter: StamhoofdFilter = {
97
+ $or: [
98
+ {
99
+ name: {
100
+ $contains: q.search,
101
+ },
102
+ },
103
+ ],
104
+ };
105
+ query.where(await compileToSQLFilter(searchFilter, filterCompilers));
106
+ }
107
+
108
+ if (q instanceof LimitedFilteredRequest) {
109
+ if (q.pageFilter) {
110
+ query.where(await compileToSQLFilter(q.pageFilter, filterCompilers));
111
+ }
112
+
113
+ q.sort = assertSort(q.sort, [{ key: 'id' }]);
114
+ applySQLSorter(query, q.sort, sorters);
115
+ query.limit(q.limit);
116
+ }
117
+
118
+ return query;
119
+ }
120
+
121
+ static async buildData(requestQuery: LimitedFilteredRequest): Promise<PaginatedResponse<WebshopWithOrganization[], LimitedFilteredRequest>> {
122
+ const query = await GetWebshopsEndpoint.buildQuery(requestQuery);
123
+ let data: SQLResultNamespacedRow[];
124
+
125
+ try {
126
+ data = await query.fetch();
127
+ }
128
+ catch (error) {
129
+ if (error.message.includes('ER_QUERY_TIMEOUT')) {
130
+ throw new SimpleError({
131
+ code: 'timeout',
132
+ message: 'Query took too long',
133
+ human: $t(`%Cv`),
134
+ });
135
+ }
136
+ throw error;
137
+ }
138
+
139
+ const webshops = Webshop.fromRows(data, 'webshops');
140
+
141
+ // Filter out webshops the user cannot access (e.g. specific resource-level permissions)
142
+ const accessibleWebshops: Webshop[] = [];
143
+ for (const webshop of webshops) {
144
+ if (await Context.auth.canAccessWebshop(webshop, PermissionLevel.Read)) {
145
+ accessibleWebshops.push(webshop);
146
+ }
147
+ }
148
+
149
+ // Batch-load organizations for accessible webshops
150
+ const organizationIds = Formatter.uniqueArray(accessibleWebshops.map(w => w.organizationId));
151
+ const organizationModels = organizationIds.length > 0 ? await Organization.getByIDs(...organizationIds) : [];
152
+
153
+ let next: LimitedFilteredRequest | undefined;
154
+
155
+ if (webshops.length >= requestQuery.limit) {
156
+ const lastObject = webshops[webshops.length - 1];
157
+ const nextFilter = getSortFilter(lastObject, sorters, requestQuery.sort);
158
+
159
+ next = new LimitedFilteredRequest({
160
+ filter: requestQuery.filter,
161
+ pageFilter: nextFilter,
162
+ sort: requestQuery.sort,
163
+ limit: requestQuery.limit,
164
+ search: requestQuery.search,
165
+ });
166
+
167
+ if (JSON.stringify(nextFilter) === JSON.stringify(requestQuery.pageFilter)) {
168
+ console.error('Found infinite loading loop for', requestQuery);
169
+ next = undefined;
170
+ }
171
+ }
172
+
173
+ const results: WebshopWithOrganization[] = [];
174
+ for (const webshop of accessibleWebshops) {
175
+ const organizationModel = organizationModels.find(o => o.id === webshop.organizationId);
176
+ if (!organizationModel) {
177
+ // Skip webshops whose organization cannot be found
178
+ console.warn('Organization not found for webshop', webshop.id, webshop.organizationId);
179
+ continue;
180
+ }
181
+
182
+ const webshopStruct = AuthenticatedStructures.webshopPreview(webshop);
183
+ results.push(WebshopWithOrganization.create({
184
+ webshop: webshopStruct,
185
+ organization: organizationModel.getBaseStructure(),
186
+ }));
187
+ }
188
+
189
+ return new PaginatedResponse<WebshopWithOrganization[], LimitedFilteredRequest>({
190
+ results,
191
+ next,
192
+ });
193
+ }
194
+
195
+ async handle(request: DecodedRequest<Params, Query, Body>) {
196
+ await Context.setOptionalOrganizationScope();
197
+ await Context.authenticate();
198
+
199
+ const maxLimit = Context.auth.hasSomePlatformAccess() ? 1000 : 100;
200
+
201
+ if (request.query.limit > maxLimit) {
202
+ throw new SimpleError({
203
+ code: 'invalid_field',
204
+ field: 'limit',
205
+ message: 'Limit can not be more than ' + maxLimit,
206
+ });
207
+ }
208
+
209
+ if (request.query.limit < 1) {
210
+ throw new SimpleError({
211
+ code: 'invalid_field',
212
+ field: 'limit',
213
+ message: 'Limit can not be less than 1',
214
+ });
215
+ }
216
+
217
+ return new Response(
218
+ await GetWebshopsEndpoint.buildData(request.query),
219
+ );
220
+ }
221
+ }
@@ -1,7 +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 { SimpleError } from '@simonbackx/simple-errors';
3
4
  import { BalanceItem } from '@stamhoofd/models';
4
- import { BalanceItemWithPayments } from '@stamhoofd/structures';
5
+ import type { BalanceItemWithPayments } from '@stamhoofd/structures';
5
6
 
6
7
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
7
8
  import { Context } from '../../../../helpers/Context.js';
@@ -40,7 +41,7 @@ export class GetBalanceItemEndpoint extends Endpoint<Params, Query, Body, Respon
40
41
  code: 'not_found',
41
42
  statusCode: 404,
42
43
  message: 'Balance item not found',
43
- human: $t('7bc08947-2409-4a7c-b597-2d6d43884a96'),
44
+ human: $t('%1L6'),
44
45
  });
45
46
  }
46
47
 
@@ -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,9 +1,11 @@
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
5
  import { BalanceItem } from '@stamhoofd/models';
5
6
  import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
6
- import { BalanceItem as BalanceItemStruct, CountFilteredRequest, LimitedFilteredRequest, PaginatedResponse, StamhoofdFilter, assertSort, getSortFilter } from '@stamhoofd/structures';
7
+ import type { BalanceItem as BalanceItemStruct, CountFilteredRequest, StamhoofdFilter} from '@stamhoofd/structures';
8
+ import { LimitedFilteredRequest, PaginatedResponse, assertSort, getSortFilter } from '@stamhoofd/structures';
7
9
 
8
10
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
9
11
  import { Context } from '../../../../helpers/Context.js';
@@ -99,7 +101,7 @@ export class GetBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Respo
99
101
  throw new SimpleError({
100
102
  code: 'timeout',
101
103
  message: 'Query took too long',
102
- human: $t(`dce51638-6129-448b-8a15-e6d778f3a76a`),
104
+ human: $t(`%Cv`),
103
105
  });
104
106
  }
105
107
  throw error;
@@ -1,5 +1,7 @@
1
- import { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder, PatchableArrayDecoder, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
2
+ import { PatchableArrayDecoder, 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 { BalanceItem, Member, Order, User } from '@stamhoofd/models';
5
7
  import { QueueHandler } from '@stamhoofd/queues';
@@ -74,13 +76,13 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
74
76
  if (put.payingOrganizationId) {
75
77
  // Not allowed if not full admin
76
78
  if (!Context.auth.hasPlatformFullAccess()) {
77
- throw Context.auth.error($t(`fafaf0c2-cbf4-4f5b-8669-eb09303efe1e`));
79
+ throw Context.auth.error($t(`%Ef`));
78
80
  }
79
81
  if (put.payingOrganizationId === model.organizationId) {
80
82
  throw new SimpleError({
81
83
  code: 'invalid_field',
82
84
  message: 'payingOrganizationId cannot be the same as organizationId',
83
- human: $t(`7b181446-ef56-4957-ad13-54644e6d0987`),
85
+ human: $t(`%Eg`),
84
86
  field: 'payingOrganizationId',
85
87
  });
86
88
  }
@@ -92,7 +94,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
92
94
  throw new SimpleError({
93
95
  code: 'invalid_price',
94
96
  message: 'Cannot create negative balance in the future',
95
- human: $t(`ad8ee48a-8176-4b5f-b6fc-54bc615c2564`),
97
+ human: $t(`%Eh`),
96
98
  });
97
99
  }
98
100
 
@@ -100,7 +102,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
100
102
  throw new SimpleError({
101
103
  code: 'invalid_field',
102
104
  message: 'createdAt cannot be in the future',
103
- human: $t(`8bdc9bf1-1d05-4579-9cc4-7fe11c1f031b`),
105
+ human: $t(`%Ei`),
104
106
  field: 'createdAt',
105
107
  });
106
108
  }
@@ -130,13 +132,13 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
130
132
  if (patch.payingOrganizationId !== undefined) {
131
133
  // Not allowed if not full admin
132
134
  if (!Context.auth.hasPlatformFullAccess()) {
133
- throw Context.auth.error($t(`fafaf0c2-cbf4-4f5b-8669-eb09303efe1e`));
135
+ throw Context.auth.error($t(`%Ef`));
134
136
  }
135
137
  if (patch.payingOrganizationId === model.organizationId) {
136
138
  throw new SimpleError({
137
139
  code: 'invalid_field',
138
140
  message: 'payingOrganizationId cannot be the same as organizationId',
139
- human: $t(`7b181446-ef56-4957-ad13-54644e6d0987`),
141
+ human: $t(`%Eg`),
140
142
  field: 'payingOrganizationId',
141
143
  });
142
144
  }
@@ -158,7 +160,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
158
160
  throw new SimpleError({
159
161
  code: 'invalid_field',
160
162
  message: 'No user or member provided',
161
- human: $t(`ace2c298-5b2a-42cd-900d-624e1e375aeb`),
163
+ human: $t(`%Ej`),
162
164
  field: 'memberId',
163
165
  });
164
166
  }
@@ -176,7 +178,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
176
178
  throw new SimpleError({
177
179
  code: 'invalid_field',
178
180
  message: 'createdAt cannot be in the future',
179
- human: $t(`8bdc9bf1-1d05-4579-9cc4-7fe11c1f031b`),
181
+ human: $t(`%Ei`),
180
182
  field: 'createdAt',
181
183
  });
182
184
  }
@@ -194,7 +196,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
194
196
  throw new SimpleError({
195
197
  code: 'invalid_price',
196
198
  message: 'Cannot create negative balance in the future',
197
- human: $t(`ad8ee48a-8176-4b5f-b6fc-54bc615c2564`),
199
+ human: $t(`%Eh`),
198
200
  field: 'dueAt',
199
201
  });
200
202
  }
@@ -248,7 +250,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
248
250
  throw new SimpleError({
249
251
  code: 'permission_denied',
250
252
  message: 'No permission to link balance items to this member',
251
- human: $t(`59197811-88ca-423c-b3b1-940d3c42704d`),
253
+ human: $t(`%Ek`),
252
254
  field: 'memberId',
253
255
  });
254
256
  }
@@ -262,7 +264,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
262
264
  throw new SimpleError({
263
265
  code: 'permission_denied',
264
266
  message: 'No permission to link balance items to this user',
265
- human: $t(`2ca03c93-d221-4a02-93be-9f187426f563`),
267
+ human: $t(`%El`),
266
268
  field: 'userId',
267
269
  });
268
270
  }
@@ -1,5 +1,7 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
2
- import { DetailedPayableBalanceCollection, PaymentStatus } from '@stamhoofd/structures';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
+ import type { DetailedPayableBalanceCollection} from '@stamhoofd/structures';
4
+ import { PaymentStatus } from '@stamhoofd/structures';
3
5
 
4
6
  import { BalanceItem, Payment } from '@stamhoofd/models';
5
7
  import { SQL } from '@stamhoofd/sql';
@@ -1,5 +1,7 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
2
- import { PayableBalanceCollection, ReceivableBalanceType } from '@stamhoofd/structures';
1
+ import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
3
+ import type { PayableBalanceCollection} from '@stamhoofd/structures';
4
+ import { ReceivableBalanceType } from '@stamhoofd/structures';
3
5
 
4
6
  import { Context } from '../../../../helpers/Context.js';
5
7
  import { GetUserPayableBalanceEndpoint } from '../../../global/registration/GetUserPayableBalanceEndpoint.js';
@@ -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 { OrganizationPackagesStatus, STPackage as STPackageStruct } from '@stamhoofd/structures';
3
4
  import { Context } from '../../../../helpers/Context.js';
4
5
  import { STPackageService } from '../../../../services/STPackageService.js';
@@ -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 { DocumentTemplate } from '@stamhoofd/models';
4
5
 
@@ -37,7 +38,7 @@ export class GetDocumentTemplateXMLEndpoint extends Endpoint<Params, Query, Body
37
38
 
38
39
  const template = await DocumentTemplate.getByID(request.params.id);
39
40
  if (!template || !await Context.auth.canAccessDocumentTemplate(template)) {
40
- throw Context.auth.notFoundOrNoAccess($t(`a9860203-6a6d-4612-b4d4-7851e47d4dad`));
41
+ throw Context.auth.notFoundOrNoAccess($t(`%EK`));
41
42
  }
42
43
 
43
44
  // Update documents
@@ -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,9 +1,12 @@
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 { DocumentTemplate } from '@stamhoofd/models';
3
- import { assertSort, CountFilteredRequest, DocumentTemplatePrivate, LimitedFilteredRequest, PaginatedResponse, SearchFilterFactory, StamhoofdFilter } from '@stamhoofd/structures';
4
+ import type { CountFilteredRequest, DocumentTemplatePrivate, StamhoofdFilter } from '@stamhoofd/structures';
5
+ import { assertSort, LimitedFilteredRequest, PaginatedResponse, SearchFilterFactory } from '@stamhoofd/structures';
4
6
 
5
- import { Decoder } from '@simonbackx/simple-encoding';
6
- import { applySQLSorter, compileToSQLFilter, SQL, SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
7
+ import type { Decoder } from '@simonbackx/simple-encoding';
8
+ import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
9
+ import { applySQLSorter, compileToSQLFilter, SQL } from '@stamhoofd/sql';
7
10
  import { Context } from '../../../../helpers/Context.js';
8
11
  import { LimitedFilteredRequestHelper } from '../../../../helpers/LimitedFilteredRequestHelper.js';
9
12
  import { documentTemplateFilterCompilers } from '../../../../sql-filters/document-templates.js';
@@ -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,9 +1,12 @@
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 { Document } from '@stamhoofd/models';
3
- import { assertSort, CountFilteredRequest, Document as DocumentStruct, getSortFilter, LimitedFilteredRequest, PaginatedResponse, SearchFilterFactory, StamhoofdFilter } from '@stamhoofd/structures';
4
+ import type { CountFilteredRequest, Document as DocumentStruct, StamhoofdFilter } from '@stamhoofd/structures';
5
+ import { assertSort, getSortFilter, LimitedFilteredRequest, PaginatedResponse, SearchFilterFactory } from '@stamhoofd/structures';
4
6
 
5
- import { Decoder } from '@simonbackx/simple-encoding';
6
- import { applySQLSorter, compileToSQLFilter, SQL, SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
7
+ import type { Decoder } from '@simonbackx/simple-encoding';
8
+ import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
9
+ import { applySQLSorter, compileToSQLFilter, SQL } from '@stamhoofd/sql';
7
10
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
8
11
  import { Context } from '../../../../helpers/Context.js';
9
12
  import { LimitedFilteredRequestHelper } from '../../../../helpers/LimitedFilteredRequestHelper.js';
@@ -1,5 +1,7 @@
1
- import { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder, PatchableArrayDecoder, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
2
+ import { PatchableArrayDecoder, 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 { Document, DocumentTemplate, Member, Registration } from '@stamhoofd/models';
5
7
  import { DocumentStatus, Document as DocumentStruct, PermissionLevel } from '@stamhoofd/structures';
@@ -40,7 +42,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
40
42
  for (const patch of request.body.getPatches()) {
41
43
  const document = await Document.getByID(patch.id);
42
44
  if (!document || !(await Context.auth.canAccessDocument(document, PermissionLevel.Write))) {
43
- throw Context.auth.notFoundOrNoAccess($t(`a9860203-6a6d-4612-b4d4-7851e47d4dad`));
45
+ throw Context.auth.notFoundOrNoAccess($t(`%EK`));
44
46
  }
45
47
 
46
48
  if (patch.data) {
@@ -57,7 +59,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
57
59
  throw new SimpleError({
58
60
  code: 'not_found',
59
61
  message: 'Document not found',
60
- human: $t(`b6ffe33d-566e-4c9a-85b2-82930d653548`),
62
+ human: $t(`%EL`),
61
63
  });
62
64
  }
63
65
 
@@ -78,7 +80,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
78
80
  throw new SimpleError({
79
81
  code: 'not_found',
80
82
  message: 'Document template not found',
81
- human: $t(`f428c3d5-9b0f-485b-971e-b7e5d76533d4`),
83
+ human: $t(`%EM`),
82
84
  });
83
85
  }
84
86
  const document = new Document();
@@ -97,7 +99,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
97
99
  throw new SimpleError({
98
100
  code: 'not_found',
99
101
  message: 'Registration not found',
100
- human: $t(`5756fd57-7f2b-4ce4-8be1-ba0dd4313c75`),
102
+ human: $t(`%EN`),
101
103
  });
102
104
  }
103
105
  document.registrationId = put.registrationId;
@@ -109,7 +111,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
109
111
  throw new SimpleError({
110
112
  code: 'not_found',
111
113
  message: 'Member not found',
112
- human: $t(`9cfa48c7-980c-4cd5-85ed-2656db040b4c`),
114
+ human: $t(`%EO`),
113
115
  });
114
116
  }
115
117
  document.memberId = put.memberId;
@@ -1,6 +1,8 @@
1
1
  import { PatchableArray } from '@simonbackx/simple-encoding';
2
- import { Endpoint, Request } from '@simonbackx/simple-endpoints';
3
- import { DocumentTemplate, DocumentTemplateFactory, Organization, OrganizationFactory, RegistrationPeriod, RegistrationPeriodFactory, Token, User, UserFactory } from '@stamhoofd/models';
2
+ import type { Endpoint} from '@simonbackx/simple-endpoints';
3
+ import { Request } from '@simonbackx/simple-endpoints';
4
+ import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
5
+ import { DocumentTemplate, DocumentTemplateFactory, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
4
6
  import { SQL } from '@stamhoofd/sql';
5
7
  import { DocumentPrivateSettings, DocumentStatus, DocumentTemplateDefinition, DocumentTemplatePrivate, PermissionLevel, Permissions } from '@stamhoofd/structures';
6
8
  import { STExpect, TestUtils } from '@stamhoofd/test-utils';
@@ -1,5 +1,7 @@
1
- import { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder, PatchableArrayDecoder, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
2
+ import { PatchableArrayDecoder, 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 { DocumentTemplate } from '@stamhoofd/models';
5
7
  import { DocumentTemplatePrivate, PermissionLevel } from '@stamhoofd/structures';
@@ -67,7 +69,7 @@ export class PatchDocumentTemplatesEndpoint extends Endpoint<Params, Query, Body
67
69
  for (const patch of request.body.getPatches()) {
68
70
  const template = await DocumentTemplate.getByID(patch.id);
69
71
  if (!template || !await Context.auth.canAccessDocumentTemplate(template, PermissionLevel.Full)) {
70
- throw Context.auth.notFoundOrNoAccess($t(`148bfab7-ca0e-4fac-8a0a-302ca7855fc8`));
72
+ throw Context.auth.notFoundOrNoAccess($t(`%EP`));
71
73
  }
72
74
 
73
75
  let shouldCheckIfAlreadyHasFiscalDocument = false;
@@ -124,7 +126,7 @@ export class PatchDocumentTemplatesEndpoint extends Endpoint<Params, Query, Body
124
126
  throw new SimpleError({
125
127
  code: 'not_found',
126
128
  message: 'Template not found',
127
- human: $t(`10aa55e6-5ad6-4ac1-8e7f-3a414e26e22e`),
129
+ human: $t(`%EQ`),
128
130
  });
129
131
  }
130
132
 
@@ -158,7 +160,7 @@ export class PatchDocumentTemplatesEndpoint extends Endpoint<Params, Query, Body
158
160
  code: 'double_fiscal_document',
159
161
  field: 'year',
160
162
  message: 'This year already has a fiscal document',
161
- human: $t('475f5f96-86bf-4124-a005-9904aaf72b37'),
163
+ human: $t('%1IS'),
162
164
  });
163
165
  }
164
166
  }
@@ -1,5 +1,6 @@
1
1
  import { ArrayDecoder, StringDecoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
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
5
  import { EmailAddress } from '@stamhoofd/email';
5
6
  import { EmailInformation } from '@stamhoofd/structures';
@@ -42,7 +43,7 @@ export class CheckEmailBouncesEndpoint extends Endpoint<Params, Query, Body, Res
42
43
  throw new SimpleError({
43
44
  code: 'too_many_recipients',
44
45
  message: 'Too many recipients',
45
- human: $t(`0a406ba7-037a-405b-93f8-de308a66f3e3`),
46
+ human: $t(`%ER`),
46
47
  field: 'recipients',
47
48
  });
48
49
  }