@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,5 +1,6 @@
1
1
  import { Request } from '@simonbackx/simple-endpoints';
2
- import { EmailTemplate, GroupFactory, Organization, OrganizationFactory, Platform, RegistrationPeriod, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
2
+ import type { Organization, RegistrationPeriod} from '@stamhoofd/models';
3
+ import { EmailTemplate, GroupFactory, OrganizationFactory, Platform, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
3
4
  import { EmailTemplateType, PermissionLevel, PermissionRoleDetailed, Permissions, PermissionsResourceType, ResourcePermissions, Version } from '@stamhoofd/structures';
4
5
  import { TestUtils } from '@stamhoofd/test-utils';
5
6
  import { testServer } from '../../../../../tests/helpers/TestServer.js';
@@ -86,4 +87,38 @@ describe('Endpoint.GetEmailTemplatesEndpoint', () => {
86
87
  expect(response.body).toBeDefined();
87
88
  expect(response.body).toHaveLength(1);
88
89
  });
90
+
91
+ test('Saved templates with groupIds should not throw SQL syntax error', async () => {
92
+ const organization = await new OrganizationFactory({ period }).create();
93
+ const group = await new GroupFactory({ organization }).create();
94
+
95
+ const user = await new UserFactory({
96
+ organization,
97
+ permissions: Permissions.create({
98
+ level: PermissionLevel.Full,
99
+ }),
100
+ }).create();
101
+
102
+ const token = await Token.createToken(user);
103
+
104
+ const template = new EmailTemplate();
105
+ template.subject = 'saved template';
106
+ template.type = EmailTemplateType.SavedMembersEmail;
107
+ template.json = {};
108
+ template.html = 'html test';
109
+ template.text = 'text test';
110
+ template.organizationId = organization.id;
111
+ template.groupId = group.id;
112
+ await template.save();
113
+
114
+ const response = await getEmailTemplates({
115
+ token,
116
+ organization,
117
+ types: [EmailTemplateType.SavedMembersEmail],
118
+ groupIds: [group.id],
119
+ });
120
+
121
+ expect(response.body).toBeDefined();
122
+ expect(response.body).toHaveLength(1);
123
+ });
89
124
  });
@@ -1,7 +1,10 @@
1
- import { AutoEncoder, Decoder, EnumDecoder, 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, EnumDecoder, 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 { EmailTemplate } from '@stamhoofd/models';
4
6
  import { EmailTemplate as EmailTemplateStruct, EmailTemplateType } from '@stamhoofd/structures';
7
+ import { Formatter } from '@stamhoofd/utility';
5
8
 
6
9
  import { SimpleError } from '@simonbackx/simple-errors';
7
10
  import { StringArrayDecoder } from '../../../../decoders/StringArrayDecoder.js';
@@ -101,7 +104,7 @@ export class GetEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, Res
101
104
  },
102
105
  }));
103
106
 
