@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.
- package/package.json +32 -22
- package/src/audit-logs/ModelLogger.ts +4 -2
- package/src/audit-logs/OrderLogger.ts +1 -1
- package/src/boot.ts +32 -14
- package/src/crons/balance-emails.ts +4 -2
- package/src/crons/clearExcelCache.test.ts +8 -8
- package/src/crons/update-cached-balances.ts +40 -14
- package/src/debug.ts +3 -2
- package/src/decoders/StringArrayDecoder.ts +1 -1
- package/src/decoders/StringNullableDecoder.ts +1 -1
- package/src/email-recipient-loaders/documents.ts +2 -1
- package/src/email-recipient-loaders/members.ts +2 -1
- package/src/email-recipient-loaders/orders.ts +2 -1
- package/src/email-recipient-loaders/payments.ts +6 -3
- package/src/email-recipient-loaders/receivable-balances.ts +2 -1
- package/src/email-recipient-loaders/registrations.ts +2 -1
- package/src/email-replacements/getEmailReplacementsForPayment.ts +8 -7
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +7 -6
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +3 -2
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +2 -1
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +4 -3
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +3 -2
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +7 -5
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +12 -10
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +4 -3
- package/src/endpoints/auth/CreateAdminEndpoint.ts +8 -6
- package/src/endpoints/auth/CreateTokenEndpoint.ts +14 -12
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/DeleteUserEndpoint.ts +2 -1
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +5 -4
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +3 -2
- package/src/endpoints/auth/GetUserEndpoint.ts +3 -2
- package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/OpenIDConnectCallbackEndpoint.ts +4 -2
- package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +3 -2
- package/src/endpoints/auth/PatchUserEndpoint.ts +15 -12
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/SignupEndpoint.ts +5 -4
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +6 -5
- package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +3 -2
- package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +8 -5
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +5 -3
- package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +8 -5
- package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +9 -7
- package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +4 -3
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +4 -2
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +9 -7
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +22 -19
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +6 -4
- package/src/endpoints/global/email/GetEmailEndpoint.ts +4 -3
- package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +3 -2
- package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +7 -4
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +7 -5
- package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +11 -11
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +14 -11
- package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +3 -2
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +8 -5
- package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +7 -5
- package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +4 -3
- package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +9 -6
- package/src/endpoints/global/events/GetEventsEndpoint.ts +7 -4
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +17 -15
- package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +28 -26
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +8 -5
- package/src/endpoints/global/files/GetFileCache.ts +5 -3
- package/src/endpoints/global/files/UploadFile.ts +10 -4
- package/src/endpoints/global/files/UploadImage.ts +4 -2
- package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +4 -2
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +8 -5
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +7 -5
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +3 -2
- package/src/endpoints/global/members/GetMembersEndpoint.test.ts +4 -2
- package/src/endpoints/global/members/GetMembersEndpoint.ts +10 -8
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +257 -6
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +162 -107
- package/src/endpoints/global/members/helpers/validateGroupFilter.ts +4 -3
- package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +3 -2
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +8 -7
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +5 -3
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +5 -3
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +8 -5
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +4 -2
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +2 -1
- package/src/endpoints/global/platform/GetPlatformEndpoint.ts +3 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +3 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +7 -4
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +47 -0
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +206 -0
- package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +2 -1
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +10 -7
- package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +4 -2
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +3 -2
- package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +2 -1
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +5 -3
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +13 -9
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +50 -49
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +25 -22
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -5
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +9 -7
- package/src/endpoints/global/sso/GetSSOEndpoint.ts +4 -2
- package/src/endpoints/global/sso/SetSSOEndpoint.ts +3 -2
- package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +4 -2
- package/src/endpoints/global/webshops/GetWebshopsCountEndpoint.ts +43 -0
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.test.ts +808 -0
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.ts +221 -0
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +15 -13
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +9 -7
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +36 -1
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +13 -4
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +6 -3
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +4 -2
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +3 -2
- package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +5 -3
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +22 -19
- package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +11 -9
- package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +8 -7
- package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +18 -16
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +2 -1
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +8 -5
- package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +4 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +32 -29
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +6 -3
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +7 -6
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/webshops/{GetWebshopTicketsCountEndpoint → GetWebshopTicketsCountEndpoint.ts} +7 -7
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +9 -6
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +13 -12
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -1
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +6 -4
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +4 -3
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +4 -3
- package/src/endpoints/organization/shared/GetUitpasNumberDetailsEndpoint.ts +3 -2
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +5 -4
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +7 -5
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +7 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +11 -10
- package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +5 -4
- package/src/endpoints/system/HealthEndpoint.test.ts +44 -0
- package/src/endpoints/system/HealthEndpoint.ts +14 -6
- package/src/excel-loaders/balance-items.ts +19 -17
- package/src/excel-loaders/event-notifications.ts +15 -13
- package/src/excel-loaders/index.ts +1 -0
- package/src/excel-loaders/members.ts +45 -43
- package/src/excel-loaders/organizations.ts +26 -25
- package/src/excel-loaders/payments.ts +44 -42
- package/src/excel-loaders/platform-memberships.ts +202 -0
- package/src/excel-loaders/receivable-balances.ts +25 -23
- package/src/excel-loaders/registrations.ts +30 -28
- package/src/helpers/AddressValidator.test.ts +2 -1
- package/src/helpers/AddressValidator.ts +13 -10
- package/src/helpers/AdminPermissionChecker.ts +193 -95
- package/src/helpers/AuthenticatedStructures.ts +13 -11
- package/src/helpers/BuckarooHelper.ts +3 -2
- package/src/helpers/Context.ts +8 -6
- package/src/helpers/CookieHelper.ts +2 -2
- package/src/helpers/FileCache.ts +9 -9
- package/src/helpers/ForwardHandler.ts +3 -2
- package/src/helpers/GlobalHelper.ts +2 -0
- package/src/helpers/GroupBuilder.ts +2 -1
- package/src/helpers/GroupedThrottledQueue.test.ts +19 -19
- package/src/helpers/LimitedFilteredRequestHelper.ts +1 -1
- package/src/helpers/MemberCharger.ts +2 -1
- package/src/helpers/MemberUserSyncer.ts +6 -3
- package/src/helpers/MembershipCharger.ts +2 -2
- package/src/helpers/OrganizationCharger.ts +2 -1
- package/src/helpers/PeriodHelper.ts +2 -1
- package/src/helpers/SQLTranslatedString.ts +3 -2
- package/src/helpers/ServiceFeeHelper.ts +1 -1
- package/src/helpers/SetupStepUpdater.ts +6 -5
- package/src/helpers/StripeHelper.ts +9 -8
- package/src/helpers/TagHelper.test.ts +5 -5
- package/src/helpers/TagHelper.ts +2 -1
- package/src/helpers/TemporaryMemberAccess.ts +2 -1
- package/src/helpers/ThrottledQueue.test.ts +20 -20
- package/src/helpers/UitpasTokenRepository.ts +7 -7
- package/src/helpers/ViesHelper.ts +5 -4
- package/src/helpers/XlsxTransformerColumnHelper.ts +21 -19
- package/src/helpers/email-html-helpers.ts +13 -12
- package/src/helpers/fetchToAsyncIterator.ts +1 -1
- package/src/helpers/outstandingBalanceJoin.ts +2 -1
- package/src/helpers/updateMemberDetailsUitpasNumber.ts +5 -4
- package/src/middleware/ContextMiddleware.ts +1 -1
- package/src/migrate.ts +21 -4
- package/src/seeds/0000000003-default-email-templates.ts +1 -1
- package/src/seeds/0000000004-single-organization.ts +2 -1
- package/src/seeds/1752848561-groups-registration-periods.ts +3 -2
- package/src/seeds/1754560914-groups-prices.test.ts +2 -1
- package/src/seeds/1754560914-groups-prices.ts +2 -1
- package/src/seeds/1755790070-fill-email-recipient-errors.ts +6 -6
- package/src/seeds/1755876819-remove-duplicate-members.ts +2 -1
- package/src/seeds/1765896674-document-update-year.test.ts +2 -1
- package/src/seeds/1773754928-force-save-members.ts +15 -0
- package/src/services/AuditLogService.ts +3 -2
- package/src/services/BalanceItemPaymentService.ts +2 -2
- package/src/services/BalanceItemService.ts +2 -1
- package/src/services/BootChecksService.test.ts +33 -0
- package/src/services/BootChecksService.ts +21 -0
- package/src/services/DatabaseCollationService.test.ts +18 -0
- package/src/services/DatabaseCollationService.ts +81 -0
- package/src/services/DocumentService.ts +1 -1
- package/src/services/EventNotificationService.ts +5 -4
- package/src/services/FileSignService.ts +2 -2
- package/src/services/InvoiceService.ts +3 -3
- package/src/services/MemberNumberService.ts +6 -4
- package/src/services/MemberRecordStore.ts +28 -19
- package/src/services/PaymentReallocationService.test.ts +2 -1
- package/src/services/PaymentReallocationService.ts +2 -1
- package/src/services/PaymentService.ts +28 -26
- package/src/services/RegistrationService.ts +65 -3
- package/src/services/SSOService.ts +13 -9
- package/src/services/STPackageService.ts +7 -5
- package/src/services/StartupHealthService.ts +15 -0
- package/src/services/uitpas/PassholderEndpoints.ts +2 -2
- package/src/services/uitpas/UitpasService.ts +11 -8
- package/src/services/uitpas/cancelTicketSales.ts +1 -1
- package/src/services/uitpas/checkPermissionsFor.ts +9 -9
- package/src/services/uitpas/getSocialTariffForEvent.ts +4 -4
- package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +5 -5
- package/src/services/uitpas/handleUitpasResponse.ts +1 -1
- package/src/services/uitpas/registerTicketSales.ts +4 -4
- package/src/services/uitpas/searchUitpasEvents.ts +3 -3
- package/src/services/uitpas/searchUitpasOrganizers.ts +3 -3
- package/src/sql-filters/audit-logs.ts +2 -1
- package/src/sql-filters/balance-item-payments.ts +2 -1
- package/src/sql-filters/balance-items.ts +2 -1
- package/src/sql-filters/base-registration-filter-compilers.ts +6 -4
- package/src/sql-filters/document-templates.ts +2 -1
- package/src/sql-filters/documents.ts +2 -1
- package/src/sql-filters/email-recipients.ts +2 -1
- package/src/sql-filters/emails.ts +2 -1
- package/src/sql-filters/event-notifications.ts +2 -1
- package/src/sql-filters/events.ts +2 -1
- package/src/sql-filters/groups.ts +2 -1
- package/src/sql-filters/invoiced-balance-items.ts +2 -1
- package/src/sql-filters/invoices.ts +2 -1
- package/src/sql-filters/member-responsibility-records.ts +2 -1
- package/src/sql-filters/members.ts +8 -7
- package/src/sql-filters/orders.ts +3 -2
- package/src/sql-filters/organization-registration-periods.ts +2 -1
- package/src/sql-filters/organizations.ts +2 -1
- package/src/sql-filters/payments.ts +2 -1
- package/src/sql-filters/platform-memberships.ts +67 -0
- package/src/sql-filters/receivable-balances.ts +2 -1
- package/src/sql-filters/registration-periods.ts +2 -1
- package/src/sql-filters/registrations.ts +2 -1
- package/src/sql-filters/tickets.ts +2 -1
- package/src/sql-filters/users.ts +2 -1
- package/src/sql-filters/webshops.ts +38 -0
- package/src/sql-sorters/audit-logs.ts +3 -2
- package/src/sql-sorters/balance-items.ts +3 -2
- package/src/sql-sorters/document-templates.ts +3 -2
- package/src/sql-sorters/documents.ts +3 -2
- package/src/sql-sorters/email-recipients.ts +3 -2
- package/src/sql-sorters/emails.ts +3 -2
- package/src/sql-sorters/event-notifications.ts +3 -2
- package/src/sql-sorters/events.ts +3 -2
- package/src/sql-sorters/groups.ts +3 -2
- package/src/sql-sorters/invoices.ts +3 -2
- package/src/sql-sorters/members.ts +3 -2
- package/src/sql-sorters/orders.ts +3 -2
- package/src/sql-sorters/organization-registration-periods.ts +3 -2
- package/src/sql-sorters/organizations.ts +3 -2
- package/src/sql-sorters/payments.ts +3 -2
- package/src/sql-sorters/platform-memberships.ts +40 -0
- package/src/sql-sorters/receivable-balances.ts +3 -2
- package/src/sql-sorters/registration-periods.ts +3 -2
- package/src/sql-sorters/registrations.ts +3 -2
- package/src/sql-sorters/tickets.ts +3 -2
- package/src/sql-sorters/webshops.ts +40 -0
- package/tests/actions/patchOrganizationMember.ts +5 -4
- package/tests/actions/patchPaymentStatus.ts +2 -2
- package/tests/actions/patchUserMember.ts +6 -4
- package/tests/e2e/api-rate-limits.test.ts +4 -5
- package/tests/e2e/bundle-discounts.test.ts +3 -2
- package/tests/e2e/charge-members.test.ts +7 -5
- package/tests/e2e/documents.test.ts +3 -2
- package/tests/e2e/private-files.test.ts +11 -13
- package/tests/e2e/register.test.ts +6 -5
- package/tests/e2e/stock.test.ts +6 -8
- package/tests/e2e/tickets.test.ts +4 -2
- package/tests/helpers/StripeMocker.ts +3 -3
- package/tests/init/initAdmin.ts +4 -2
- package/tests/init/initBundleDiscount.ts +3 -2
- package/tests/init/initPayconiq.ts +1 -1
- package/tests/init/initPermissionRole.ts +4 -2
- package/tests/init/initPlatformRecordCategory.ts +1 -1
- package/tests/init/initStripe.ts +1 -1
- package/tests/vitest.global.setup.ts +26 -0
- package/tests/{jest.setup.ts → vitest.setup.ts} +4 -3
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +10 -41
- package/tsconfig.test.json +17 -0
- package/vitest.config.js +13 -0
- package/eslint.config.mjs +0 -5
- package/jest.config.cjs +0 -27
- package/tests/jest.global.setup.ts +0 -33
- package/tests/toMatchMap.ts +0 -68
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { AutoEncoderPatchType, Decoder,
|
|
2
|
-
import {
|
|
1
|
+
import type { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { isEmptyPatch, 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
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import type { Group, Registration } from '@stamhoofd/models';
|
|
7
|
+
import { Document, Member, RateLimiter } from '@stamhoofd/models';
|
|
8
|
+
import type { MemberDetails, MembersBlob} from '@stamhoofd/structures';
|
|
9
|
+
import { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
|
|
6
10
|
|
|
7
|
-
import { OneToManyRelation } from '@simonbackx/simple-database';
|
|
11
|
+
import type { OneToManyRelation } from '@simonbackx/simple-database';
|
|
8
12
|
import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures.js';
|
|
9
13
|
import { Context } from '../../../helpers/Context.js';
|
|
10
14
|
import { MemberUserSyncer } from '../../../helpers/MemberUserSyncer.js';
|
|
@@ -98,7 +102,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
98
102
|
throw new SimpleError({
|
|
99
103
|
code: 'not_allowed',
|
|
100
104
|
message: 'Cannot override details',
|
|
101
|
-
human: $t(`
|
|
105
|
+
human: $t(`%Dj`),
|
|
102
106
|
field: 'details',
|
|
103
107
|
});
|
|
104
108
|
}
|
|
@@ -122,7 +126,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
122
126
|
throw new SimpleError({
|
|
123
127
|
code: 'invalid_data',
|
|
124
128
|
message: 'No details provided',
|
|
125
|
-
human: $t(`
|
|
129
|
+
human: $t(`%EG`),
|
|
126
130
|
field: 'details',
|
|
127
131
|
});
|
|
128
132
|
}
|
|
@@ -186,7 +190,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
186
190
|
if (details.firstName.length < 2) {
|
|
187
191
|
throw new SimpleError({
|
|
188
192
|
code: 'invalid_field',
|
|
189
|
-
message: $t(`
|
|
193
|
+
message: $t(`%EH`),
|
|
190
194
|
field: 'firstName',
|
|
191
195
|
});
|
|
192
196
|
}
|
|
@@ -194,7 +198,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
194
198
|
if (details.lastName.length < 2) {
|
|
195
199
|
throw new SimpleError({
|
|
196
200
|
code: 'invalid_field',
|
|
197
|
-
message: $t(`
|
|
201
|
+
message: $t(`%EI`),
|
|
198
202
|
field: 'lastName',
|
|
199
203
|
});
|
|
200
204
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { PatchMap } from '@simonbackx/simple-encoding';
|
|
2
2
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { EmailMocker } from '@stamhoofd/email';
|
|
4
|
-
import {
|
|
4
|
+
import type { MemberWithUsersRegistrationsAndGroups, Organization, RegistrationPeriod} from '@stamhoofd/models';
|
|
5
|
+
import { BalanceItemFactory, Group, GroupFactory, Member, MemberFactory, OrganizationFactory, OrganizationRegistrationPeriodFactory, Registration, RegistrationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
5
6
|
import { AccessRight, BalanceItemCartItem, BalanceItemStatus, BalanceItemType, BooleanStatus, Company, GroupOption, GroupOptionMenu, IDRegisterCart, IDRegisterCheckout, IDRegisterItem, OrganizationPackages, PaymentCustomer, PaymentMethod, PermissionLevel, Permissions, PermissionsResourceType, ReduceablePrice, RegisterItemOption, ResourcePermissions, STPackageStatus, STPackageType, UitpasNumberDetails, UitpasSocialTariff, UitpasSocialTariffStatus, UserPermissions, Version } from '@stamhoofd/structures';
|
|
6
7
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
7
8
|
import { v4 as uuidv4 } from 'uuid';
|
|
@@ -46,8 +47,8 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
afterEach(() => {
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
vitest.restoreAllMocks();
|
|
51
|
+
vitest.useRealTimers();
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
const initOrganization = async (registrationPeriod: RegistrationPeriod = period) => {
|
|
@@ -274,9 +275,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
274
275
|
|
|
275
276
|
await balanceItem1.delete();
|
|
276
277
|
|
|
277
|
-
await expect(
|
|
278
|
+
await expect(post(body, organization, token))
|
|
278
279
|
.rejects
|
|
279
|
-
.toThrow(
|
|
280
|
+
.toThrow('Oeps, één of meerdere openstaande bedragen in jouw winkelmandje zijn aangepast');
|
|
280
281
|
});
|
|
281
282
|
|
|
282
283
|
test('Should fail if balance item price difference', async () => {
|
|
@@ -348,9 +349,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
348
349
|
// #endregion
|
|
349
350
|
|
|
350
351
|
// #region act and assert
|
|
351
|
-
await expect(
|
|
352
|
+
await expect(post(body, organization, token))
|
|
352
353
|
.rejects
|
|
353
|
-
.toThrow(
|
|
354
|
+
.toThrow('Member not found');
|
|
354
355
|
// #endregion
|
|
355
356
|
});
|
|
356
357
|
|
|
@@ -387,9 +388,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
387
388
|
// #region act and assert
|
|
388
389
|
await balanceItem1.delete();
|
|
389
390
|
|
|
390
|
-
await expect(
|
|
391
|
+
await expect(post(body, organization, token))
|
|
391
392
|
.rejects
|
|
392
|
-
.toThrow(
|
|
393
|
+
.toThrow('Oeps, jouw mandje is leeg.');
|
|
393
394
|
// #endregion
|
|
394
395
|
});
|
|
395
396
|
|
|
@@ -418,7 +419,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
418
419
|
customer: null,
|
|
419
420
|
});
|
|
420
421
|
|
|
421
|
-
await expect(
|
|
422
|
+
await expect(post(body, organization, token))
|
|
422
423
|
.rejects
|
|
423
424
|
.toThrow(STExpect.simpleError({ code: 'changed_price' }));
|
|
424
425
|
});
|
|
@@ -454,7 +455,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
454
455
|
await post(body, organization, token);
|
|
455
456
|
|
|
456
457
|
// second time should fail
|
|
457
|
-
await expect(
|
|
458
|
+
await expect(post(body, organization, token))
|
|
458
459
|
.rejects
|
|
459
460
|
.toThrow(STExpect.simpleError({ code: 'already_registered' }));
|
|
460
461
|
});
|
|
@@ -492,7 +493,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
492
493
|
customer: null,
|
|
493
494
|
});
|
|
494
495
|
|
|
495
|
-
await expect(
|
|
496
|
+
await expect(post(body, organization, token))
|
|
496
497
|
.rejects
|
|
497
498
|
.toThrow(STExpect.simpleErrors([
|
|
498
499
|
{ code: 'duplicate_register_item' },
|
|
@@ -530,9 +531,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
530
531
|
// #endregion
|
|
531
532
|
|
|
532
533
|
// #region act and assert
|
|
533
|
-
await expect(
|
|
534
|
+
await expect(post(body, organization, token))
|
|
534
535
|
.rejects
|
|
535
|
-
.toThrow(
|
|
536
|
+
.toThrow('Oeps, je hebt geen geldige betaalmethode geselecteerd');
|
|
536
537
|
// #endregion
|
|
537
538
|
});
|
|
538
539
|
|
|
@@ -569,9 +570,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
569
570
|
// #endregion
|
|
570
571
|
|
|
571
572
|
// #region act and assert
|
|
572
|
-
await expect(
|
|
573
|
+
await expect(post(body, organization, token))
|
|
573
574
|
.rejects
|
|
574
|
-
.toThrow(
|
|
575
|
+
.toThrow('redirectUrl or cancelUrl is missing');
|
|
575
576
|
// #endregion
|
|
576
577
|
});
|
|
577
578
|
|
|
@@ -602,9 +603,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
602
603
|
customer: null,
|
|
603
604
|
});
|
|
604
605
|
|
|
605
|
-
await expect(
|
|
606
|
+
await expect(post(body, organization, token))
|
|
606
607
|
.rejects
|
|
607
|
-
.toThrow(
|
|
608
|
+
.toThrow('redirectUrl or cancelUrl is missing');
|
|
608
609
|
});
|
|
609
610
|
|
|
610
611
|
test('Should not reserve for point of sale payment method if group has max members', async () => {
|
|
@@ -880,7 +881,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
880
881
|
test('Register for group with trial should set trial period', async () => {
|
|
881
882
|
// #region arrange
|
|
882
883
|
const date = new Date('2023-05-14');
|
|
883
|
-
|
|
884
|
+
vitest.useFakeTimers({ shouldAdvanceTime: true, toFake: ['Date'] }).setSystemTime(date);
|
|
884
885
|
|
|
885
886
|
try {
|
|
886
887
|
const { member, group, groupPrice, organization, token } = await initData();
|
|
@@ -926,7 +927,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
926
927
|
expect(trialUntil!.getDate()).toBe(19);
|
|
927
928
|
}
|
|
928
929
|
finally {
|
|
929
|
-
|
|
930
|
+
vitest.useRealTimers();
|
|
930
931
|
}
|
|
931
932
|
}, 20_00000);
|
|
932
933
|
|
|
@@ -1013,9 +1014,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
1013
1014
|
// #region act and assert
|
|
1014
1015
|
expect(group?.stockReservations.length).toBe(0);
|
|
1015
1016
|
|
|
1016
|
-
await expect(
|
|
1017
|
+
await expect(post(body, organization, token))
|
|
1017
1018
|
.rejects
|
|
1018
|
-
.toThrow(
|
|
1019
|
+
.toThrow('Maximum reached');
|
|
1019
1020
|
// #endregion
|
|
1020
1021
|
});
|
|
1021
1022
|
|
|
@@ -1090,9 +1091,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
1090
1091
|
// #endregion
|
|
1091
1092
|
|
|
1092
1093
|
// #region act and assert
|
|
1093
|
-
await expect(
|
|
1094
|
+
await expect(post(body, organization, token))
|
|
1094
1095
|
.rejects
|
|
1095
|
-
.toThrow(
|
|
1096
|
+
.toThrow('Stock empty');
|
|
1096
1097
|
// #endregion
|
|
1097
1098
|
});
|
|
1098
1099
|
|
|
@@ -1168,9 +1169,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
1168
1169
|
customer: null,
|
|
1169
1170
|
});
|
|
1170
1171
|
|
|
1171
|
-
await expect(
|
|
1172
|
+
await expect(post(body, organization, token))
|
|
1172
1173
|
.rejects
|
|
1173
|
-
.toThrow(
|
|
1174
|
+
.toThrow('Option maximum exceeded');
|
|
1174
1175
|
});
|
|
1175
1176
|
|
|
1176
1177
|
test('Should not fail if max option not exceeded', async () => {
|
|
@@ -1295,7 +1296,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
1295
1296
|
// act
|
|
1296
1297
|
|
|
1297
1298
|
// should throw error
|
|
1298
|
-
await expect(
|
|
1299
|
+
await expect(post(body, organization, token))
|
|
1299
1300
|
.rejects
|
|
1300
1301
|
.toThrow(STExpect.errorWithCode('changed_price'));
|
|
1301
1302
|
|
|
@@ -2005,7 +2006,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2005
2006
|
});
|
|
2006
2007
|
|
|
2007
2008
|
// send request and check occupancy
|
|
2008
|
-
await expect(
|
|
2009
|
+
await expect(post(body, organization, token)).rejects.toThrow('No permission to register in this group');
|
|
2009
2010
|
});
|
|
2010
2011
|
|
|
2011
2012
|
test('Cannot register a member with only read permissions even when having full permissions to the specific member', async () => {
|
|
@@ -2041,7 +2042,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2041
2042
|
});
|
|
2042
2043
|
|
|
2043
2044
|
// send request and check occupancy
|
|
2044
|
-
await expect(
|
|
2045
|
+
await expect(post(body, organization, token)).rejects.toThrow('No permission to register in this group');
|
|
2045
2046
|
});
|
|
2046
2047
|
});
|
|
2047
2048
|
|
|
@@ -2165,7 +2166,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2165
2166
|
asOrganizationId: organization2.id,
|
|
2166
2167
|
});
|
|
2167
2168
|
|
|
2168
|
-
await expect(
|
|
2169
|
+
await expect(post(body, organization, token))
|
|
2169
2170
|
.rejects
|
|
2170
2171
|
.toThrow(STExpect.simpleError({ code: 'forbidden' }));
|
|
2171
2172
|
});
|
|
@@ -2201,7 +2202,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2201
2202
|
asOrganizationId: organization2.id,
|
|
2202
2203
|
});
|
|
2203
2204
|
|
|
2204
|
-
await expect(
|
|
2205
|
+
await expect(post(body, organization, token))
|
|
2205
2206
|
.rejects
|
|
2206
2207
|
.toThrow(STExpect.simpleError({ code: 'as_organization_disabled' }));
|
|
2207
2208
|
});
|
|
@@ -2234,9 +2235,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2234
2235
|
asOrganizationId: organization2.id,
|
|
2235
2236
|
});
|
|
2236
2237
|
|
|
2237
|
-
await expect(
|
|
2238
|
+
await expect(post(body, organization, token))
|
|
2238
2239
|
.rejects
|
|
2239
|
-
.toThrow(
|
|
2240
|
+
.toThrow('customer is required when paying as an organization');
|
|
2240
2241
|
});
|
|
2241
2242
|
|
|
2242
2243
|
test('Deleting registrations is not allowed', async () => {
|
|
@@ -2272,7 +2273,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2272
2273
|
customer: null,
|
|
2273
2274
|
});
|
|
2274
2275
|
|
|
2275
|
-
await expect(
|
|
2276
|
+
await expect(post(body, organization, token))
|
|
2276
2277
|
.rejects
|
|
2277
2278
|
.toThrow(STExpect.simpleError({ code: 'forbidden' }));
|
|
2278
2279
|
});
|
|
@@ -2307,9 +2308,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2307
2308
|
asOrganizationId: organization2.id,
|
|
2308
2309
|
});
|
|
2309
2310
|
|
|
2310
|
-
await expect(
|
|
2311
|
+
await expect(post(body, organization, token))
|
|
2311
2312
|
.rejects
|
|
2312
|
-
.toThrow(
|
|
2313
|
+
.toThrow('customer.company is required');
|
|
2313
2314
|
});
|
|
2314
2315
|
|
|
2315
2316
|
test('Should fail if company does not exist on organization', async () => {
|
|
@@ -2344,9 +2345,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2344
2345
|
asOrganizationId: organization2.id,
|
|
2345
2346
|
});
|
|
2346
2347
|
|
|
2347
|
-
await expect(
|
|
2348
|
+
await expect(post(body, organization, token))
|
|
2348
2349
|
.rejects
|
|
2349
|
-
.toThrow(
|
|
2350
|
+
.toThrow('Oeps, de facturatiegegevens die je probeerde te selecteren lijken niet meer te bestaan.');
|
|
2350
2351
|
});
|
|
2351
2352
|
});
|
|
2352
2353
|
|
|
@@ -2609,9 +2610,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2609
2610
|
// #endregion
|
|
2610
2611
|
|
|
2611
2612
|
// #region act and assert
|
|
2612
|
-
await expect(
|
|
2613
|
+
await expect(post(body, organization, token))
|
|
2613
2614
|
.rejects
|
|
2614
|
-
.toThrow(
|
|
2615
|
+
.toThrow('Registration not found');
|
|
2615
2616
|
// #endregion
|
|
2616
2617
|
});
|
|
2617
2618
|
|
|
@@ -2660,7 +2661,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2660
2661
|
});
|
|
2661
2662
|
|
|
2662
2663
|
// send request and check occupancy
|
|
2663
|
-
await expect(
|
|
2664
|
+
await expect(post(body, organization, token)).rejects.toThrow('Not allowed to move registrations');
|
|
2664
2665
|
});
|
|
2665
2666
|
});
|
|
2666
2667
|
|
|
@@ -2783,7 +2784,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2783
2784
|
customer: null,
|
|
2784
2785
|
});
|
|
2785
2786
|
|
|
2786
|
-
await expect(
|
|
2787
|
+
await expect(post(body, organization1, token)).rejects.toThrow('Permission denied: you are not allowed to delete registrations');
|
|
2787
2788
|
});
|
|
2788
2789
|
|
|
2789
2790
|
test('Should deactivate registration', async () => {
|
|
@@ -2936,7 +2937,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2936
2937
|
customer: null,
|
|
2937
2938
|
});
|
|
2938
2939
|
|
|
2939
|
-
await expect(
|
|
2940
|
+
await expect(post(body2, organization, token))
|
|
2940
2941
|
.rejects
|
|
2941
2942
|
.toThrow(STExpect.simpleError({
|
|
2942
2943
|
field: 'cancellationFeePercentage',
|
|
@@ -2987,9 +2988,9 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
2987
2988
|
customer: null,
|
|
2988
2989
|
});
|
|
2989
2990
|
|
|
2990
|
-
await expect(
|
|
2991
|
+
await expect(post(body, organization, token))
|
|
2991
2992
|
.rejects
|
|
2992
|
-
.toThrow(
|
|
2993
|
+
.toThrow('Permission denied: you are not allowed to delete registrations');
|
|
2993
2994
|
});
|
|
2994
2995
|
|
|
2995
2996
|
test('Cannot delete registrations as admin if no write permission to group', async () => {
|
|
@@ -3020,7 +3021,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
3020
3021
|
asOrganizationId: organization.id,
|
|
3021
3022
|
});
|
|
3022
3023
|
|
|
3023
|
-
await expect(
|
|
3024
|
+
await expect(post(body, organization, token)).rejects.toThrow(/No permission to delete this registration/);
|
|
3024
3025
|
});
|
|
3025
3026
|
|
|
3026
3027
|
/**
|
|
@@ -3052,7 +3053,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
3052
3053
|
asOrganizationId: organization.id,
|
|
3053
3054
|
});
|
|
3054
3055
|
|
|
3055
|
-
await expect(
|
|
3056
|
+
await expect(post(body, organization, token)).rejects.toThrow(/No permission to delete this registration/);
|
|
3056
3057
|
});
|
|
3057
3058
|
|
|
3058
3059
|
test('Should fail if registration does not exist anymore', async () => {
|
|
@@ -3100,7 +3101,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
3100
3101
|
|
|
3101
3102
|
// #region act and assert
|
|
3102
3103
|
await registration.delete();
|
|
3103
|
-
await expect(
|
|
3104
|
+
await expect(post(body, organization, token)).rejects.toThrow('Registration not found');
|
|
3104
3105
|
// #endregion
|
|
3105
3106
|
});
|
|
3106
3107
|
|
|
@@ -3181,7 +3182,7 @@ describe('Endpoint.RegisterMembers', () => {
|
|
|
3181
3182
|
|
|
3182
3183
|
// #region act and assert
|
|
3183
3184
|
await post(body1, organization, token);
|
|
3184
|
-
await expect(
|
|
3185
|
+
await expect(post(body2, organization, token)).rejects.toThrow(/No permission to delete this registration/);
|
|
3185
3186
|
// #endregion
|
|
3186
3187
|
});
|
|
3187
3188
|
});
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { createMollieClient, PaymentMethod as molliePaymentMethod } from '@mollie/api-client';
|
|
2
2
|
import { ManyToOneRelation } from '@simonbackx/simple-database';
|
|
3
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
4
|
-
import { DecodedRequest,
|
|
3
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
4
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
5
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
5
6
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
7
|
import { Email } from '@stamhoofd/email';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import type { MemberWithUsersRegistrationsAndGroups, Organization, Payment} from '@stamhoofd/models';
|
|
9
|
+
import { BalanceItem, BalanceItemPayment, CachedBalance, Group, Member, MolliePayment, MollieToken, PayconiqPayment, Platform, RateLimiter, Registration, User } from '@stamhoofd/models';
|
|
10
|
+
import type { BalanceItem as BalanceItemStruct, PlatformMember, RegisterItem} from '@stamhoofd/structures';
|
|
11
|
+
import { BalanceItemRelation, BalanceItemRelationType, BalanceItemStatus, BalanceItemType, IDRegisterCheckout, PaymentCustomer, PaymentMethod, PaymentMethodHelper, PaymentProvider, PaymentStatus, Payment as PaymentStruct, PaymentType, PermissionLevel, PlatformFamily, ReceivableBalanceType, RegisterResponse, TranslatedString, Version } from '@stamhoofd/structures';
|
|
9
12
|
import { Formatter, sleep } from '@stamhoofd/utility';
|
|
10
13
|
|
|
11
14
|
import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures.js';
|
|
@@ -57,7 +60,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
57
60
|
throw new SimpleError({
|
|
58
61
|
code: 'not_supported',
|
|
59
62
|
message: 'This version is no longer supported',
|
|
60
|
-
human: $t(`
|
|
63
|
+
human: $t(`%vd`),
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
66
|
return [true, params as Params];
|
|
@@ -78,7 +81,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
78
81
|
throw new SimpleError({
|
|
79
82
|
code: 'forbidden',
|
|
80
83
|
message: 'No permission to register members manually',
|
|
81
|
-
human: $t(`
|
|
84
|
+
human: $t(`%ve`),
|
|
82
85
|
statusCode: 403,
|
|
83
86
|
});
|
|
84
87
|
}
|
|
@@ -93,7 +96,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
93
96
|
throw new SimpleError({
|
|
94
97
|
code: 'forbidden',
|
|
95
98
|
message: 'No permission to checkout as this organization for a different organization',
|
|
96
|
-
human: $t(`
|
|
99
|
+
human: $t(`%1HR`),
|
|
97
100
|
statusCode: 403,
|
|
98
101
|
});
|
|
99
102
|
}
|
|
@@ -118,7 +121,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
118
121
|
throw new SimpleError({
|
|
119
122
|
code: 'too_many_emails_period',
|
|
120
123
|
message: 'Too many e-mails limited',
|
|
121
|
-
human: $t(`
|
|
124
|
+
human: $t(`%vf`),
|
|
122
125
|
field: 'recipients',
|
|
123
126
|
});
|
|
124
127
|
}
|
|
@@ -139,7 +142,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
139
142
|
if (balanceItemsModels.length !== balanceItemIds.length) {
|
|
140
143
|
throw new SimpleError({
|
|
141
144
|
code: 'invalid_data',
|
|
142
|
-
message: $t(`
|
|
145
|
+
message: $t(`%vg`),
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
148
|
memberBalanceItemsStructs = balanceItemsModels.map(i => i.getStructure());
|
|
@@ -163,7 +166,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
163
166
|
if (group.organizationId !== organization.id) {
|
|
164
167
|
throw new SimpleError({
|
|
165
168
|
code: 'invalid_data',
|
|
166
|
-
message: $t(`
|
|
169
|
+
message: $t(`%vh`),
|
|
167
170
|
});
|
|
168
171
|
}
|
|
169
172
|
}
|
|
@@ -178,7 +181,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
178
181
|
throw new SimpleError({
|
|
179
182
|
code: 'forbidden',
|
|
180
183
|
message: 'No permission to register this member',
|
|
181
|
-
human: $t(`
|
|
184
|
+
human: $t(`%vi`),
|
|
182
185
|
statusCode: 403,
|
|
183
186
|
});
|
|
184
187
|
}
|
|
@@ -242,7 +245,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
242
245
|
throw new SimpleError({
|
|
243
246
|
code: 'forbidden',
|
|
244
247
|
message: 'No permission to register as this organization for a different organization',
|
|
245
|
-
human: $t(`
|
|
248
|
+
human: $t(`%ve`),
|
|
246
249
|
statusCode: 403,
|
|
247
250
|
});
|
|
248
251
|
}
|
|
@@ -278,7 +281,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
278
281
|
if (checkout.cart.isEmpty) {
|
|
279
282
|
throw new SimpleError({
|
|
280
283
|
code: 'empty_data',
|
|
281
|
-
message: $t(`
|
|
284
|
+
message: $t(`%vj`),
|
|
282
285
|
});
|
|
283
286
|
}
|
|
284
287
|
|
|
@@ -298,7 +301,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
298
301
|
// This never leaks information because in this case the user already has full access to the organization (asOrganizationId) or the member
|
|
299
302
|
throw new SimpleError({
|
|
300
303
|
code: 'changed_price',
|
|
301
|
-
message: $t(
|
|
304
|
+
message: $t(`%vk`, { total: Formatter.price(totalPrice) }),
|
|
302
305
|
});
|
|
303
306
|
}
|
|
304
307
|
}
|
|
@@ -318,7 +321,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
318
321
|
if (!member) {
|
|
319
322
|
throw new SimpleError({
|
|
320
323
|
code: 'invalid_member',
|
|
321
|
-
message: $t(`
|
|
324
|
+
message: $t(`%vm`),
|
|
322
325
|
});
|
|
323
326
|
}
|
|
324
327
|
|
|
@@ -326,7 +329,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
326
329
|
if (!group) {
|
|
327
330
|
throw new SimpleError({
|
|
328
331
|
code: 'invalid_member',
|
|
329
|
-
message: $t(`
|
|
332
|
+
message: $t(`%vn`),
|
|
330
333
|
});
|
|
331
334
|
}
|
|
332
335
|
|
|
@@ -336,7 +339,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
336
339
|
throw new SimpleError({
|
|
337
340
|
code: 'forbidden',
|
|
338
341
|
message: 'No permission to register in this group',
|
|
339
|
-
human: $t('
|
|
342
|
+
human: $t('%C9', { group: group.settings.name.toString() }),
|
|
340
343
|
statusCode: 403,
|
|
341
344
|
});
|
|
342
345
|
}
|
|
@@ -359,7 +362,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
359
362
|
if (existingRegistration.registeredAt !== null && existingRegistration.deactivatedAt === null) {
|
|
360
363
|
throw new SimpleError({
|
|
361
364
|
code: 'already_registered',
|
|
362
|
-
message: $t(
|
|
365
|
+
message: $t(`%vo`, { member: member.firstName, group: group.settings.name }),
|
|
363
366
|
});
|
|
364
367
|
}
|
|
365
368
|
}
|
|
@@ -469,7 +472,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
469
472
|
throw new SimpleError({
|
|
470
473
|
code: 'forbidden',
|
|
471
474
|
message: 'Permission denied: you are not allowed to delete registrations',
|
|
472
|
-
human: $t(`
|
|
475
|
+
human: $t(`%vr`),
|
|
473
476
|
statusCode: 403,
|
|
474
477
|
});
|
|
475
478
|
}
|
|
@@ -478,7 +481,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
478
481
|
if (!existingRegistration || existingRegistration.organizationId !== organization.id) {
|
|
479
482
|
throw new SimpleError({
|
|
480
483
|
code: 'invalid_data',
|
|
481
|
-
message: $t(`
|
|
484
|
+
message: $t(`%vs`),
|
|
482
485
|
});
|
|
483
486
|
}
|
|
484
487
|
|
|
@@ -486,7 +489,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
486
489
|
throw new SimpleError({
|
|
487
490
|
code: 'forbidden',
|
|
488
491
|
message: 'No permission to delete this registration',
|
|
489
|
-
human: $t(`
|
|
492
|
+
human: $t(`%vt`),
|
|
490
493
|
statusCode: 403,
|
|
491
494
|
});
|
|
492
495
|
}
|
|
@@ -495,7 +498,7 @@ export class RegisterMembersEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
495
498
|
throw new SimpleError({
|
|
496
499
|
code: 'invalid_data',
|
|
497
500
|
message: 'Cannot delete inactive registration',
|
|
498
|
-
human: $t(`
|
|
501
|
+
human: $t(`%vu`),
|
|
499
502
|
});
|
|
500
503
|
}
|
|
501
504
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
2
|
-
import {
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { CountFilteredRequest, RegistrationPeriod as RegistrationPeriodStruct, StamhoofdFilter } from '@stamhoofd/structures';
|
|
4
|
+
import { assertSort, getSortFilter, LimitedFilteredRequest, PaginatedResponse } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
6
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
5
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
8
|
import { RegistrationPeriod } from '@stamhoofd/models';
|
|
7
|
-
import {
|
|
9
|
+
import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
10
|
+
import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
8
11
|
import { Context } from '../../../helpers/Context.js';
|
|
9
12
|
import { registrationPeriodFilterCompilers } from '../../../sql-filters/registration-periods.js';
|
|
10
13
|
import { registrationPeriodSorters } from '../../../sql-sorters/registration-periods.js';
|
|
@@ -123,7 +126,7 @@ export class GetRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Body
|
|
|
123
126
|
code: 'client_update_required',
|
|
124
127
|
statusCode: 400,
|
|
125
128
|
message: 'Er is een noodzakelijke update beschikbaar. Herlaad de pagina en wis indien nodig de cache van jouw browser.',
|
|
126
|
-
human: $t(`
|
|
129
|
+
human: $t(`%G8`),
|
|
127
130
|
});
|
|
128
131
|
}
|
|
129
132
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ConvertArrayToPatchableArray, Decoder, PatchableArrayAutoEncoder
|
|
2
|
-
import {
|
|
1
|
+
import type { ConvertArrayToPatchableArray, Decoder, PatchableArrayAutoEncoder} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { PatchableArrayDecoder, StringDecoder, 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 { RegistrationPeriod as RegistrationPeriodStruct } from '@stamhoofd/structures';
|
|
4
6
|
|
|
5
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
@@ -42,7 +44,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
42
44
|
throw new SimpleError({
|
|
43
45
|
code: 'only_platform',
|
|
44
46
|
message: 'Period id should only be used if userMode is platform',
|
|
45
|
-
human: $t(`
|
|
47
|
+
human: $t(`%1AD`),
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -80,7 +82,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
80
82
|
if (put.endDate < put.startDate) {
|
|
81
83
|
throw new SimpleError({
|
|
82
84
|
code: 'invalid_field',
|
|
83
|
-
message: $t('
|
|
85
|
+
message: $t('%1Gv'),
|
|
84
86
|
field: 'endDate',
|
|
85
87
|
});
|
|
86
88
|
}
|
|
@@ -102,7 +104,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
102
104
|
throw new SimpleError({
|
|
103
105
|
code: 'cannot_lock_current_period',
|
|
104
106
|
message: 'Current registration period cannot be locked',
|
|
105
|
-
human: $t(`
|
|
107
|
+
human: $t(`%EJ`),
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -131,7 +133,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
131
133
|
throw new SimpleError({
|
|
132
134
|
code: 'cannot_lock_current_period',
|
|
133
135
|
message: 'Current registration period cannot be locked',
|
|
134
|
-
human: $t(`
|
|
136
|
+
human: $t(`%EJ`),
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -148,7 +150,7 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
|
|
|
148
150
|
if ((patch.startDate || patch.endDate) && model.endDate < model.startDate) {
|
|
149
151
|
throw new SimpleError({
|
|
150
152
|
code: 'invalid_field',
|
|
151
|
-
message: $t('
|
|
153
|
+
message: $t('%1Gv'),
|
|
152
154
|
field: 'endDate',
|
|
153
155
|
});
|
|
154
156
|
}
|