@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,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLConcat, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const emailRecipientsFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
import { emailRecipientsFilterCompilers } from './email-recipients.js';
|
|
3
4
|
|
|
4
5
|
export const userEmailFilterCompilers: SQLFilterDefinitions = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createJoinedRelationFilter, createExistsFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
import { eventFilterCompilers } from './events.js';
|
|
3
4
|
import { organizationFilterCompilers } from './organizations.js';
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const eventFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createWildcardColumnFilter, SQL, SQLJsonExtract, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
import { SQLTranslatedString } from '../helpers/SQLTranslatedString.js';
|
|
3
4
|
|
|
4
5
|
export const groupFilterCompilers: SQLFilterDefinitions = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const invoicedBalanceItemCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLCast, SQLConcat, SQLJsonUnquote, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
import { invoicedBalanceItemCompilers } from './invoiced-balance-items.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MemberResponsibilityRecord } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
2
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
3
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
3
4
|
|
|
4
5
|
const baseTable = SQL.table(MemberResponsibilityRecord.table);
|
|
5
6
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
2
2
|
import { Email, Member, MemberUser } from '@stamhoofd/models';
|
|
3
|
-
import {
|
|
3
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
4
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, createWildcardColumnFilter, SQL, SQLAge, SQLCast, SQLConcat, SQLJsonExtract, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
4
5
|
import { AccessRight } from '@stamhoofd/structures';
|
|
5
6
|
import { Context } from '../helpers/Context.js';
|
|
6
7
|
import { baseRegistrationFilterCompilers } from './base-registration-filter-compilers.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, createWildcardColumnFilter, SQL, SQLCast, SQLConcat, SQLJsonExtract, SQLJsonUnquote, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const orderFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const organizationRegistrationPeriodFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLConcat, SQLNow, SQLNull, SQLScalar, SQLValueType, SQLWhereEqual, SQLWhereOr, SQLWhereSign } from '@stamhoofd/sql';
|
|
2
3
|
import { SetupStepType } from '@stamhoofd/structures';
|
|
3
4
|
|
|
4
5
|
export const organizationFilterCompilers: SQLFilterDefinitions = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLCast, SQLConcat, SQLJsonUnquote, SQLScalar, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
import { balanceItemPaymentsCompilers } from './balance-item-payments.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { MemberPlatformMembership } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLFilterDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
4
|
+
import { memberFilterCompilers } from './members.js';
|
|
5
|
+
import { organizationFilterCompilers } from './organizations.js';
|
|
6
|
+
|
|
7
|
+
export const platformMembershipFilterCompilers: SQLFilterDefinitions = {
|
|
8
|
+
...baseSQLFilterCompilers,
|
|
9
|
+
id: createColumnFilter({
|
|
10
|
+
expression: SQL.column(MemberPlatformMembership.table, 'id'),
|
|
11
|
+
type: SQLValueType.String,
|
|
12
|
+
nullable: false,
|
|
13
|
+
}),
|
|
14
|
+
membershipTypeId: createColumnFilter({
|
|
15
|
+
expression: SQL.column(MemberPlatformMembership.table, 'membershipTypeId'),
|
|
16
|
+
type: SQLValueType.String,
|
|
17
|
+
nullable: false,
|
|
18
|
+
}),
|
|
19
|
+
periodId: createColumnFilter({
|
|
20
|
+
expression: SQL.column(MemberPlatformMembership.table, 'periodId'),
|
|
21
|
+
type: SQLValueType.String,
|
|
22
|
+
nullable: false,
|
|
23
|
+
}),
|
|
24
|
+
startDate: createColumnFilter({
|
|
25
|
+
expression: SQL.column(MemberPlatformMembership.table, 'startDate'),
|
|
26
|
+
type: SQLValueType.Datetime,
|
|
27
|
+
nullable: false,
|
|
28
|
+
}),
|
|
29
|
+
endDate: createColumnFilter({
|
|
30
|
+
expression: SQL.column(MemberPlatformMembership.table, 'endDate'),
|
|
31
|
+
type: SQLValueType.Datetime,
|
|
32
|
+
nullable: false,
|
|
33
|
+
}),
|
|
34
|
+
trialUntil: createColumnFilter({
|
|
35
|
+
expression: SQL.column(MemberPlatformMembership.table, 'trialUntil'),
|
|
36
|
+
type: SQLValueType.Datetime,
|
|
37
|
+
nullable: true,
|
|
38
|
+
}),
|
|
39
|
+
createdAt: createColumnFilter({
|
|
40
|
+
expression: SQL.column(MemberPlatformMembership.table, 'createdAt'),
|
|
41
|
+
type: SQLValueType.Datetime,
|
|
42
|
+
nullable: true,
|
|
43
|
+
}),
|
|
44
|
+
freeAmount: createColumnFilter({
|
|
45
|
+
expression: SQL.column(MemberPlatformMembership.table, 'freeAmount'),
|
|
46
|
+
type: SQLValueType.Number,
|
|
47
|
+
nullable: false,
|
|
48
|
+
}),
|
|
49
|
+
price: createColumnFilter({
|
|
50
|
+
expression: SQL.column(MemberPlatformMembership.table, 'price'),
|
|
51
|
+
type: SQLValueType.Number,
|
|
52
|
+
nullable: false,
|
|
53
|
+
}),
|
|
54
|
+
organization: createExistsFilter(
|
|
55
|
+
SQL.select()
|
|
56
|
+
.from(SQL.table('organizations'))
|
|
57
|
+
.where(
|
|
58
|
+
SQL.column('organizations', 'id'),
|
|
59
|
+
SQL.column(MemberPlatformMembership.table, 'organizationId'),
|
|
60
|
+
),
|
|
61
|
+
organizationFilterCompilers
|
|
62
|
+
),
|
|
63
|
+
member: createExistsFilter(
|
|
64
|
+
SQL.select()
|
|
65
|
+
.from(SQL.table('members'))
|
|
66
|
+
.where(
|
|
67
|
+
SQL.column('members', 'id'),
|
|
68
|
+
SQL.column(MemberPlatformMembership.table, 'memberId'),
|
|
69
|
+
),
|
|
70
|
+
memberFilterCompilers
|
|
71
|
+
)
|
|
72
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createExistsFilter, SQL, SQLConcat, SQLValueType, SQLScalar } from '@stamhoofd/sql';
|
|
2
3
|
import { memberFilterCompilers } from './members.js';
|
|
3
4
|
import { organizationFilterCompilers } from './organizations.js';
|
|
4
5
|
import { EmailRelationFilterCompilers } from './shared/EmailRelationFilterCompilers.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const registrationPeriodFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Group, Member, Organization, Registration } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
2
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
3
|
+
import { baseSQLFilterCompilers, createColumnFilter, createJoinedRelationFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
3
4
|
import { SQLTranslatedString } from '../helpers/SQLTranslatedString.js';
|
|
4
5
|
import { baseRegistrationFilterCompilers } from './base-registration-filter-compilers.js';
|
|
5
6
|
import { memberFilterCompilers } from './members.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const ticketFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
package/src/sql-filters/users.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SQLFilterDefinitions} from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
2
3
|
|
|
3
4
|
export const userFilterCompilers: SQLFilterDefinitions = {
|
|
4
5
|
...baseSQLFilterCompilers,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SQLFilterDefinitions } from '@stamhoofd/sql';
|
|
2
|
+
import { baseSQLFilterCompilers, createColumnFilter, createJoinedRelationFilter, SQL, SQLValueType } from '@stamhoofd/sql';
|
|
3
|
+
import { organizationFilterCompilers } from './organizations.js';
|
|
4
|
+
|
|
5
|
+
export const organizationJoin = SQL.join('organizations').where(SQL.column('organizations', 'id'), SQL.column('webshops', 'organizationId'));
|
|
6
|
+
|
|
7
|
+
export const webshopFilterCompilers: SQLFilterDefinitions = {
|
|
8
|
+
...baseSQLFilterCompilers,
|
|
9
|
+
id: createColumnFilter({
|
|
10
|
+
expression: SQL.column('webshops', 'id'),
|
|
11
|
+
type: SQLValueType.String,
|
|
12
|
+
nullable: false,
|
|
13
|
+
}),
|
|
14
|
+
organizationId: createColumnFilter({
|
|
15
|
+
expression: SQL.column('webshops', 'organizationId'),
|
|
16
|
+
type: SQLValueType.String,
|
|
17
|
+
nullable: false,
|
|
18
|
+
}),
|
|
19
|
+
name: createColumnFilter({
|
|
20
|
+
expression: SQL.jsonExtract(SQL.column('webshops', 'meta'), '$.value.name'),
|
|
21
|
+
type: SQLValueType.JSONString,
|
|
22
|
+
nullable: false,
|
|
23
|
+
}),
|
|
24
|
+
status: createColumnFilter({
|
|
25
|
+
expression: SQL.jsonExtract(SQL.column('webshops', 'meta'), '$.value.status'),
|
|
26
|
+
type: SQLValueType.JSONString,
|
|
27
|
+
nullable: false,
|
|
28
|
+
}),
|
|
29
|
+
organization: createJoinedRelationFilter(
|
|
30
|
+
organizationJoin,
|
|
31
|
+
organizationFilterCompilers,
|
|
32
|
+
),
|
|
33
|
+
createdAt: createColumnFilter({
|
|
34
|
+
expression: SQL.column('createdAt'),
|
|
35
|
+
type: SQLValueType.Datetime,
|
|
36
|
+
nullable: false,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AuditLog } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { AuditLog } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
|
|
4
5
|
export const auditLogSorters: SQLSortDefinitions<AuditLog> = {
|
|
5
6
|
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BalanceItem } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { BalanceItem } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const balanceItemSorters: SQLSortDefinitions<BalanceItem> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DocumentTemplate } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { DocumentTemplate } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const documentTemplateSorters: SQLSortDefinitions<DocumentTemplate> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Document } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Document } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const documentSorters: SQLSortDefinitions<Document> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EmailRecipient } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { EmailRecipient } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const emailRecipientSorters: SQLSortDefinitions<EmailRecipient> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Email } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Email } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const emailSorters: SQLSortDefinitions<Email> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { SQLResultNamespacedRow } from '@simonbackx/simple-database';
|
|
2
|
-
import {
|
|
1
|
+
import type { SQLResultNamespacedRow } from '@simonbackx/simple-database';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
import { organizationJoin } from '../sql-filters/event-notifications.js';
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Event } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Event } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const eventSorters: SQLSortDefinitions<Event> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Group } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Group } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
|
|
4
5
|
export const groupSorters: SQLSortDefinitions<Group> = {
|
|
5
6
|
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Invoice } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Invoice } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const invoiceSorters: SQLSortDefinitions<Invoice> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MemberWithUsersRegistrationsAndGroups } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { MemberWithUsersRegistrationsAndGroups } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const memberSorters: SQLSortDefinitions<MemberWithUsersRegistrationsAndGroups> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Order } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Order } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const orderSorters: SQLSortDefinitions<Order> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { OrganizationRegistrationPeriod } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { OrganizationRegistrationPeriod } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
|
|
4
5
|
export const organizationRegistrationPeriodSorters: SQLSortDefinitions<OrganizationRegistrationPeriod> = {
|
|
5
6
|
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Organization } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Organization } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
|
|
4
5
|
export const organizationSorters: SQLSortDefinitions<Organization> = {
|
|
5
6
|
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Payment } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Payment } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const paymentSorters: SQLSortDefinitions<Payment> = {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PlainObject } from '@simonbackx/simple-encoding';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinition, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
4
|
+
import type { PlatformMembership } from '@stamhoofd/structures';
|
|
5
|
+
|
|
6
|
+
type KeysOfType<T, V> = {
|
|
7
|
+
[K in keyof T]: T[K] extends V ? K : never
|
|
8
|
+
}[keyof T];
|
|
9
|
+
|
|
10
|
+
const columnsToFilterOn: (KeysOfType<PlatformMembership, PlainObject | Date>)[] = ['id','startDate','endDate','membershipTypeId', 'price', 'createdAt', 'trialUntil', 'freeAmount'];
|
|
11
|
+
|
|
12
|
+
export const platformMembershipSorters: SQLSortDefinitions<PlatformMembership> = {
|
|
13
|
+
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
14
|
+
// Try to avoid creating sorters on fields that er not 1:1 with the database, that often causes pagination issues if not thought through
|
|
15
|
+
// An example: sorting on 'name' is not a good idea, because it is a concatenation of two fields.
|
|
16
|
+
// You might be tempted to use ORDER BY firstName, lastName, but that will not work as expected and it needs to be ORDER BY CONCAT(firstName, ' ', lastName)
|
|
17
|
+
// Why? Because ORDER BY firstName, lastName produces a different order dan ORDER BY CONCAT(firstName, ' ', lastName) if there are multiple people with spaces in the first name
|
|
18
|
+
// And that again causes issues with pagination because the next query will append a filter of name > 'John Doe' - causing duplicate and/or skipped results
|
|
19
|
+
// What if you need mapping? simply map the sorters in the frontend: name -> firstname, lastname, age -> birthDay, etc.
|
|
20
|
+
...Object.fromEntries(columnsToFilterOn.map((column: KeysOfType<PlatformMembership, PlainObject | Date>) => [column, createColumnSortDefinition(column)]))
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create a basic sort definition from a column
|
|
25
|
+
* @param column
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
function createColumnSortDefinition<K extends KeysOfType<PlatformMembership, PlainObject | Date>>(column: K): SQLSortDefinition<PlatformMembership, PlatformMembership[K]>{
|
|
29
|
+
return {
|
|
30
|
+
getValue(a: PlatformMembership) {
|
|
31
|
+
return a[column];
|
|
32
|
+
},
|
|
33
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
34
|
+
return new SQLOrderBy({
|
|
35
|
+
column: SQL.column(column),
|
|
36
|
+
direction,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CachedBalance } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { CachedBalance } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
|
|
4
5
|
export const receivableBalanceSorters: SQLSortDefinitions<CachedBalance> = {
|
|
5
6
|
// WARNING! TEST NEW SORTERS THOROUGHLY!
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RegistrationPeriod } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { RegistrationPeriod } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const registrationPeriodSorters: SQLSortDefinitions<RegistrationPeriod> = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Group, Member, Organization } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLIfNull, SQLOrderBy } from '@stamhoofd/sql';
|
|
4
|
+
import type { MemberWithRegistrationsBlob, Organization as OrganizationStruct, RegistrationWithMemberBlob } from '@stamhoofd/structures';
|
|
4
5
|
import { Formatter } from '@stamhoofd/utility';
|
|
5
6
|
import { memberCachedBalanceForOrganizationJoin, registrationCachedBalanceJoin } from '../helpers/outstandingBalanceJoin.js';
|
|
6
7
|
import { SQLTranslatedString } from '../helpers/SQLTranslatedString.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Ticket } from '@stamhoofd/models';
|
|
2
|
-
import {
|
|
1
|
+
import type { Ticket } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
3
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
4
5
|
|
|
5
6
|
export const ticketSorters: SQLSortDefinitions<Ticket> = {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Webshop } from '@stamhoofd/models';
|
|
2
|
+
import type { SQLOrderByDirection, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
3
|
+
import { SQL, SQLOrderBy } from '@stamhoofd/sql';
|
|
4
|
+
import { Formatter } from '@stamhoofd/utility';
|
|
5
|
+
|
|
6
|
+
export const webshopSorters: SQLSortDefinitions<Webshop> = {
|
|
7
|
+
id: {
|
|
8
|
+
getValue(a) {
|
|
9
|
+
return a.id;
|
|
10
|
+
},
|
|
11
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
12
|
+
return new SQLOrderBy({
|
|
13
|
+
column: SQL.column('id'),
|
|
14
|
+
direction,
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
name: {
|
|
19
|
+
getValue(a) {
|
|
20
|
+
return a.meta.name;
|
|
21
|
+
},
|
|
22
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
23
|
+
return new SQLOrderBy({
|
|
24
|
+
column: SQL.jsonValue(SQL.column('meta'), '$.value.name', 'CHAR'),
|
|
25
|
+
direction,
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
createdAt: {
|
|
30
|
+
getValue(a) {
|
|
31
|
+
return Formatter.dateTimeIso(a.createdAt, 'UTC');
|
|
32
|
+
},
|
|
33
|
+
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
34
|
+
return new SQLOrderBy({
|
|
35
|
+
column: SQL.column('createdAt'),
|
|
36
|
+
direction,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { AutoEncoderPatchType
|
|
1
|
+
import type { AutoEncoderPatchType} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { PatchableArray } from '@simonbackx/simple-encoding';
|
|
2
3
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
3
|
-
import { Organization } from '@stamhoofd/models';
|
|
4
|
-
import { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
|
|
4
|
+
import type { Organization } from '@stamhoofd/models';
|
|
5
|
+
import type { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
|
|
5
6
|
import { PatchOrganizationMembersEndpoint } from '../../src/endpoints/global/members/PatchOrganizationMembersEndpoint.js';
|
|
6
7
|
import { testServer } from '../helpers/TestServer.js';
|
|
7
8
|
import { initAdmin } from '../init/initAdmin.js';
|
|
8
9
|
|
|
9
10
|
export async function patchOrganizationMember({ patch, organization }: { patch: AutoEncoderPatchType<MemberWithRegistrationsBlob>; organization: Organization }) {
|
|
10
|
-
expect(patch.id).
|
|
11
|
+
expect(patch.id).toEqual(expect.any(String));
|
|
11
12
|
const { adminToken } = await initAdmin({ organization: organization });
|
|
12
13
|
|
|
13
14
|
const arr = new PatchableArray();
|
|
@@ -3,11 +3,11 @@ import { PaymentStatus, PaymentGeneral } from '@stamhoofd/structures';
|
|
|
3
3
|
import { PatchPaymentsEndpoint } from '../../src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.js';
|
|
4
4
|
import { testServer } from '../helpers/TestServer.js';
|
|
5
5
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
6
|
-
import { Organization } from '@stamhoofd/models';
|
|
6
|
+
import type { Organization } from '@stamhoofd/models';
|
|
7
7
|
import { initAdmin } from '../init/initAdmin.js';
|
|
8
8
|
|
|
9
9
|
export async function changePaymentStatus({ payment, organization, status }: { payment: { id: string }; organization: Organization; status: PaymentStatus }) {
|
|
10
|
-
expect(payment.id).
|
|
10
|
+
expect(payment.id).toEqual(expect.any(String));
|
|
11
11
|
const { adminToken } = await initAdmin({ organization: organization });
|
|
12
12
|
|
|
13
13
|
const arr = new PatchableArray();
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { AutoEncoderPatchType
|
|
1
|
+
import type { AutoEncoderPatchType} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { PatchableArray } from '@simonbackx/simple-encoding';
|
|
2
3
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
3
|
-
import { Organization,
|
|
4
|
-
import {
|
|
4
|
+
import type { Organization, User } from '@stamhoofd/models';
|
|
5
|
+
import { Token } from '@stamhoofd/models';
|
|
6
|
+
import type { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
|
|
5
7
|
import { PatchUserMembersEndpoint } from '../../src/endpoints/global/registration/PatchUserMembersEndpoint.js';
|
|
6
8
|
import { testServer } from '../helpers/TestServer.js';
|
|
7
9
|
|
|
8
10
|
export async function patchUserMember({ patch, organization, user }: { patch: AutoEncoderPatchType<MemberWithRegistrationsBlob>; organization: Organization; user: User }) {
|
|
9
|
-
expect(patch.id).
|
|
11
|
+
expect(patch.id).toEqual(expect.any(String));
|
|
10
12
|
|
|
11
13
|
const token = await Token.createToken(user);
|
|
12
14
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/* eslint-disable jest/no-conditional-expect */
|
|
2
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
3
|
-
import { Organization
|
|
2
|
+
import type { Organization } from '@stamhoofd/models';
|
|
3
|
+
import { OrganizationFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { ApiUser, ApiUserRateLimits, PermissionLevel, Permissions, PermissionsResourceType, ResourcePermissions, UserMeta, UserPermissions } from '@stamhoofd/structures';
|
|
5
|
+
import { ApiUser, ApiUserRateLimits, PermissionLevel, Permissions, UserMeta, UserPermissions } from '@stamhoofd/structures';
|
|
7
6
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
7
|
+
import { GetUserEndpoint } from '../../src/endpoints/auth/GetUserEndpoint.js';
|
|
8
8
|
import { CreateApiUserEndpoint } from '../../src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.js';
|
|
9
9
|
import { testServer } from '../helpers/TestServer.js';
|
|
10
|
-
import { GetUserEndpoint } from '../../src/endpoints/auth/GetUserEndpoint.js';
|
|
11
10
|
|
|
12
11
|
describe('E2E.APIRateLimits', () => {
|
|
13
12
|
// Test endpoint
|