104
- if (organization && (request.query.webshopId || request.query.groupIds)) {
107
+ if (organization && defaultTemplateTypes.length > 0 && (request.query.webshopId || request.query.groupIds)) {
105
108
  const orgDefaults = (await EmailTemplate.where({
106
109
  organizationId: organization.id,
107
110
  webshopId: null,
@@ -116,8 +119,14 @@ export class GetEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, Res
116
119
  }
117
120
 
118
121
  const allTemplates: EmailTemplate[] = [];
122
+ const allCandidates = templates.concat(defaultTemplates);
119
123
 
120
- for (const template of templates.concat(defaultTemplates)) {
124
+ const groupIds = Formatter.uniqueArray(allCandidates.map(t => t.groupId).filter((id): id is string => id !== null));
125
+ if (groupIds.length > 0) {
126
+ await Context.auth.getGroups(groupIds);
127
+ }
128
+
129
+ for (const template of allCandidates) {
121
130
  if (await Context.auth.canAccessEmailTemplate(template)) {
122
131
  allTemplates.push(template);
123
132
  }
@@ -1,6 +1,8 @@
1
- import { PatchableArray, PatchableArrayAutoEncoder } from '@simonbackx/simple-encoding';
1
+ import type { PatchableArrayAutoEncoder } from '@simonbackx/simple-encoding';
2
+ import { PatchableArray } from '@simonbackx/simple-encoding';
2
3
  import { Request } from '@simonbackx/simple-endpoints';
3
- import { EmailTemplate, GroupFactory, Organization, OrganizationFactory, Platform, RegistrationPeriod, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
4
+ import type { Organization, RegistrationPeriod} from '@stamhoofd/models';
5
+ import { EmailTemplate, GroupFactory, OrganizationFactory, Platform, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
4
6
  import { EmailTemplate as EmailTemplateStruct, EmailTemplateType, PermissionLevel, PermissionRoleDetailed, Permissions, PermissionsResourceType, ResourcePermissions, Version } from '@stamhoofd/structures';
5
7
  import { TestUtils } from '@stamhoofd/test-utils';
6
8
  import { testServer } from '../../../../../tests/helpers/TestServer.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 { EmailTemplate, Group, Webshop } from '@stamhoofd/models';
4
6
  import { EmailTemplate as EmailTemplateStruct, PermissionLevel } from '@stamhoofd/structures';
5
7
 
@@ -43,7 +45,7 @@ export class PatchEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, R
43
45
  for (const patch of request.body.getPatches()) {
44
46
  const template = await EmailTemplate.getByID(patch.id);
45
47
  if (!template || !(await Context.auth.canAccessEmailTemplate(template, PermissionLevel.Write))) {
46
- throw Context.auth.notFoundOrNoAccess($t(`ca80fb17-1557-491f-9e9d-554d842a74d7`));
48
+ throw Context.auth.notFoundOrNoAccess($t(`%ES`));
47
49
  }
48
50
 
49
51
  template.html = patch.html ?? template.html;
@@ -98,7 +100,7 @@ export class PatchEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, R
98
100
 
99
101
  // Check if valid + write permissions
100
102
  if (!(await Context.auth.canAccessEmailTemplate(template, PermissionLevel.Write))) {
101
- throw Context.auth.error($t(`a2afb95e-1dc5-452d-a919-70720fd4e8a6`));
103
+ throw Context.auth.error($t(`%ET`));
102
104
  }
103
105
 
104
106
  await template.save();
@@ -109,7 +111,7 @@ export class PatchEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, R
109
111
  for (const id of request.body.getDeletes()) {
110
112
  const template = await EmailTemplate.getByID(id);
111
113
  if (!template || !(await Context.auth.canAccessEmailTemplate(template, PermissionLevel.Write))) {
112
- throw Context.auth.notFoundOrNoAccess($t(`54599fe6-d0a3-471d-bbe4-b41c367f9aa2`));
114
+ throw Context.auth.notFoundOrNoAccess($t(`%EU`));
113
115
  }
114
116
 
115
117
  await template.delete();
@@ -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 { Invoice } from '@stamhoofd/models';
5
6
  import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
6
- import { CountFilteredRequest, InvoiceStruct, LimitedFilteredRequest, PaginatedResponse, StamhoofdFilter, assertSort, getSortFilter } from '@stamhoofd/structures';
7
+ import type { CountFilteredRequest, InvoiceStruct, 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';
@@ -158,7 +160,7 @@ export class GetInvoicesEndpoint extends Endpoint<Params, Query, Body, ResponseB
158
160
  throw new SimpleError({
159
161
  code: 'timeout',
160
162
  message: 'Query took too long',
161
- human: $t(`dce51638-6129-448b-8a15-e6d778f3a76a`),
163
+ human: $t(`%Cv`),
162
164
  });
163
165
  }
164
166
  throw error;
@@ -1,10 +1,12 @@
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 { Invoice as InvoiceStruct } from '@stamhoofd/structures';
4
6
 
5
7
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
6
8
  import { Context } from '../../../../helpers/Context.js';
7
- import { Invoice } from '@stamhoofd/models';
9
+ import type { Invoice } from '@stamhoofd/models';
8
10
  import { SimpleError } from '@simonbackx/simple-errors';
9
11
  import { ViesHelper } from '../../../../helpers/ViesHelper.js';
10
12
  import { InvoiceService } from '../../../../services/InvoiceService.js';
@@ -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 { MollieToken } from '@stamhoofd/models';
3
- import { CheckMollieResponse, Organization as OrganizationStruct, PermissionLevel } from '@stamhoofd/structures';
4
+ import type { Organization as OrganizationStruct} from '@stamhoofd/structures';
5
+ import { CheckMollieResponse, PermissionLevel } from '@stamhoofd/structures';
4
6
 
5
7
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
6
8
  import { Context } from '../../../../helpers/Context.js';
@@ -1,7 +1,10 @@
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 { MollieToken } from '@stamhoofd/models';
4
- import { Organization as OrganizationStruct, PermissionLevel } from '@stamhoofd/structures';
6
+ import type { Organization as OrganizationStruct} from '@stamhoofd/structures';
7
+ import { PermissionLevel } from '@stamhoofd/structures';
5
8
 
6
9
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
7
10
  import { checkMollieSettlementsFor } from '../../../../helpers/CheckSettlements.js';
@@ -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 { MollieToken } from '@stamhoofd/models';
3
- import { Organization as OrganizationStruct, PermissionLevel } from '@stamhoofd/structures';
4
+ import type { Organization as OrganizationStruct} from '@stamhoofd/structures';
5
+ import { PermissionLevel } from '@stamhoofd/structures';
4
6
 
5
7
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
6
8
  import { Context } from '../../../../helpers/Context.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 { isSimpleError, isSimpleErrors, SimpleError } from '@simonbackx/simple-errors';
3
4
  import { MollieToken } from '@stamhoofd/models';
4
5
  import { PermissionLevel } from '@stamhoofd/structures';
@@ -1,5 +1,6 @@
1
1
  import { AutoEncoder, field, 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 jwt from 'jsonwebtoken';
4
5
 
5
6
  import { Context } from '../../../../helpers/Context.js';
@@ -1,7 +1,9 @@
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 { Group, Token } from '@stamhoofd/models';
4
- import { Group as GroupStruct, GroupStatus } from '@stamhoofd/structures';
5
+ import type { Group as GroupStruct} from '@stamhoofd/structures';
6
+ import { GroupStatus } from '@stamhoofd/structures';
5
7
 
6
8
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
7
9
  import { Context } from '../../../../helpers/Context.js';
@@ -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 { Group } from '@stamhoofd/models';
3
- import { Group as GroupStruct } from '@stamhoofd/structures';
4
+ import type { Group as GroupStruct } from '@stamhoofd/structures';
4
5
 
5
6
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
6
7
  import { Context } from '../../../../helpers/Context.js';
@@ -1,4 +1,5 @@
1
- import { Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { Request} from '@simonbackx/simple-endpoints';
2
+ import { Endpoint, Response } from '@simonbackx/simple-endpoints';
2
3
  import { UitpasGetClientIdResponse } from '@stamhoofd/structures';
3
4
 
4
5
  import { Context } from '../../../../helpers/Context.js';
@@ -1,8 +1,10 @@
1
1
  import { Request } from '@simonbackx/simple-endpoints';
2
- import { GroupFactory, Organization, OrganizationFactory, OrganizationRegistrationPeriod, RegistrationPeriodFactory, Token, User, UserFactory, Webshop, WebshopFactory } from '@stamhoofd/models';
2
+ import type { Organization, User, Webshop} from '@stamhoofd/models';
3
+ import { GroupFactory, OrganizationFactory, OrganizationRegistrationPeriod, RegistrationPeriodFactory, Token, UserFactory, WebshopFactory } from '@stamhoofd/models';
3
4
  import { AccessRight, MemberResponsibility, OrganizationPrivateMetaData, OrganizationRegistrationPeriod as OrganizationRegistrationPeriodStruct, Organization as OrganizationStruct, PermissionLevel, PermissionRoleDetailed, PermissionRoleForResponsibility, Permissions, PermissionsResourceType, ResourcePermissions, Version } from '@stamhoofd/structures';
4
5
 
5
- import { AutoEncoderPatchType, PatchableArray, PatchableArrayAutoEncoder, PatchMap } from '@simonbackx/simple-encoding';
6
+ import type { AutoEncoderPatchType, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
7
+ import { PatchableArray, PatchMap } from '@simonbackx/simple-encoding';
6
8
  import { STExpect, TestUtils } from '@stamhoofd/test-utils';
7
9
  import { testServer } from '../../../../../tests/helpers/TestServer.js';
8
10
  import { PatchOrganizationEndpoint } from './PatchOrganizationEndpoint.js';
@@ -592,7 +594,7 @@ describe('Endpoint.PatchOrganization', () => {
592
594
 
593
595
  // other fields should be default fields and not be set
594
596
  expect(response.body.privateMeta!.inheritedResponsibilityRoles[0].level).toBe(PermissionLevel.None);
595
- expect(response.body.privateMeta!.inheritedResponsibilityRoles[0].accessRights).toBeEmpty();
597
+ expect(response.body.privateMeta!.inheritedResponsibilityRoles[0].accessRights).toEqual([]);
596
598
  });
597
599
 
598
600
  test('should only be able to patch resources of inherited responsibility roles', async () => {
@@ -1,8 +1,11 @@
1
- import { AutoEncoderPatchType, cloneObject, Decoder, isPatchableArray, isPatchMap, ObjectData, PatchableArray, PatchableArrayAutoEncoder, PatchMap, patchObject } 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 { cloneObject, isPatchableArray, isPatchMap, ObjectData, PatchableArray, PatchMap, patchObject } 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, SimpleErrors } from '@simonbackx/simple-errors';
4
6
  import { Organization, OrganizationRegistrationPeriod, PayconiqPayment, Platform, RegistrationPeriod, StripeAccount, Webshop } from '@stamhoofd/models';
5
- import { BuckarooSettings, Company, MemberResponsibility, OrganizationMetaData, Organization as OrganizationStruct, PayconiqAccount, PaymentMethod, PaymentMethodHelper, PermissionLevel, PermissionRoleDetailed, PermissionRoleForResponsibility, PermissionsResourceType, ResourcePermissions, UitpasClientCredentialsStatus } from '@stamhoofd/structures';
7
+ import type { Company, PermissionsResourceType, ResourcePermissions} from '@stamhoofd/structures';
8
+ import { BuckarooSettings, MemberResponsibility, OrganizationMetaData, Organization as OrganizationStruct, PayconiqAccount, PaymentMethod, PaymentMethodHelper, PermissionLevel, PermissionRoleDetailed, PermissionRoleForResponsibility, UitpasClientCredentialsStatus } from '@stamhoofd/structures';
6
9
  import { Formatter } from '@stamhoofd/utility';
7
10
 
8
11
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
@@ -51,7 +54,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
51
54
  throw new SimpleError({
52
55
  code: 'permission_denied',
53
56
  message: 'You do not have permissions to edit an inactive organization',
54
- human: $t(`b33ba9f0-c12d-4918-ac9d-7aeec5de41a5`),
57
+ human: $t(`%EV`),
55
58
  statusCode: 403,
56
59
  });
57
60
  }
@@ -77,7 +80,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
77
80
  code: 'invalid_field',
78
81
  message: 'Name is too short',
79
82
  field: 'name',
80
- human: $t('50b198a4-af37-4514-8d82-b9e4c41d9e91'),
83
+ human: $t('%1L7'),
81
84
  });
82
85
  }
83
86
  organization.name = request.body.name ?? organization.name;
@@ -97,7 +100,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
97
100
  throw new SimpleError({
98
101
  code: 'invalid_field',
99
102
  message: 'Field is too long',
100
- human: $t(`864675a2-7376-4a61-9c7d-f488e7906d7b`),
103
+ human: $t(`%EW`),
101
104
  field: 'uri',
102
105
  });
103
106
  }
@@ -106,7 +109,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
106
109
  throw new SimpleError({
107
110
  code: 'invalid_field',
108
111
  message: 'Field is too short',
109
- human: $t(`0fa660da-1e74-4940-af88-eafafb1094b6`),
112
+ human: $t(`%EX`),
110
113
  field: 'uri',
111
114
  });
112
115
  }
@@ -116,7 +119,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
116
119
  throw new SimpleError({
117
120
  code: 'name_taken',
118
121
  message: 'An organization with the same URI already exists',
119
- human: $t(`daa7dc61-e8c9-4629-97b6-a75f39eaebac`),
122
+ human: $t(`%EY`),
120
123
  field: 'uri',
121
124
  });
122
125
  }
@@ -329,7 +332,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
329
332
  throw new SimpleError({
330
333
  code: 'invalid_field',
331
334
  message: 'You cannot set the uitpasClientCredentialsStatus manually',
332
- human: $t('d8937ba8-6689-4c76-9841-d5a00c99074b'),
335
+ human: $t('%1BB'),
333
336
  });
334
337
  }
335
338
 
@@ -357,7 +360,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
357
360
 
358
361
  if (request.body.active !== undefined) {
359
362
  if (!Context.auth.hasPlatformFullAccess()) {
360
- throw Context.auth.error($t(`e46f34cd-f166-421e-be97-28ccecdf9c73`));
363
+ throw Context.auth.error($t(`%EZ`));
361
364
  }
362
365
  organization.active = request.body.active;
363
366
  }
@@ -373,7 +376,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
373
376
  throw new SimpleError({
374
377
  code: 'name_taken',
375
378
  message: 'An organization with the same name already exists',
376
- human: $t(`6e675a7d-b124-4507-bf0c-9b70013e98ca`),
379
+ human: $t(`%D2`),
377
380
  field: 'name',
378
381
  });
379
382
  }
@@ -387,7 +390,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
387
390
  throw new SimpleError({
388
391
  code: 'invalid_field',
389
392
  message: 'The period you want to set does not exist (anymore)',
390
- human: $t('a3795bf6-ed50-4aa6-9caf-33820292c159'),
393
+ human: $t('%15h'),
391
394
  field: 'period',
392
395
  });
393
396
  }
@@ -398,7 +401,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
398
401
  throw new SimpleError({
399
402
  code: 'invalid_field',
400
403
  message: 'The period you want to set does not exist (anymore)',
401
- human: $t('a3795bf6-ed50-4aa6-9caf-33820292c159'),
404
+ human: $t('%15h'),
402
405
  field: 'period',
403
406
  });
404
407
  }
@@ -408,7 +411,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
408
411
  throw new SimpleError({
409
412
  code: 'invalid_field',
410
413
  message: 'The period has no organization id',
411
- human: $t('d004e93c-e67f-48ab-bf3d-7b4ad86c7a38'),
414
+ human: $t('%1Gw'),
412
415
  field: 'period',
413
416
  });
414
417
  }
@@ -417,7 +420,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
417
420
  throw new SimpleError({
418
421
  code: 'invalid_field',
419
422
  message: 'The period you want to set is already closed',
420
- human: $t('b6bc2fef-71ac-43a1-b430-50945427a9e3'),
423
+ human: $t('%15i'),
421
424
  field: 'period',
422
425
  });
423
426
  }
@@ -427,7 +430,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
427
430
  throw new SimpleError({
428
431
  code: 'invalid_field',
429
432
  message: 'The period you want to set has not started yet',
430
- human: $t('e0fff936-3f3c-46b8-adcf-c723c33907a2'),
433
+ human: $t('%15k'),
431
434
  field: 'period',
432
435
  });
433
436
  }
