@stamhoofd/backend 2.119.0 → 2.120.1
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/boot.ts +40 -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 +2 -1
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +3 -2
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +2 -1
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +2 -1
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +3 -2
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +3 -2
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +6 -4
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +4 -2
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +3 -2
- package/src/endpoints/auth/CreateAdminEndpoint.ts +5 -3
- package/src/endpoints/auth/CreateTokenEndpoint.ts +4 -2
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/DeleteUserEndpoint.ts +2 -1
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +3 -2
- 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 +6 -3
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/SignupEndpoint.ts +3 -2
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +3 -2
- 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 +7 -4
- package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +6 -4
- package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +2 -1
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +4 -2
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +5 -3
- 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 +4 -2
- package/src/endpoints/global/email/GetEmailEndpoint.ts +3 -2
- package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +7 -4
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +4 -2
- package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +11 -11
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +6 -3
- 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 +7 -4
- package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +4 -2
- package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +2 -1
- package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +8 -5
- 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 +4 -2
- package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +4 -2
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +7 -4
- package/src/endpoints/global/files/GetFileCache.ts +5 -3
- package/src/endpoints/global/files/UploadFile.ts +9 -3
- 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 +7 -4
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +5 -3
- 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 +8 -6
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +257 -6
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +114 -59
- package/src/endpoints/global/members/helpers/validateGroupFilter.ts +2 -1
- package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +3 -2
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +2 -1
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +3 -2
- 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 +6 -3
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +47 -0
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +211 -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 +8 -5
- 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 +9 -5
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +50 -49
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +7 -4
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +7 -4
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +4 -2
- 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 +3 -2
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +4 -2
- 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 +2 -1
- 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 +4 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +2 -1
- 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 +4 -2
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +5 -3
- 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 +6 -3
- 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 +3 -2
- 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 +6 -4
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +5 -3
- 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 +7 -4
- 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 +6 -3
- 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 +2 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +2 -1
- 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 +4 -2
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +2 -1
- 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 +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -1
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +5 -3
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +2 -1
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +3 -2
- 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 +3 -2
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +4 -2
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +7 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +3 -2
- package/src/endpoints/system/HealthEndpoint.test.ts +44 -0
- package/src/endpoints/system/HealthEndpoint.ts +14 -6
- package/src/excel-loaders/balance-items.ts +4 -2
- package/src/excel-loaders/event-notifications.ts +7 -5
- package/src/excel-loaders/index.ts +1 -0
- package/src/excel-loaders/members.ts +6 -4
- package/src/excel-loaders/organizations.ts +8 -7
- package/src/excel-loaders/payments.ts +5 -3
- package/src/excel-loaders/platform-memberships.ts +262 -0
- package/src/excel-loaders/receivable-balances.ts +7 -5
- package/src/excel-loaders/registrations.ts +9 -7
- package/src/helpers/AddressValidator.test.ts +2 -1
- package/src/helpers/AddressValidator.ts +7 -4
- package/src/helpers/AdminPermissionChecker.ts +190 -92
- package/src/helpers/AuthenticatedStructures.ts +4 -2
- package/src/helpers/BuckarooHelper.ts +2 -1
- package/src/helpers/Context.ts +4 -2
- package/src/helpers/CookieHelper.ts +2 -2
- package/src/helpers/FileCache.ts +2 -2
- package/src/helpers/ForwardHandler.ts +2 -1
- 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/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 +5 -4
- package/src/helpers/StripeHelper.ts +3 -2
- 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/ViesHelper.ts +4 -3
- package/src/helpers/XlsxTransformerColumnHelper.ts +4 -2
- package/src/helpers/email-html-helpers.ts +5 -4
- package/src/helpers/fetchToAsyncIterator.ts +1 -1
- package/src/helpers/outstandingBalanceJoin.ts +2 -1
- package/src/helpers/updateMemberDetailsUitpasNumber.ts +4 -3
- 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 +2 -1
- package/src/seeds/1754560914-groups-prices.test.ts +2 -1
- package/src/seeds/1754560914-groups-prices.ts +2 -1
- 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 +2 -1
- package/src/services/FileSignService.ts +1 -1
- package/src/services/MemberNumberService.ts +3 -1
- 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 +5 -3
- package/src/services/RegistrationService.ts +65 -3
- package/src/services/SSOService.ts +8 -4
- package/src/services/STPackageService.ts +5 -3
- package/src/services/StartupHealthService.ts +15 -0
- package/src/services/uitpas/UitpasService.ts +6 -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 +4 -2
- 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 +2 -1
- package/src/sql-filters/orders.ts +2 -1
- 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 +72 -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,5 +1,6 @@
|
|
|
1
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import { BalanceItem,
|
|
2
|
+
import type { BalanceItem, Organization, RegistrationPeriod} from '@stamhoofd/models';
|
|
3
|
+
import { BalanceItemFactory, GroupFactory, MemberFactory, OrganizationFactory, OrganizationRegistrationPeriodFactory, Registration, RegistrationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
4
|
import { AccessRight, AppliedRegistrationDiscount, BalanceItemRelation, BalanceItemRelationType, BalanceItemStatus, BalanceItemType, BooleanStatus, GroupPriceDiscount, GroupPriceDiscountType, IDRegisterCart, IDRegisterCheckout, IDRegisterItem, PaymentMethod, PermissionLevel, Permissions, PermissionsResourceType, ReduceablePrice, ResourcePermissions } from '@stamhoofd/structures';
|
|
4
5
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
5
6
|
import { RegisterMembersEndpoint } from '../../src/endpoints/global/registration/RegisterMembersEndpoint.js';
|
|
@@ -46,7 +47,7 @@ describe('E2E.Bundle Discounts', () => {
|
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
afterEach(() => {
|
|
49
|
-
|
|
50
|
+
vitest.restoreAllMocks();
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
async function initData() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Request, Response } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { Organization, RegistrationPeriod} from '@stamhoofd/models';
|
|
3
|
+
import { GroupFactory, MemberFactory, OrganizationFactory, RegistrationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
4
|
+
import type { BalanceItemWithPayments, StamhoofdFilter} from '@stamhoofd/structures';
|
|
5
|
+
import { AccessRight, ChargeRequest, LimitedFilteredRequest, PermissionLevel, PermissionRoleDetailed, Permissions, PermissionsResourceType, ResourcePermissions, Version } from '@stamhoofd/structures';
|
|
4
6
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
5
7
|
import { ChargeMembersEndpoint } from '../../src/endpoints/admin/members/ChargeMembersEndpoint.js';
|
|
6
8
|
import { testServer } from '../helpers/TestServer.js';
|
|
@@ -148,7 +150,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
148
150
|
|
|
149
151
|
const token = await Token.createToken(user);
|
|
150
152
|
|
|
151
|
-
await expect(
|
|
153
|
+
await expect(postCharge(filter, organization, body, token))
|
|
152
154
|
.rejects
|
|
153
155
|
.toThrow(STExpect.errorWithCode('permission_denied'));
|
|
154
156
|
}
|
|
@@ -301,7 +303,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
301
303
|
|
|
302
304
|
// act and assert
|
|
303
305
|
for (const [body, expectedErrorMessage] of testCases) {
|
|
304
|
-
await expect(
|
|
306
|
+
await expect(postCharge(filter, organization, body, financialDirectorToken))
|
|
305
307
|
.rejects
|
|
306
308
|
.toThrow(expectedErrorMessage);
|
|
307
309
|
}
|
|
@@ -425,7 +427,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
425
427
|
createdAt: new Date(2023, 0, 4),
|
|
426
428
|
});
|
|
427
429
|
|
|
428
|
-
await expect(
|
|
430
|
+
await expect(postCharge(filter, organization, body, token))
|
|
429
431
|
.rejects
|
|
430
432
|
.toThrow(STExpect.errorWithCode('permission_denied'));
|
|
431
433
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import {
|
|
2
|
+
import type { Group, Member, Organization, RegistrationPeriod} from '@stamhoofd/models';
|
|
3
|
+
import { Document, DocumentTemplateFactory, GroupFactory, MemberFactory, OrganizationFactory, OrganizationRegistrationPeriodFactory, Registration, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
4
|
import { IDRegisterCart, IDRegisterCheckout, IDRegisterItem, MemberDetails, MemberWithRegistrationsBlob, PaymentMethod } from '@stamhoofd/structures';
|
|
4
5
|
import { TestUtils } from '@stamhoofd/test-utils';
|
|
5
6
|
import { Formatter } from '@stamhoofd/utility';
|
|
@@ -48,7 +49,7 @@ describe('E2E.Documents', () => {
|
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
afterEach(() => {
|
|
51
|
-
|
|
52
|
+
vitest.restoreAllMocks();
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
const initOrganization = async (registrationPeriod: RegistrationPeriod = period) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { File, MemberDetails, MemberWithRegistrationsBlob, RecordCategory, RecordFileAnswer, RecordSettings, RecordType, TranslatedString, Version } from '@stamhoofd/structures';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { PatchableArrayAutoEncoder } from '@simonbackx/simple-encoding';
|
|
4
|
+
import { PatchableArray } from '@simonbackx/simple-encoding';
|
|
4
5
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
5
6
|
import { Member, OrganizationFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
6
7
|
import { PermissionLevel, Permissions } from '@stamhoofd/structures';
|
|
@@ -173,7 +174,6 @@ describe('E2E.PrivateFiles', () => {
|
|
|
173
174
|
const memberStruct = response.body.members[0];
|
|
174
175
|
const answer = memberStruct.details.recordAnswers.get(recordSettings.id);
|
|
175
176
|
if (!answer) {
|
|
176
|
-
// eslint-disable-next-line jest/no-conditional-expect
|
|
177
177
|
expect(memberStruct.details.recordAnswers).toHaveProperty(recordSettings.id);
|
|
178
178
|
throw new Error('Unexpected: Answer is not defined');
|
|
179
179
|
}
|
|
@@ -235,8 +235,6 @@ describe('E2E.PrivateFiles', () => {
|
|
|
235
235
|
const memberStruct = response.body.members[0];
|
|
236
236
|
const answer = memberStruct.details.recordAnswers.get(recordSettings.id);
|
|
237
237
|
if (!answer) {
|
|
238
|
-
// eslint-disable-next-line jest/no-conditional-expect
|
|
239
|
-
expect(memberStruct.details.recordAnswers).toHaveProperty(recordSettings.id);
|
|
240
238
|
throw new Error('Unexpected: Answer is not defined');
|
|
241
239
|
}
|
|
242
240
|
|
|
@@ -246,8 +244,8 @@ describe('E2E.PrivateFiles', () => {
|
|
|
246
244
|
|
|
247
245
|
expect(answer.file).toBeDefined();
|
|
248
246
|
expect(answer.file!.isPrivate).toBe(false);
|
|
249
|
-
expect(answer.file!.signature).
|
|
250
|
-
expect(answer.file!.signedUrl).
|
|
247
|
+
expect(answer.file!.signature).toBeNull();
|
|
248
|
+
expect(answer.file!.signedUrl).toBeNull();
|
|
251
249
|
});
|
|
252
250
|
|
|
253
251
|
/**
|
|
@@ -328,7 +326,7 @@ describe('E2E.PrivateFiles', () => {
|
|
|
328
326
|
|
|
329
327
|
expect(answer.file).toBeDefined();
|
|
330
328
|
expect(answer.file!.isPrivate).toBe(true);
|
|
331
|
-
expect(answer.file!.signedUrl).
|
|
329
|
+
expect(answer.file!.signedUrl).toBeNull();
|
|
332
330
|
});
|
|
333
331
|
|
|
334
332
|
/**
|
|
@@ -410,7 +408,7 @@ describe('E2E.PrivateFiles', () => {
|
|
|
410
408
|
|
|
411
409
|
expect(answer.file).toBeDefined();
|
|
412
410
|
expect(answer.file!.isPrivate).toBe(true);
|
|
413
|
-
expect(answer.file!.signedUrl).
|
|
411
|
+
expect(answer.file!.signedUrl).toEqual(expect.any(String));
|
|
414
412
|
expect(answer.file!.signedUrl).not.toEqual('https://test.com/test.exe'); // It got replaced with a proper signed url
|
|
415
413
|
});
|
|
416
414
|
|
|
@@ -441,7 +439,7 @@ describe('E2E.PrivateFiles', () => {
|
|
|
441
439
|
data.circular.data.here = data;
|
|
442
440
|
|
|
443
441
|
await FileSignService.fillSignedUrlsForStruct(data);
|
|
444
|
-
expect(data.circular.file.signedUrl).
|
|
442
|
+
expect(data.circular.file.signedUrl).toEqual(expect.any(String));
|
|
445
443
|
});
|
|
446
444
|
|
|
447
445
|
test('Can handle duplicate files', async () => {
|
|
@@ -470,10 +468,10 @@ describe('E2E.PrivateFiles', () => {
|
|
|
470
468
|
};
|
|
471
469
|
|
|
472
470
|
await FileSignService.fillSignedUrlsForStruct(data);
|
|
473
|
-
expect(data.circular.file1.signedUrl).
|
|
474
|
-
expect(data.circular.file2.signedUrl).
|
|
475
|
-
expect(data.arr[0].signedUrl).
|
|
476
|
-
expect(data.arr[1].signedUrl).
|
|
471
|
+
expect(data.circular.file1.signedUrl).toEqual(expect.any(String));
|
|
472
|
+
expect(data.circular.file2.signedUrl).toEqual(expect.any(String));
|
|
473
|
+
expect(data.arr[0].signedUrl).toEqual(expect.any(String));
|
|
474
|
+
expect(data.arr[1].signedUrl).toEqual(expect.any(String));
|
|
477
475
|
});
|
|
478
476
|
});
|
|
479
477
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import {
|
|
2
|
+
import type { MemberWithUsersRegistrationsAndGroups, Organization, RegistrationPeriod} from '@stamhoofd/models';
|
|
3
|
+
import { BalanceItemFactory, GroupFactory, MemberFactory, OrganizationFactory, OrganizationRegistrationPeriod, Platform, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
4
|
import { AdministrationFeeSettings, BalanceItemCartItem, BalanceItemRelation, BalanceItemRelationType, BalanceItemStatus, BalanceItemType, BooleanStatus, DefaultAgeGroup, FreeContributionSettings, GroupOption, GroupOptionMenu, IDRegisterCart, IDRegisterCheckout, IDRegisterItem, PaymentMethod, PermissionLevel, Permissions, PlatformMembershipType, PlatformMembershipTypeConfig, ReceivableBalanceType, ReduceablePrice, RegisterItemOption, TranslatedString, Version } from '@stamhoofd/structures';
|
|
4
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
6
|
import { GetMemberFamilyEndpoint } from '../../src/endpoints/global/members/GetMemberFamilyEndpoint.js';
|
|
@@ -44,7 +45,7 @@ describe('E2E.Register', () => {
|
|
|
44
45
|
});
|
|
45
46
|
|
|
46
47
|
afterEach(() => {
|
|
47
|
-
|
|
48
|
+
vitest.useRealTimers();
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
beforeAll(async () => {
|
|
@@ -1024,7 +1025,7 @@ describe('E2E.Register', () => {
|
|
|
1024
1025
|
describe('Register for group with default age group', () => {
|
|
1025
1026
|
test('Should create membership', async () => {
|
|
1026
1027
|
const date = new Date('2023-05-14');
|
|
1027
|
-
|
|
1028
|
+
vitest.useFakeTimers({ shouldAdvanceTime: true, toFake: ['Date'] }).setSystemTime(date);
|
|
1028
1029
|
|
|
1029
1030
|
const platformMembershipTypeConfig = PlatformMembershipTypeConfig.create({
|
|
1030
1031
|
startDate: period.startDate,
|
|
@@ -1108,7 +1109,7 @@ describe('E2E.Register', () => {
|
|
|
1108
1109
|
|
|
1109
1110
|
test('Should set trial until on membership if trial', async () => {
|
|
1110
1111
|
const date = new Date('2023-05-14');
|
|
1111
|
-
|
|
1112
|
+
vitest.useFakeTimers({ shouldAdvanceTime: true, toFake: ['Date'] }).setSystemTime(date);
|
|
1112
1113
|
|
|
1113
1114
|
try {
|
|
1114
1115
|
const platformMembershipTypeConfig = PlatformMembershipTypeConfig.create({
|
|
@@ -1198,7 +1199,7 @@ describe('E2E.Register', () => {
|
|
|
1198
1199
|
expect(trialUntil!.getDate()).toBe(19);
|
|
1199
1200
|
}
|
|
1200
1201
|
finally {
|
|
1201
|
-
|
|
1202
|
+
vitest.useRealTimers().resetAllMocks();
|
|
1202
1203
|
}
|
|
1203
1204
|
});
|
|
1204
1205
|
});
|
package/tests/e2e/stock.test.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/* eslint-disable jest/expect-expect */
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
import { PatchableArray
|
|
2
|
+
import type { PatchableArrayAutoEncoder } from '@simonbackx/simple-encoding';
|
|
3
|
+
import { PatchableArray } from '@simonbackx/simple-encoding';
|
|
5
4
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import type { Organization, StripeAccount } from '@stamhoofd/models';
|
|
6
|
+
import { Order, OrganizationFactory, Token, UserFactory, Webshop, WebshopFactory } from '@stamhoofd/models';
|
|
7
|
+
import { Address, Cart, CartItem, CartItemOption, CartReservedSeat, Customer, Option, OptionMenu, OrderData, OrderStatus, PaymentConfiguration, PaymentMethod, PermissionLevel, Permissions, PrivateOrder, PrivatePaymentConfiguration, Product, ProductPrice, ProductType, ReservedSeat, SeatingPlan, SeatingPlanRow, SeatingPlanSeat, SeatingPlanSection, TransferSettings, ValidatedAddress, WebshopDeliveryMethod, WebshopMetaData, WebshopOnSiteMethod, WebshopPrivateMetaData, WebshopTakeoutMethod, WebshopTimeSlot } from '@stamhoofd/structures';
|
|
8
|
+
import { Country } from '@stamhoofd/types/Country';
|
|
8
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
10
|
|
|
10
11
|
import { PatchWebshopOrdersEndpoint } from '../../src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.js';
|
|
@@ -1258,7 +1259,6 @@ describe('E2E.Stock', () => {
|
|
|
1258
1259
|
const r = Request.buildJson('POST', `/webshop/${webshop.id}/order`, organization.getApiHost(), orderData);
|
|
1259
1260
|
|
|
1260
1261
|
const response = await testServer.test(endpoint, r);
|
|
1261
|
-
expect(response.body).toBeDefined();
|
|
1262
1262
|
const orderStruct = response.body.order;
|
|
1263
1263
|
|
|
1264
1264
|
// Now check the stock has changed for the product
|
|
@@ -1317,7 +1317,6 @@ describe('E2E.Stock', () => {
|
|
|
1317
1317
|
const r = Request.buildJson('POST', `/webshop/${webshop.id}/order`, organization.getApiHost(), orderData);
|
|
1318
1318
|
|
|
1319
1319
|
const response = await testServer.test(endpoint, r);
|
|
1320
|
-
expect(response.body).toBeDefined();
|
|
1321
1320
|
const orderStruct = response.body.order;
|
|
1322
1321
|
|
|
1323
1322
|
// Now check the stock has changed for the product
|
|
@@ -1712,7 +1711,6 @@ describe('E2E.Stock', () => {
|
|
|
1712
1711
|
const r = Request.buildJson('POST', `/webshop/${webshop.id}/order`, organization.getApiHost(), orderData);
|
|
1713
1712
|
|
|
1714
1713
|
const response = await testServer.test(endpoint, r);
|
|
1715
|
-
expect(response.body).toBeDefined();
|
|
1716
1714
|
const orderStruct = response.body.order;
|
|
1717
1715
|
|
|
1718
1716
|
// Now check the stock has changed for the product
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
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 { Organization,
|
|
4
|
+
import type { Organization, StripeAccount, Webshop} from '@stamhoofd/models';
|
|
5
|
+
import { OrganizationFactory, Ticket, Token, UserFactory, WebshopFactory } from '@stamhoofd/models';
|
|
4
6
|
import { Cart, CartItem, CartReservedSeat, Customer, OrderData, OrderStatus, PaymentConfiguration, PaymentMethod, PermissionLevel, Permissions, PrivateOrder, PrivatePaymentConfiguration, Product, ProductType, SeatingPlan, SeatingPlanRow, SeatingPlanSeat, SeatingPlanSection, TransferSettings, WebshopMetaData, WebshopPrivateMetaData, WebshopTicketType } from '@stamhoofd/structures';
|
|
5
7
|
|
|
6
8
|
import { PatchWebshopOrdersEndpoint } from '../../src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.js';
|
|
@@ -33,7 +33,7 @@ export class StripeMocker {
|
|
|
33
33
|
.persist()
|
|
34
34
|
.get(/v1\/.*/)
|
|
35
35
|
.reply((uri, body) => {
|
|
36
|
-
const [match, resource, id] = uri.match(/\/?v1\/(\w+)(
|
|
36
|
+
const [match, resource, id] = uri.match(/\/?v1\/(\w+)(?:\/(\w+)){0,2}/) || [null];
|
|
37
37
|
|
|
38
38
|
if (!match) {
|
|
39
39
|
return [500];
|
|
@@ -54,7 +54,7 @@ export class StripeMocker {
|
|
|
54
54
|
.persist()
|
|
55
55
|
.post(/v1\/.*/)
|
|
56
56
|
.reply((uri, body: string) => {
|
|
57
|
-
const [match, resource
|
|
57
|
+
const [match, resource] = uri.match(/\/?v1\/(\w+)(?:\/(\w+)){0,2}/) || [null];
|
|
58
58
|
|
|
59
59
|
if (!match) {
|
|
60
60
|
return [500];
|
|
@@ -184,7 +184,7 @@ export class StripeMocker {
|
|
|
184
184
|
allowPrototypes: true,
|
|
185
185
|
decoder(value: unknown) {
|
|
186
186
|
// Convert numbers to numbers and bools to bools
|
|
187
|
-
if (typeof value === 'string' && /^(
|
|
187
|
+
if (typeof value === 'string' && /^(?:\d+|\d*\.\d+)$/.test(value)) {
|
|
188
188
|
return parseFloat(value);
|
|
189
189
|
}
|
|
190
190
|
|
package/tests/init/initAdmin.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Organization
|
|
2
|
-
import {
|
|
1
|
+
import type { Organization} from '@stamhoofd/models';
|
|
2
|
+
import { Token, UserFactory } from '@stamhoofd/models';
|
|
3
|
+
import type { AccessRight} from '@stamhoofd/structures';
|
|
4
|
+
import { PermissionLevel, PermissionRole, Permissions } from '@stamhoofd/structures';
|
|
3
5
|
import { initPermissionRole } from './initPermissionRole.js';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Group, OrganizationRegistrationPeriod } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Group, OrganizationRegistrationPeriod } from '@stamhoofd/models';
|
|
2
|
+
import type { GroupPrice} from '@stamhoofd/structures';
|
|
3
|
+
import { GroupPriceDiscountType, BundleDiscount, TranslatedString, GroupPriceDiscount, ReduceablePrice, BundleDiscountGroupPriceSettings } from '@stamhoofd/structures';
|
|
3
4
|
|
|
4
5
|
function createBundleDiscount({
|
|
5
6
|
name = 'Bundle discount',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Organization
|
|
2
|
-
import {
|
|
1
|
+
import type { Organization} from '@stamhoofd/models';
|
|
2
|
+
import { Platform } from '@stamhoofd/models';
|
|
3
|
+
import type { AccessRight} from '@stamhoofd/structures';
|
|
4
|
+
import { PermissionRoleDetailed } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
6
|
export async function initPermissionRole(
|
|
5
7
|
{ organization, accessRights }:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from '@stamhoofd/models';
|
|
2
|
-
import { RecordCategory } from '@stamhoofd/structures';
|
|
2
|
+
import type { RecordCategory } from '@stamhoofd/structures';
|
|
3
3
|
|
|
4
4
|
export async function initPlatformRecordCategory({ recordCategory }: { recordCategory: RecordCategory }): Promise<void> {
|
|
5
5
|
const platform = await Platform.getForEditing();
|
package/tests/init/initStripe.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Organization } from '@stamhoofd/models';
|
|
1
|
+
import type { Organization } from '@stamhoofd/models';
|
|
2
2
|
import { PaymentMethod } from '@stamhoofd/structures';
|
|
3
3
|
import { TestUtils } from '@stamhoofd/test-utils';
|
|
4
4
|
import { StripeMocker } from '../helpers/StripeMocker.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// first import nock
|
|
2
|
+
import nock from 'nock';
|
|
3
|
+
|
|
4
|
+
// prevent nock import from being removed on save
|
|
5
|
+
console.log('Imported nock: ', !!nock);
|
|
6
|
+
|
|
7
|
+
import { TestUtils } from '@stamhoofd/test-utils';
|
|
8
|
+
|
|
9
|
+
// Set timezone!
|
|
10
|
+
process.env.TZ = 'UTC';
|
|
11
|
+
|
|
12
|
+
// Quick check
|
|
13
|
+
if (new Date().getTimezoneOffset() !== 0) {
|
|
14
|
+
throw new Error('Process should always run in UTC timezone');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function setup() {
|
|
18
|
+
TestUtils.globalSetup();
|
|
19
|
+
|
|
20
|
+
const { Database } = await import('@simonbackx/simple-database');
|
|
21
|
+
|
|
22
|
+
const { run } = await import('../src/migrate.js');
|
|
23
|
+
await run();
|
|
24
|
+
|
|
25
|
+
await Database.end();
|
|
26
|
+
};
|
|
@@ -14,7 +14,8 @@ import { GlobalHelper } from '../src/helpers/GlobalHelper.js';
|
|
|
14
14
|
import { BalanceItemService } from '../src/services/BalanceItemService.js';
|
|
15
15
|
import { PayconiqMocker } from './helpers/PayconiqMocker.js';
|
|
16
16
|
import { resetNock } from './helpers/resetNock.js';
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
Error.stackTraceLimit = 100;
|
|
18
19
|
|
|
19
20
|
// Set version of saved structures
|
|
20
21
|
Column.setJSONVersion(Version);
|
|
@@ -33,7 +34,7 @@ if (new Date().getTimezoneOffset() !== 0) {
|
|
|
33
34
|
throw new Error('Process should always run in UTC timezone');
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
console.log =
|
|
37
|
+
console.log = () => {};
|
|
37
38
|
|
|
38
39
|
beforeAll(async () => {
|
|
39
40
|
resetNock();
|
|
@@ -76,7 +77,7 @@ beforeAll(async () => {
|
|
|
76
77
|
await GlobalHelper.load();
|
|
77
78
|
|
|
78
79
|
// Override default $t handlers
|
|
79
|
-
|
|
80
|
+
TestUtils.loadEnvironment();
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
afterAll(async () => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": ".",
|
|
5
|
+
"outDir": "dist"
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"./index.ts",
|
|
9
|
+
"./migrations.ts",
|
|
10
|
+
"./src",
|
|
11
|
+
"../../stamhoofd.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"./src/**/*.spec.ts",
|
|
15
|
+
"./src/**/*.test.ts"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,43 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"strictNullChecks": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"outDir": "dist",
|
|
16
|
-
"lib": [
|
|
17
|
-
"es2022",
|
|
18
|
-
"DOM" // axios fix
|
|
19
|
-
],
|
|
20
|
-
"types": [
|
|
21
|
-
"node",
|
|
22
|
-
"jest",
|
|
23
|
-
"@stamhoofd/backend-i18n",
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
"include": [
|
|
27
|
-
"*.d.ts",
|
|
28
|
-
"src/**/*.ts",
|
|
29
|
-
"tests/**/*.ts",
|
|
30
|
-
"index.ts",
|
|
31
|
-
"migrations.ts",
|
|
32
|
-
"../../../*.d.ts",
|
|
33
|
-
"../../*.d.ts"
|
|
34
|
-
],
|
|
35
|
-
"exclude": [
|
|
36
|
-
"node_modules",
|
|
37
|
-
"dist",
|
|
38
|
-
"dist/**/*"
|
|
39
|
-
],
|
|
40
|
-
"ts-node": {
|
|
41
|
-
"files": true
|
|
42
|
-
}
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"files": [],
|
|
4
|
+
"references": [
|
|
5
|
+
{
|
|
6
|
+
"path": "./tsconfig.build.json"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"path": "./tsconfig.test.json"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
43
12
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.test.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": ".",
|
|
5
|
+
"outDir": "dist"
|
|
6
|
+
},
|
|
7
|
+
"references": [
|
|
8
|
+
{ "path": "./tsconfig.build.json" }
|
|
9
|
+
],
|
|
10
|
+
"include": [
|
|
11
|
+
"../../stamhoofd.d.ts",
|
|
12
|
+
"../../../jest-extended.d.ts",
|
|
13
|
+
"./src/**/*.spec.ts",
|
|
14
|
+
"./src/**/*.test.ts",
|
|
15
|
+
"./tests"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/vitest.config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globalSetup: './tests/vitest.global.setup.ts',
|
|
6
|
+
setupFiles: ['./tests/vitest.setup.ts'],
|
|
7
|
+
watch: false,
|
|
8
|
+
globals: true,
|
|
9
|
+
root: import.meta.dirname,
|
|
10
|
+
isolate: true,
|
|
11
|
+
maxWorkers: 1, // For now we can't run parallel because all test files use the same database
|
|
12
|
+
},
|
|
13
|
+
});
|
package/eslint.config.mjs
DELETED
package/jest.config.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const useGithubActions = !!process.env.GITHUB_ACTIONS;
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
roots: ['<rootDir>/dist'],
|
|
5
|
-
testEnvironment: 'node',
|
|
6
|
-
setupFilesAfterEnv: [
|
|
7
|
-
'jest-extended/all',
|
|
8
|
-
'./dist/tests/jest.setup.js',
|
|
9
|
-
],
|
|
10
|
-
reporters: [['jest-console-group-reporter', {
|
|
11
|
-
consoleLevels: ['error', 'warn', 'log'],
|
|
12
|
-
filters: [],
|
|
13
|
-
groups: [],
|
|
14
|
-
onlyFailingTestSuites: true,
|
|
15
|
-
afterEachTest: {
|
|
16
|
-
enable: false,
|
|
17
|
-
},
|
|
18
|
-
afterAllTests: {
|
|
19
|
-
reportType: 'detailed',
|
|
20
|
-
enable: true,
|
|
21
|
-
filePaths: true,
|
|
22
|
-
},
|
|
23
|
-
useGitHubActions: useGithubActions,
|
|
24
|
-
}]],
|
|
25
|
-
globalSetup: './dist/tests/jest.global.setup.js',
|
|
26
|
-
// verbose: true,
|
|
27
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// first import nock
|
|
2
|
-
import nock from 'nock';
|
|
3
|
-
|
|
4
|
-
// prevent nock import from being removed on save
|
|
5
|
-
console.log('Imported nock: ', !!nock);
|
|
6
|
-
|
|
7
|
-
import { TestUtils } from '@stamhoofd/test-utils';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
const emailPath = require.resolve('@stamhoofd/email');
|
|
10
|
-
const modelsPath = require.resolve('@stamhoofd/models');
|
|
11
|
-
|
|
12
|
-
// Set timezone!
|
|
13
|
-
process.env.TZ = 'UTC';
|
|
14
|
-
|
|
15
|
-
// Quick check
|
|
16
|
-
if (new Date().getTimezoneOffset() !== 0) {
|
|
17
|
-
throw new Error('Process should always run in UTC timezone');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default async () => {
|
|
21
|
-
await TestUtils.globalSetup();
|
|
22
|
-
|
|
23
|
-
const { Database, Migration } = await import('@simonbackx/simple-database');
|
|
24
|
-
|
|
25
|
-
// External migrations
|
|
26
|
-
await Migration.runAll(path.dirname(modelsPath) + '/migrations');
|
|
27
|
-
await Migration.runAll(path.dirname(emailPath) + '/migrations');
|
|
28
|
-
|
|
29
|
-
// Internal
|
|
30
|
-
await Migration.runAll(__dirname + '/src/migrations');
|
|
31
|
-
|
|
32
|
-
await Database.end();
|
|
33
|
-
};
|
package/tests/toMatchMap.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { expect } from '@jest/globals';
|
|
2
|
-
import type { MatcherFunction } from 'expect';
|
|
3
|
-
import 'jest';
|
|
4
|
-
|
|
5
|
-
const toMatchMap: MatcherFunction<[map: unknown]> = function (actual, map: Map<any, any>) {
|
|
6
|
-
if (
|
|
7
|
-
!(map instanceof Map)
|
|
8
|
-
) {
|
|
9
|
-
throw new TypeError('You need to pass a Map to toMatchMap');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
!(actual instanceof Map)
|
|
14
|
-
) {
|
|
15
|
-
return {
|
|
16
|
-
message: () =>
|
|
17
|
-
`expected ${this.utils.printReceived(
|
|
18
|
-
actual,
|
|
19
|
-
)} to be a Map`,
|
|
20
|
-
pass: false,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
for (const key of map.keys()) {
|
|
25
|
-
// Check key exists
|
|
26
|
-
if (!actual.has(key)) {
|
|
27
|
-
return {
|
|
28
|
-
message: () =>
|
|
29
|
-
`expected ${this.utils.printReceived(
|
|
30
|
-
actual,
|
|
31
|
-
)} to have key ${this.utils.printExpected(key)}`,
|
|
32
|
-
pass: false,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Compare values
|
|
37
|
-
const expectedValue = map.get(key);
|
|
38
|
-
const actualValue = actual.get(key);
|
|
39
|
-
|
|
40
|
-
if (!this.equals(expectedValue, actualValue)) {
|
|
41
|
-
return {
|
|
42
|
-
message: () =>
|
|
43
|
-
`expected ${this.utils.diff(actualValue, expectedValue)} at key ${this.utils.printExpected(key)}`,
|
|
44
|
-
pass: false,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Check for extra keys in actual
|
|
50
|
-
for (const key of actual.keys()) {
|
|
51
|
-
if (!map.has(key)) {
|
|
52
|
-
return {
|
|
53
|
-
message: () =>
|
|
54
|
-
`unexpected key ${this.utils.printExpected(key)} in Map`,
|
|
55
|
-
pass: false,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
message: () => `ok`,
|
|
62
|
-
pass: true,
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
expect.extend({
|
|
67
|
-
toMatchMap,
|
|
68
|
-
});
|