@@ -580,7 +583,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
580
583
 
581
584
  if (!model || !await Context.auth.canAccessWebshop(model, PermissionLevel.Full)) {
582
585
  errors.addError(
583
- Context.auth.error($t(`5e92a9b3-a94d-41db-9d0e-c58122400725`)),
586
+ Context.auth.error($t(`%Ea`)),
584
587
  );
585
588
  continue;
586
589
  }
@@ -636,7 +639,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
636
639
  throw new SimpleError({
637
640
  code: 'invalid_field',
638
641
  message: 'Too many companies',
639
- human: $t(`35d462bc-121e-46ad-824b-a7838a6665ae`),
642
+ human: $t(`%Eb`),
640
643
  field: 'companies',
641
644
  });
642
645
  }
@@ -649,7 +652,7 @@ export class PatchOrganizationEndpoint extends Endpoint<Params, Query, Body, Res
649
652
  throw new SimpleError({
650
653
  code: 'invalid_field',
651
654
  message: 'Too many companies',
652
- human: $t(`35d462bc-121e-46ad-824b-a7838a6665ae`),
655
+ human: $t(`%Eb`),
653
656
  field: 'companies',
654
657
  });
655
658
  }
@@ -1,7 +1,9 @@
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 { UitpasService } from '../../../../services/uitpas/UitpasService.js';
3
- import { UitpasOrganizersResponse } from '@stamhoofd/structures';
4
- import { AutoEncoder, Decoder, field, StringDecoder } from '@simonbackx/simple-encoding';
4
+ import type { UitpasOrganizersResponse } from '@stamhoofd/structures';
5
+ import type { Decoder} from '@simonbackx/simple-encoding';
6
+ import { AutoEncoder, field, StringDecoder } from '@simonbackx/simple-encoding';
5
7
  import { Context } from '../../../../helpers/Context.js';
6
8
 
7
9
  type Params = Record<string, never>;
@@ -1,12 +1,14 @@
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, SimpleErrors } from '@simonbackx/simple-errors';
4
- import { DNSRecord, DNSRecordType, Organization as OrganizationStruct, OrganizationDomains } from '@stamhoofd/structures';
5
+ import type { Organization as OrganizationStruct } from '@stamhoofd/structures';
6
+ import { DNSRecord, DNSRecordType, OrganizationDomains } from '@stamhoofd/structures';
5
7
  import NodeRSA from 'node-rsa';
6
8
 
9
+ import { Formatter } from '@stamhoofd/utility';
7
10
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
8
11
  import { Context } from '../../../../helpers/Context.js';
9
- import { Formatter } from '@stamhoofd/utility';
10
12
 
11
13
  type Params = Record<string, never>;
12
14
  type Query = undefined;
@@ -52,20 +54,20 @@ export class SetOrganizationDomainEndpoint extends Endpoint<Params, Query, Body,
52
54
 
53
55
  // Validate domains
54
56
 
55
- if (request.body.registerDomain !== null && !request.body.registerDomain.match(/^([a-zA-Z0-9-]+\.)?[a-zA-Z0-9-]+\.[a-zA-Z]+$/)) {
57
+ if (request.body.registerDomain !== null && !request.body.registerDomain.match(/^(?:[a-z0-9-]+\.)?[a-z0-9-]+\.[a-z]+$/i)) {
56
58
  throw new SimpleError({
57
59
  code: 'invalid_domain',
58
60
  message: 'registerDomain is invalid',
59
- human: $t(`50fc6c16-b3d2-4015-b04c-7f11c6e4d497`),
61
+ human: $t(`%Ec`),
60
62
  field: 'registerDomain',
61
63
  });
62
64
  }
63
65
 
64
- if (request.body.mailDomain !== null && !request.body.mailDomain.match(/^([a-zA-Z0-9-]+\.)?[a-zA-Z0-9-]+\.[a-zA-Z]+$/)) {
66
+ if (request.body.mailDomain !== null && !request.body.mailDomain.match(/^(?:[a-z0-9-]+\.)?[a-z0-9-]+\.[a-z]+$/i)) {
65
67
  throw new SimpleError({
66
68
  code: 'invalid_domain',
67
69
  message: 'mailDomain is invalid',
68
- human: $t(`da31b8f3-ef8c-4235-b9ba-7eb6d6433a61`),
70
+ human: $t(`%Ed`),
69
71
  field: 'mailDomain',
70
72
  });
71
73
  }
@@ -165,7 +167,7 @@ export class SetOrganizationDomainEndpoint extends Endpoint<Params, Query, Body,
165
167
  type: DNSRecordType.TXT,
166
168
  name: '_dmarc.' + organization.privateMeta.pendingMailDomain + '.',
167
169
  value: 'v=DMARC1; p=quarantine; pct=100; sp=quarantine; aspf=r; adkim=r;',
168
- description: $t(`dfd0d85f-262e-4d5a-b8e4-8a9e67c60652`),
170
+ description: $t(`%Ee`),
169
171
  optional: true,
170
172
  }));
171
173
  }
@@ -1,5 +1,6 @@
1
- import { AutoEncoderPatchType, Decoder } from '@simonbackx/simple-encoding';
2
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { AutoEncoderPatchType, 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 { UitpasClientCredentialsStatus, UitpasClientIdAndSecret, UitpasSetClientCredentialsResponse } from '@stamhoofd/structures';
5
6
  import { Context } from '../../../../helpers/Context.js';
@@ -51,7 +52,7 @@ export class SetUitpasClientCredentialsEndpoint extends Endpoint<Params, Query,
51
52
  throw new SimpleError({
52
53
  message: 'You must provide a client id',
53
54
  code: 'missing_client_id',
54
- human: $t('9b9ec483-63b8-4696-ade6-0eb18f9008e6'),
55
+ human: $t('%1BC'),
55
56
  field: 'clientId',
56
57
  });
57
58
  }
@@ -59,7 +60,7 @@ export class SetUitpasClientCredentialsEndpoint extends Endpoint<Params, Query,
59
60
  throw new SimpleError({
60
61
  message: 'You must provide a client secret',
61
62
  code: 'missing_client_secret',
62
- human: $t('58de00fb-3b0a-45a6-9214-7d11b4175779'),
63
+ human: $t('%1BD'),
63
64
  field: 'clientSecret',
64
65
  });
65
66
  }
@@ -67,7 +68,7 @@ export class SetUitpasClientCredentialsEndpoint extends Endpoint<Params, Query,
67
68
  throw new SimpleError({
68
69
  message: 'You cannot use the placeholder client secret for a different client id',
69
70
  code: 'invalid_client_secret',
70
- human: $t('bbc79280-7ae2-4b8d-a900-2d7cbb552428'),
71
+ human: $t('%1BE'),
71
72
  field: 'clientSecret',
72
73
  });
73
74
  }
@@ -77,7 +78,7 @@ export class SetUitpasClientCredentialsEndpoint extends Endpoint<Params, Query,
77
78
  throw new SimpleError({
78
79
  message: 'This organization does not have a uitpas organizer id set',
79
80
  code: 'missing_uitpas_organizer_id',
80
- human: $t('80fcde9c-c8c7-4fe1-b9a6-51684a23d850'),
81
+ human: $t('%1BF'),
81
82
  });
82
83
  }
83
84
 
@@ -88,7 +89,7 @@ export class SetUitpasClientCredentialsEndpoint extends Endpoint<Params, Query,
88
89
  throw new SimpleError({
89
90
  message: 'The provided client credentials are not valid',
90
91
  code: 'invalid_client_credentials',
91
- human: $t('42bbd5c0-8789-4ca1-b667-1c9ecf4d0190'),
92
+ human: $t('%1BG'),
92
93
  });
93
94
  }
94
95
  }
@@ -1,4 +1,5 @@
1
- import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
1
+ import type { DecodedRequest, Request, Response } from '@simonbackx/simple-endpoints';
2
+ import { Endpoint } from '@simonbackx/simple-endpoints';
2
3
 
3
4
  import { SimpleError } from '@simonbackx/simple-errors';
4
5
 
@@ -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,11 +1,13 @@
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 { Payment } from '@stamhoofd/models';
5
6
  import { SQL, applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
6
- import { CountFilteredRequest, LimitedFilteredRequest, PaginatedResponse, PaymentGeneral, StamhoofdFilter, TransferSettings, assertSort, getSortFilter } from '@stamhoofd/structures';
7
+ import type { CountFilteredRequest, PaymentGeneral, StamhoofdFilter} from '@stamhoofd/structures';
8
+ import { LimitedFilteredRequest, PaginatedResponse, TransferSettings, assertSort, getSortFilter } from '@stamhoofd/structures';
7
9
 
8
- import { SQLResultNamespacedRow } from '@simonbackx/simple-database';
10
+ import type { SQLResultNamespacedRow } from '@simonbackx/simple-database';
9
11
  import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
10
12
  import { Context } from '../../../../helpers/Context.js';
11
13
  import { paymentFilterCompilers } from '../../../../sql-filters/payments.js';
@@ -171,7 +173,7 @@ export class GetPaymentsEndpoint extends Endpoint<Params, Query, Body, ResponseB
171
173
  throw new SimpleError({
172
174
  code: 'timeout',
173
175
  message: 'Query took too long',
174
- human: $t(`dce51638-6129-448b-8a15-e6d778f3a76a`),
176
+ human: $t(`%Cv`),
175
177
  });
176
178
  }
177
179
  throw error;