@stamhoofd/backend 2.118.1 → 2.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +32 -22
- package/src/audit-logs/ModelLogger.ts +4 -2
- package/src/audit-logs/OrderLogger.ts +1 -1
- package/src/boot.ts +32 -14
- package/src/crons/balance-emails.ts +4 -2
- package/src/crons/clearExcelCache.test.ts +8 -8
- package/src/crons/update-cached-balances.ts +40 -14
- package/src/debug.ts +3 -2
- package/src/decoders/StringArrayDecoder.ts +1 -1
- package/src/decoders/StringNullableDecoder.ts +1 -1
- package/src/email-recipient-loaders/documents.ts +2 -1
- package/src/email-recipient-loaders/members.ts +2 -1
- package/src/email-recipient-loaders/orders.ts +2 -1
- package/src/email-recipient-loaders/payments.ts +6 -3
- package/src/email-recipient-loaders/receivable-balances.ts +2 -1
- package/src/email-recipient-loaders/registrations.ts +2 -1
- package/src/email-replacements/getEmailReplacementsForPayment.ts +8 -7
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +7 -6
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +3 -2
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +2 -1
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +4 -3
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +3 -2
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +7 -5
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +12 -10
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +4 -3
- package/src/endpoints/auth/CreateAdminEndpoint.ts +8 -6
- package/src/endpoints/auth/CreateTokenEndpoint.ts +14 -12
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/DeleteUserEndpoint.ts +2 -1
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +5 -4
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +3 -2
- package/src/endpoints/auth/GetUserEndpoint.ts +3 -2
- package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/OpenIDConnectCallbackEndpoint.ts +4 -2
- package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +3 -2
- package/src/endpoints/auth/PatchUserEndpoint.ts +15 -12
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/SignupEndpoint.ts +5 -4
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +6 -5
- package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +3 -2
- package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +8 -5
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +5 -3
- package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +8 -5
- package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +9 -7
- package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +4 -3
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +4 -2
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +9 -7
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +22 -19
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +6 -4
- package/src/endpoints/global/email/GetEmailEndpoint.ts +4 -3
- package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +3 -2
- package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +7 -4
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +7 -5
- package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +11 -11
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +14 -11
- package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +3 -2
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +8 -5
- package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +7 -5
- package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +4 -3
- package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +9 -6
- package/src/endpoints/global/events/GetEventsEndpoint.ts +7 -4
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +17 -15
- package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +28 -26
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +8 -5
- package/src/endpoints/global/files/GetFileCache.ts +5 -3
- package/src/endpoints/global/files/UploadFile.ts +10 -4
- package/src/endpoints/global/files/UploadImage.ts +4 -2
- package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +4 -2
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +8 -5
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +7 -5
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +3 -2
- package/src/endpoints/global/members/GetMembersEndpoint.test.ts +4 -2
- package/src/endpoints/global/members/GetMembersEndpoint.ts +10 -8
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +257 -6
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +162 -107
- package/src/endpoints/global/members/helpers/validateGroupFilter.ts +4 -3
- package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +3 -2
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +8 -7
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +5 -3
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +5 -3
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +8 -5
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +4 -2
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +2 -1
- package/src/endpoints/global/platform/GetPlatformEndpoint.ts +3 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +3 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +7 -4
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +47 -0
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +206 -0
- package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +2 -1
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +10 -7
- package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +4 -2
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +3 -2
- package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +2 -1
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +5 -3
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +13 -9
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +50 -49
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +25 -22
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -5
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +9 -7
- package/src/endpoints/global/sso/GetSSOEndpoint.ts +4 -2
- package/src/endpoints/global/sso/SetSSOEndpoint.ts +3 -2
- package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +4 -2
- package/src/endpoints/global/webshops/GetWebshopsCountEndpoint.ts +43 -0
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.test.ts +808 -0
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.ts +221 -0
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +15 -13
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +9 -7
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +36 -1
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +13 -4
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +6 -3
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +4 -2
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +3 -2
- package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +5 -3
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +22 -19
- package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +11 -9
- package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +8 -7
- package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +18 -16
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +2 -1
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +8 -5
- package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +4 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +32 -29
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +6 -3
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +7 -6
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/webshops/{GetWebshopTicketsCountEndpoint → GetWebshopTicketsCountEndpoint.ts} +7 -7
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +9 -6
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +13 -12
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -1
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +6 -4
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +4 -3
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +4 -3
- package/src/endpoints/organization/shared/GetUitpasNumberDetailsEndpoint.ts +3 -2
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +5 -4
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +7 -5
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +7 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +11 -10
- package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +5 -4
- package/src/endpoints/system/HealthEndpoint.test.ts +44 -0
- package/src/endpoints/system/HealthEndpoint.ts +14 -6
- package/src/excel-loaders/balance-items.ts +19 -17
- package/src/excel-loaders/event-notifications.ts +15 -13
- package/src/excel-loaders/index.ts +1 -0
- package/src/excel-loaders/members.ts +45 -43
- package/src/excel-loaders/organizations.ts +26 -25
- package/src/excel-loaders/payments.ts +44 -42
- package/src/excel-loaders/platform-memberships.ts +202 -0
- package/src/excel-loaders/receivable-balances.ts +25 -23
- package/src/excel-loaders/registrations.ts +30 -28
- package/src/helpers/AddressValidator.test.ts +2 -1
- package/src/helpers/AddressValidator.ts +13 -10
- package/src/helpers/AdminPermissionChecker.ts +193 -95
- package/src/helpers/AuthenticatedStructures.ts +13 -11
- package/src/helpers/BuckarooHelper.ts +3 -2
- package/src/helpers/Context.ts +8 -6
- package/src/helpers/CookieHelper.ts +2 -2
- package/src/helpers/FileCache.ts +9 -9
- package/src/helpers/ForwardHandler.ts +3 -2
- package/src/helpers/GlobalHelper.ts +2 -0
- package/src/helpers/GroupBuilder.ts +2 -1
- package/src/helpers/GroupedThrottledQueue.test.ts +19 -19
- package/src/helpers/LimitedFilteredRequestHelper.ts +1 -1
- package/src/helpers/MemberCharger.ts +2 -1
- package/src/helpers/MemberUserSyncer.ts +6 -3
- package/src/helpers/MembershipCharger.ts +2 -2
- package/src/helpers/OrganizationCharger.ts +2 -1
- package/src/helpers/PeriodHelper.ts +2 -1
- package/src/helpers/SQLTranslatedString.ts +3 -2
- package/src/helpers/ServiceFeeHelper.ts +1 -1
- package/src/helpers/SetupStepUpdater.ts +6 -5
- package/src/helpers/StripeHelper.ts +9 -8
- package/src/helpers/TagHelper.test.ts +5 -5
- package/src/helpers/TagHelper.ts +2 -1
- package/src/helpers/TemporaryMemberAccess.ts +2 -1
- package/src/helpers/ThrottledQueue.test.ts +20 -20
- package/src/helpers/UitpasTokenRepository.ts +7 -7
- package/src/helpers/ViesHelper.ts +5 -4
- package/src/helpers/XlsxTransformerColumnHelper.ts +21 -19
- package/src/helpers/email-html-helpers.ts +13 -12
- package/src/helpers/fetchToAsyncIterator.ts +1 -1
- package/src/helpers/outstandingBalanceJoin.ts +2 -1
- package/src/helpers/updateMemberDetailsUitpasNumber.ts +5 -4
- package/src/middleware/ContextMiddleware.ts +1 -1
- package/src/migrate.ts +21 -4
- package/src/seeds/0000000003-default-email-templates.ts +1 -1
- package/src/seeds/0000000004-single-organization.ts +2 -1
- package/src/seeds/1752848561-groups-registration-periods.ts +3 -2
- package/src/seeds/1754560914-groups-prices.test.ts +2 -1
- package/src/seeds/1754560914-groups-prices.ts +2 -1
- package/src/seeds/1755790070-fill-email-recipient-errors.ts +6 -6
- package/src/seeds/1755876819-remove-duplicate-members.ts +2 -1
- package/src/seeds/1765896674-document-update-year.test.ts +2 -1
- package/src/seeds/1773754928-force-save-members.ts +15 -0
- package/src/services/AuditLogService.ts +3 -2
- package/src/services/BalanceItemPaymentService.ts +2 -2
- package/src/services/BalanceItemService.ts +2 -1
- package/src/services/BootChecksService.test.ts +33 -0
- package/src/services/BootChecksService.ts +21 -0
- package/src/services/DatabaseCollationService.test.ts +18 -0
- package/src/services/DatabaseCollationService.ts +81 -0
- package/src/services/DocumentService.ts +1 -1
- package/src/services/EventNotificationService.ts +5 -4
- package/src/services/FileSignService.ts +2 -2
- package/src/services/InvoiceService.ts +3 -3
- package/src/services/MemberNumberService.ts +6 -4
- package/src/services/MemberRecordStore.ts +28 -19
- package/src/services/PaymentReallocationService.test.ts +2 -1
- package/src/services/PaymentReallocationService.ts +2 -1
- package/src/services/PaymentService.ts +28 -26
- package/src/services/RegistrationService.ts +65 -3
- package/src/services/SSOService.ts +13 -9
- package/src/services/STPackageService.ts +7 -5
- package/src/services/StartupHealthService.ts +15 -0
- package/src/services/uitpas/PassholderEndpoints.ts +2 -2
- package/src/services/uitpas/UitpasService.ts +11 -8
- package/src/services/uitpas/cancelTicketSales.ts +1 -1
- package/src/services/uitpas/checkPermissionsFor.ts +9 -9
- package/src/services/uitpas/getSocialTariffForEvent.ts +4 -4
- package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +5 -5
- package/src/services/uitpas/handleUitpasResponse.ts +1 -1
- package/src/services/uitpas/registerTicketSales.ts +4 -4
- package/src/services/uitpas/searchUitpasEvents.ts +3 -3
- package/src/services/uitpas/searchUitpasOrganizers.ts +3 -3
- package/src/sql-filters/audit-logs.ts +2 -1
- package/src/sql-filters/balance-item-payments.ts +2 -1
- package/src/sql-filters/balance-items.ts +2 -1
- package/src/sql-filters/base-registration-filter-compilers.ts +6 -4
- package/src/sql-filters/document-templates.ts +2 -1
- package/src/sql-filters/documents.ts +2 -1
- package/src/sql-filters/email-recipients.ts +2 -1
- package/src/sql-filters/emails.ts +2 -1
- package/src/sql-filters/event-notifications.ts +2 -1
- package/src/sql-filters/events.ts +2 -1
- package/src/sql-filters/groups.ts +2 -1
- package/src/sql-filters/invoiced-balance-items.ts +2 -1
- package/src/sql-filters/invoices.ts +2 -1
- package/src/sql-filters/member-responsibility-records.ts +2 -1
- package/src/sql-filters/members.ts +8 -7
- package/src/sql-filters/orders.ts +3 -2
- package/src/sql-filters/organization-registration-periods.ts +2 -1
- package/src/sql-filters/organizations.ts +2 -1
- package/src/sql-filters/payments.ts +2 -1
- package/src/sql-filters/platform-memberships.ts +67 -0
- package/src/sql-filters/receivable-balances.ts +2 -1
- package/src/sql-filters/registration-periods.ts +2 -1
- package/src/sql-filters/registrations.ts +2 -1
- package/src/sql-filters/tickets.ts +2 -1
- package/src/sql-filters/users.ts +2 -1
- package/src/sql-filters/webshops.ts +38 -0
- package/src/sql-sorters/audit-logs.ts +3 -2
- package/src/sql-sorters/balance-items.ts +3 -2
- package/src/sql-sorters/document-templates.ts +3 -2
- package/src/sql-sorters/documents.ts +3 -2
- package/src/sql-sorters/email-recipients.ts +3 -2
- package/src/sql-sorters/emails.ts +3 -2
- package/src/sql-sorters/event-notifications.ts +3 -2
- package/src/sql-sorters/events.ts +3 -2
- package/src/sql-sorters/groups.ts +3 -2
- package/src/sql-sorters/invoices.ts +3 -2
- package/src/sql-sorters/members.ts +3 -2
- package/src/sql-sorters/orders.ts +3 -2
- package/src/sql-sorters/organization-registration-periods.ts +3 -2
- package/src/sql-sorters/organizations.ts +3 -2
- package/src/sql-sorters/payments.ts +3 -2
- package/src/sql-sorters/platform-memberships.ts +40 -0
- package/src/sql-sorters/receivable-balances.ts +3 -2
- package/src/sql-sorters/registration-periods.ts +3 -2
- package/src/sql-sorters/registrations.ts +3 -2
- package/src/sql-sorters/tickets.ts +3 -2
- package/src/sql-sorters/webshops.ts +40 -0
- package/tests/actions/patchOrganizationMember.ts +5 -4
- package/tests/actions/patchPaymentStatus.ts +2 -2
- package/tests/actions/patchUserMember.ts +6 -4
- package/tests/e2e/api-rate-limits.test.ts +4 -5
- package/tests/e2e/bundle-discounts.test.ts +3 -2
- package/tests/e2e/charge-members.test.ts +7 -5
- package/tests/e2e/documents.test.ts +3 -2
- package/tests/e2e/private-files.test.ts +11 -13
- package/tests/e2e/register.test.ts +6 -5
- package/tests/e2e/stock.test.ts +6 -8
- package/tests/e2e/tickets.test.ts +4 -2
- package/tests/helpers/StripeMocker.ts +3 -3
- package/tests/init/initAdmin.ts +4 -2
- package/tests/init/initBundleDiscount.ts +3 -2
- package/tests/init/initPayconiq.ts +1 -1
- package/tests/init/initPermissionRole.ts +4 -2
- package/tests/init/initPlatformRecordCategory.ts +1 -1
- package/tests/init/initStripe.ts +1 -1
- package/tests/vitest.global.setup.ts +26 -0
- package/tests/{jest.setup.ts → vitest.setup.ts} +4 -3
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +10 -41
- package/tsconfig.test.json +17 -0
- package/vitest.config.js +13 -0
- package/eslint.config.mjs +0 -5
- package/jest.config.cjs +0 -27
- package/tests/jest.global.setup.ts +0 -33
- package/tests/toMatchMap.ts +0 -68
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import { DecodedRequest,
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
4
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
4
|
-
import { BalanceItem
|
|
5
|
+
import type { BalanceItem} from '@stamhoofd/models';
|
|
6
|
+
import { Organization, Platform, STPackage } from '@stamhoofd/models';
|
|
5
7
|
import { CheckoutResponse, PackageCheckout, Payment as PaymentStruct, STPackageBundleHelper, STPackageStruct } from '@stamhoofd/structures';
|
|
6
8
|
import { Context } from '../../../helpers/Context.js';
|
|
7
9
|
import { PaymentService } from '../../../services/PaymentService.js';
|
|
@@ -16,7 +18,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
16
18
|
bodyDecoder = PackageCheckout as Decoder<Body>;
|
|
17
19
|
|
|
18
20
|
protected doesMatch(request: Request): [true, Params] | [false] {
|
|
19
|
-
if (request.method
|
|
21
|
+
if (request.method !== 'POST') {
|
|
20
22
|
return [false];
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -48,7 +50,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
48
50
|
if (!foundCompany) {
|
|
49
51
|
throw new SimpleError({
|
|
50
52
|
code: 'invalid_data',
|
|
51
|
-
message: $t(`
|
|
53
|
+
message: $t(`%w1`),
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -100,7 +102,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
100
102
|
throw new SimpleError({
|
|
101
103
|
code: 'not_found',
|
|
102
104
|
message: 'Package not found',
|
|
103
|
-
human: $t('
|
|
105
|
+
human: $t('%1L1'),
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -181,7 +183,7 @@ export class ActivatePackagesEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
181
183
|
throw new SimpleError({
|
|
182
184
|
code: 'missing_data',
|
|
183
185
|
message: 'Checkout was empty',
|
|
184
|
-
human: $t('
|
|
186
|
+
human: $t('%1L2'),
|
|
185
187
|
});
|
|
186
188
|
}
|
|
187
189
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
2
3
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
3
4
|
import { STPackage } from '@stamhoofd/models';
|
|
4
5
|
|
|
@@ -39,7 +40,7 @@ export class DeactivatePackageEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
39
40
|
throw new SimpleError({
|
|
40
41
|
code: 'not_found',
|
|
41
42
|
message: 'Package not found',
|
|
42
|
-
human: $t('
|
|
43
|
+
human: $t('%1L3'),
|
|
43
44
|
statusCode: 404,
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -48,7 +49,7 @@ export class DeactivatePackageEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
48
49
|
throw new SimpleError({
|
|
49
50
|
code: 'not_allowed',
|
|
50
51
|
message: "Can't deactivate this package",
|
|
51
|
-
human: $t('
|
|
52
|
+
human: $t('%1L4'),
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Decoder} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { AutoEncoder, field, StringDecoder } from '@simonbackx/simple-encoding';
|
|
3
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
4
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
5
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
4
6
|
import { Organization, Webshop } from '@stamhoofd/models';
|
|
5
7
|
type Params = Record<string, never>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import { DecodedRequest,
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
4
|
import { Email, Platform, RateLimiter } from '@stamhoofd/models';
|
|
4
|
-
import { EmailPreview
|
|
5
|
+
import type { EmailPreview} from '@stamhoofd/structures';
|
|
6
|
+
import { EmailStatus, Email as EmailStruct, EmailTemplate as EmailTemplateStruct } from '@stamhoofd/structures';
|
|
5
7
|
|
|
6
8
|
import { Context } from '../../../helpers/Context.js';
|
|
7
9
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
@@ -68,7 +70,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
68
70
|
if (!await Context.auth.canSendEmails(organization)) {
|
|
69
71
|
throw Context.auth.error({
|
|
70
72
|
message: 'Cannot send emails',
|
|
71
|
-
human: $t('
|
|
73
|
+
human: $t('%1Cv'),
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -98,7 +100,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
98
100
|
if (!await Context.auth.canSendEmailsFrom(organization, sender.id)) {
|
|
99
101
|
throw Context.auth.error({
|
|
100
102
|
message: 'Cannot send emails from this sender',
|
|
101
|
-
human: $t('
|
|
103
|
+
human: $t('%1Cw'),
|
|
102
104
|
});
|
|
103
105
|
}
|
|
104
106
|
model.senderId = sender.id;
|
|
@@ -110,7 +112,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
110
112
|
throw new SimpleError({
|
|
111
113
|
code: 'invalid_sender',
|
|
112
114
|
message: 'Sender not found',
|
|
113
|
-
human: $t(`
|
|
115
|
+
human: $t(`%1Cx`),
|
|
114
116
|
statusCode: 400,
|
|
115
117
|
});
|
|
116
118
|
}
|
|
@@ -134,7 +136,7 @@ export class CreateEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
134
136
|
if (!await Context.auth.canSendEmail(model)) {
|
|
135
137
|
throw Context.auth.error({
|
|
136
138
|
message: 'Cannot send emails from this sender',
|
|
137
|
-
human: $t('
|
|
139
|
+
human: $t('%1Cw'),
|
|
138
140
|
});
|
|
139
141
|
}
|
|
140
142
|
await model.queueForSending();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import {
|
|
2
|
+
import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
|
|
3
|
+
import { Email, EmailRecipient, MemberFactory, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
4
|
import { EmailStatus, LimitedFilteredRequest, PermissionLevel, Permissions, Replacement } from '@stamhoofd/structures';
|
|
4
5
|
import { TestUtils } from '@stamhoofd/test-utils';
|
|
5
6
|
import { testServer } from '../../../../tests/helpers/TestServer.js';
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
2
|
-
import {
|
|
1
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { CountFilteredRequest, EmailPreview, StamhoofdFilter } from '@stamhoofd/structures';
|
|
4
|
+
import { assertSort, EmailStatus, getSortFilter, LimitedFilteredRequest, mergeFilters, PaginatedResponse, PermissionLevel } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
6
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
5
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
8
|
import { Email, Platform } from '@stamhoofd/models';
|
|
7
|
-
import {
|
|
9
|
+
import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
10
|
+
import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
8
11
|
import { Context } from '../../../helpers/Context.js';
|
|
9
12
|
import { emailFilterCompilers } from '../../../sql-filters/emails.js';
|
|
10
13
|
import { emailSorters } from '../../../sql-sorters/emails.js';
|
|
@@ -58,24 +61,24 @@ export class GetAdminEmailsEndpoint extends Endpoint<Params, Query, Body, Respon
|
|
|
58
61
|
ids.push(sender.id);
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
if (ids.length === 0) {
|
|
62
|
-
throw Context.auth.error();
|
|
63
|
-
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
65
|
+
const filters: StamhoofdFilter[] = [{
|
|
66
|
+
userId: user.id,
|
|
67
|
+
}];
|
|
68
|
+
|
|
69
|
+
if (ids.length !== 0) {
|
|
70
|
+
filters.push({
|
|
71
|
+
senderId: {
|
|
72
|
+
$in: ids,
|
|
74
73
|
},
|
|
75
|
-
{
|
|
76
|
-
|
|
74
|
+
status: {
|
|
75
|
+
$neq: EmailStatus.Draft,
|
|
77
76
|
},
|
|
78
|
-
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
scopeFilter = mergeFilters([scopeFilter, {
|
|
81
|
+
$or: filters,
|
|
79
82
|
}]);
|
|
80
83
|
}
|
|
81
84
|
else {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Decoder} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { AutoEncoder, field, StringDecoder } from '@simonbackx/simple-encoding';
|
|
3
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
4
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
5
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
4
6
|
import { EmailAddress } from '@stamhoofd/email';
|
|
5
7
|
import { Organization } from '@stamhoofd/models';
|
|
@@ -53,7 +55,7 @@ export class GetEmailAddressEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
53
55
|
throw new SimpleError({
|
|
54
56
|
code: 'invalid_fields',
|
|
55
57
|
message: 'Invalid token or id',
|
|
56
|
-
human: $t(`
|
|
58
|
+
human: $t(`%DQ`),
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -95,7 +97,7 @@ export class GetEmailAddressEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
95
97
|
throw new SimpleError({
|
|
96
98
|
code: 'not_found',
|
|
97
99
|
message: 'Email not found',
|
|
98
|
-
human: $t(`
|
|
100
|
+
human: $t(`%DR`),
|
|
99
101
|
statusCode: 404,
|
|
100
102
|
});
|
|
101
103
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
2
3
|
import { Email } from '@stamhoofd/models';
|
|
3
|
-
import { EmailPreview } from '@stamhoofd/structures';
|
|
4
|
+
import type { EmailPreview } from '@stamhoofd/structures';
|
|
4
5
|
|
|
5
6
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
7
|
import { Context } from '../../../helpers/Context.js';
|
|
@@ -41,7 +42,7 @@ export class GetEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBody
|
|
|
41
42
|
throw new SimpleError({
|
|
42
43
|
code: 'not_found',
|
|
43
44
|
message: 'Email not found',
|
|
44
|
-
human: $t(`
|
|
45
|
+
human: $t(`%DR`),
|
|
45
46
|
statusCode: 404,
|
|
46
47
|
});
|
|
47
48
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import {
|
|
2
|
+
import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
|
|
3
|
+
import { Email, EmailRecipient, MemberFactory, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
4
|
import { EmailStatus, LimitedFilteredRequest, Replacement } from '@stamhoofd/structures';
|
|
4
5
|
import { TestUtils } from '@stamhoofd/test-utils';
|
|
5
6
|
import { testServer } from '../../../../tests/helpers/TestServer.js';
|
|
@@ -548,7 +549,7 @@ describe('Endpoint.GetUserEmails', () => {
|
|
|
548
549
|
// Check balanceTable replacement
|
|
549
550
|
const balanceTableReplacement = recipient.replacements.find(r => r.token === 'balanceTable');
|
|
550
551
|
expect(balanceTableReplacement).toBeDefined();
|
|
551
|
-
expect(balanceTableReplacement!.html).toBe('<p class="description">' + $t('
|
|
552
|
+
expect(balanceTableReplacement!.html).toBe('<p class="description">' + $t('%hX') + '</p>');
|
|
552
553
|
});
|
|
553
554
|
|
|
554
555
|
test('Should return one recipient for each member the user is associated with, if the email is different for each member', async () => {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
2
|
-
import {
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { CountFilteredRequest, EmailWithRecipients, StamhoofdFilter } from '@stamhoofd/structures';
|
|
4
|
+
import { assertSort, EmailStatus, getSortFilter, LimitedFilteredRequest, mergeFilters, PaginatedResponse } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
6
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
5
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
8
|
import { Email, Member } from '@stamhoofd/models';
|
|
7
|
-
import {
|
|
9
|
+
import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
10
|
+
import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
8
11
|
import { Context } from '../../../helpers/Context.js';
|
|
9
12
|
import { emailFilterCompilers, userEmailFilterCompilers } from '../../../sql-filters/emails.js';
|
|
10
13
|
import { emailSorters } from '../../../sql-sorters/emails.js';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Decoder} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { AutoEncoder, BooleanDecoder, field, StringDecoder } from '@simonbackx/simple-encoding';
|
|
3
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
4
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
5
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
4
6
|
import { Email, EmailAddress } from '@stamhoofd/email';
|
|
5
7
|
import { Context } from '../../../helpers/Context.js';
|
|
@@ -81,7 +83,7 @@ export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
81
83
|
throw new SimpleError({
|
|
82
84
|
code: 'invalid_fields',
|
|
83
85
|
message: 'Invalid token or id',
|
|
84
|
-
human: $t(`
|
|
86
|
+
human: $t(`%DQ`),
|
|
85
87
|
});
|
|
86
88
|
}
|
|
87
89
|
|
|
@@ -120,7 +122,7 @@ export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
120
122
|
throw new SimpleError({
|
|
121
123
|
code: 'not_found',
|
|
122
124
|
message: 'Email not found',
|
|
123
|
-
human: $t(`
|
|
125
|
+
human: $t(`%DR`),
|
|
124
126
|
statusCode: 404,
|
|
125
127
|
});
|
|
126
128
|
}
|
|
@@ -155,7 +157,7 @@ export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
155
157
|
throw new SimpleError({
|
|
156
158
|
code: 'too_many_unblocks',
|
|
157
159
|
message: 'Too many unblocks',
|
|
158
|
-
human: $t(`
|
|
160
|
+
human: $t(`%1L5`),
|
|
159
161
|
});
|
|
160
162
|
}
|
|
161
163
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { AutoEncoderPatchType } from '@simonbackx/simple-encoding';
|
|
1
|
+
import type { AutoEncoderPatchType } from '@simonbackx/simple-encoding';
|
|
3
2
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
4
|
-
import {
|
|
3
|
+
import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
|
|
4
|
+
import { Email, EmailRecipient, GroupFactory, MemberFactory, OrganizationFactory, RegistrationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
5
5
|
import { AccessRight, EmailRecipientFilter, EmailRecipientFilterType, EmailRecipientSubfilter, EmailStatus, Email as EmailStruct, OrganizationEmail, Parent, PermissionLevel, Permissions, PermissionsResourceType, ResourcePermissions, UserPermissions, Version } from '@stamhoofd/structures';
|
|
6
6
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
7
7
|
import { testServer } from '../../../../tests/helpers/TestServer.js';
|
|
@@ -146,7 +146,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
146
146
|
senderId: 'invalid-sender-id',
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
-
await expect(
|
|
149
|
+
await expect(patchEmail(body, token, organization))
|
|
150
150
|
.rejects
|
|
151
151
|
.toThrow(STExpect.errorWithCode('invalid_sender'));
|
|
152
152
|
});
|
|
@@ -197,7 +197,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
197
197
|
subject: 'new subject',
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
await expect(
|
|
200
|
+
await expect(patchEmail(body, token, organization))
|
|
201
201
|
.rejects
|
|
202
202
|
.toThrow(STExpect.errorWithCode('permission_denied'));
|
|
203
203
|
});
|
|
@@ -249,7 +249,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
249
249
|
subject: 'new subject',
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
await expect(
|
|
252
|
+
await expect(patchEmail(body, token, organization))
|
|
253
253
|
.rejects
|
|
254
254
|
.toThrow(STExpect.errorWithCode('permission_denied'));
|
|
255
255
|
});
|
|
@@ -350,7 +350,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
350
350
|
senderId: sender2.id,
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
-
await expect(
|
|
353
|
+
await expect(patchEmail(body, token, organization))
|
|
354
354
|
.rejects
|
|
355
355
|
.toThrow(STExpect.errorWithCode('permission_denied'));
|
|
356
356
|
});
|
|
@@ -402,7 +402,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
402
402
|
status: EmailStatus.Sending,
|
|
403
403
|
});
|
|
404
404
|
|
|
405
|
-
await expect(
|
|
405
|
+
await expect(patchEmail(body, token, organization))
|
|
406
406
|
.rejects
|
|
407
407
|
.toThrow(STExpect.errorWithCode('permission_denied'));
|
|
408
408
|
});
|
|
@@ -448,7 +448,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
448
448
|
|
|
449
449
|
const body = EmailStruct.patch({ id: email.id, senderId: sender.id, status: EmailStatus.Sending });
|
|
450
450
|
|
|
451
|
-
await expect(
|
|
451
|
+
await expect(patchEmail(body, token, organization))
|
|
452
452
|
.rejects
|
|
453
453
|
.toThrow(STExpect.errorWithCode('missing_unsubscribe_button'));
|
|
454
454
|
});
|
|
@@ -494,7 +494,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
494
494
|
|
|
495
495
|
const body = EmailStruct.patch({ id: email.id, senderId: sender.id, status: EmailStatus.Sending });
|
|
496
496
|
|
|
497
|
-
await expect(
|
|
497
|
+
await expect(patchEmail(body, token, organization))
|
|
498
498
|
.rejects
|
|
499
499
|
.toThrow(STExpect.errorWithCode('missing_unsubscribe_button'));
|
|
500
500
|
});
|
|
@@ -707,7 +707,7 @@ describe('Endpoint.PatchEmailEndpoint', () => {
|
|
|
707
707
|
|
|
708
708
|
const balanceTable = recipient.replacements.find(r => r.token === 'balanceTable');
|
|
709
709
|
expect(balanceTable).toBeDefined();
|
|
710
|
-
expect(balanceTable?.html).
|
|
710
|
+
expect(balanceTable?.html).toMatch($t('%hX'));
|
|
711
711
|
|
|
712
712
|
// Outstanding balance
|
|
713
713
|
const outstandingBalance = recipient.replacements.find(r => r.token === 'outstandingBalance');
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
2
3
|
import { Email, Platform } from '@stamhoofd/models';
|
|
3
|
-
import { EmailPreview
|
|
4
|
+
import type { EmailPreview} from '@stamhoofd/structures';
|
|
5
|
+
import { EmailRecipientsStatus, EmailStatus, Email as EmailStruct, PermissionLevel } from '@stamhoofd/structures';
|
|
4
6
|
|
|
5
|
-
import { AutoEncoderPatchType, Decoder
|
|
7
|
+
import type { AutoEncoderPatchType, Decoder} from '@simonbackx/simple-encoding';
|
|
8
|
+
import { patchObject } from '@simonbackx/simple-encoding';
|
|
6
9
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
7
10
|
import { Context } from '../../../helpers/Context.js';
|
|
8
11
|
|
|
@@ -41,7 +44,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
41
44
|
throw new SimpleError({
|
|
42
45
|
code: 'not_found',
|
|
43
46
|
message: 'Email not found',
|
|
44
|
-
human: $t(`
|
|
47
|
+
human: $t(`%DR`),
|
|
45
48
|
statusCode: 404,
|
|
46
49
|
});
|
|
47
50
|
}
|
|
@@ -63,7 +66,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
63
66
|
if (!await Context.auth.canSendEmailsFrom(organization, sender.id)) {
|
|
64
67
|
throw Context.auth.error({
|
|
65
68
|
message: 'Cannot send emails from this sender',
|
|
66
|
-
human: $t('
|
|
69
|
+
human: $t('%1Cw'),
|
|
67
70
|
});
|
|
68
71
|
}
|
|
69
72
|
model.senderId = sender.id;
|
|
@@ -79,7 +82,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
79
82
|
throw new SimpleError({
|
|
80
83
|
code: 'invalid_sender',
|
|
81
84
|
message: 'Sender not found',
|
|
82
|
-
human: $t(`
|
|
85
|
+
human: $t(`%1Cx`),
|
|
83
86
|
statusCode: 400,
|
|
84
87
|
});
|
|
85
88
|
}
|
|
@@ -96,7 +99,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
96
99
|
throw new SimpleError({
|
|
97
100
|
code: 'invalid_sender',
|
|
98
101
|
message: 'Sender not found',
|
|
99
|
-
human: $t(`
|
|
102
|
+
human: $t(`%1Cy`),
|
|
100
103
|
statusCode: 400,
|
|
101
104
|
});
|
|
102
105
|
}
|
|
@@ -119,7 +122,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
119
122
|
throw new SimpleError({
|
|
120
123
|
code: 'not_draft',
|
|
121
124
|
message: 'Email is not a draft',
|
|
122
|
-
human: $t(`
|
|
125
|
+
human: $t(`%1Dy`),
|
|
123
126
|
statusCode: 400,
|
|
124
127
|
});
|
|
125
128
|
}
|
|
@@ -128,7 +131,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
128
131
|
throw new SimpleError({
|
|
129
132
|
code: 'already_created',
|
|
130
133
|
message: 'Recipients already created',
|
|
131
|
-
human: $t(`
|
|
134
|
+
human: $t(`%1Ko`),
|
|
132
135
|
statusCode: 400,
|
|
133
136
|
});
|
|
134
137
|
}
|
|
@@ -142,7 +145,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
142
145
|
throw new SimpleError({
|
|
143
146
|
code: 'not_draft',
|
|
144
147
|
message: 'Email is not a draft',
|
|
145
|
-
human: $t(`
|
|
148
|
+
human: $t(`%1Dz`),
|
|
146
149
|
statusCode: 400,
|
|
147
150
|
});
|
|
148
151
|
}
|
|
@@ -184,7 +187,7 @@ export class PatchEmailEndpoint extends Endpoint<Params, Query, Body, ResponseBo
|
|
|
184
187
|
if (!await Context.auth.canSendEmail(model)) {
|
|
185
188
|
throw Context.auth.error({
|
|
186
189
|
message: 'Cannot send emails from this sender',
|
|
187
|
-
human: $t('
|
|
190
|
+
human: $t('%1Cw'),
|
|
188
191
|
});
|
|
189
192
|
}
|
|
190
193
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import { DecodedRequest,
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
4
|
import { CountFilteredRequest, CountResponse } from '@stamhoofd/structures';
|
|
4
5
|
|
|
5
6
|
import { Context } from '../../../helpers/Context.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
2
2
|
import { GetEmailRecipientsEndpoint } from './GetEmailRecipientsEndpoint.js';
|
|
3
3
|
import { AccessRight, EmailStatus, LimitedFilteredRequest, OrganizationEmail, PermissionLevel, Permissions, PermissionsResourceType, ResourcePermissions } from '@stamhoofd/structures';
|
|
4
|
-
import {
|
|
4
|
+
import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
|
|
5
|
+
import { Email, EmailRecipient, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
5
6
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
6
7
|
import { testServer } from '../../../../tests/helpers/TestServer.js';
|
|
7
8
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
2
|
-
import {
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
|
+
import type { CountFilteredRequest, EmailRecipient as EmailRecipientStruct, StamhoofdFilter } from '@stamhoofd/structures';
|
|
4
|
+
import { assertSort, getSortFilter, LimitedFilteredRequest, PaginatedResponse, PermissionLevel } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
6
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
5
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
8
|
import { EmailRecipient, fillRecipientReplacements } from '@stamhoofd/models';
|
|
7
|
-
import {
|
|
9
|
+
import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
10
|
+
import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
8
11
|
import { Context } from '../../../helpers/Context.js';
|
|
9
12
|
import { emailRecipientsFilterCompilers } from '../../../sql-filters/email-recipients.js';
|
|
10
13
|
import { emailRecipientSorters } from '../../../sql-sorters/email-recipients.js';
|
|
@@ -50,7 +53,7 @@ export class GetEmailRecipientsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
50
53
|
if (!await validateEmailRecipientFilter({ filter: q.filter, permissionLevel: PermissionLevel.Read })) {
|
|
51
54
|
throw Context.auth.error({
|
|
52
55
|
message: 'You do not have sufficient permissions to view all email recipients',
|
|
53
|
-
human: $t(`
|
|
56
|
+
human: $t(`%1E0`),
|
|
54
57
|
});
|
|
55
58
|
}
|
|
56
59
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
2
3
|
import { Email, EmailRecipient } from '@stamhoofd/models';
|
|
3
|
-
import { EmailRecipient as EmailRecipientStruct
|
|
4
|
+
import type { EmailRecipient as EmailRecipientStruct} from '@stamhoofd/structures';
|
|
5
|
+
import { EmailStatus, PermissionLevel } from '@stamhoofd/structures';
|
|
4
6
|
|
|
5
7
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
8
|
import { Context } from '../../../helpers/Context.js';
|
|
@@ -37,7 +39,7 @@ export class RetryEmailRecipientEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
37
39
|
throw new SimpleError({
|
|
38
40
|
code: 'not_found',
|
|
39
41
|
message: 'Email recipient not found',
|
|
40
|
-
human: $t(`
|
|
42
|
+
human: $t(`%1GZ`),
|
|
41
43
|
statusCode: 404,
|
|
42
44
|
});
|
|
43
45
|
}
|
|
@@ -47,7 +49,7 @@ export class RetryEmailRecipientEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
47
49
|
throw new SimpleError({
|
|
48
50
|
code: 'not_found',
|
|
49
51
|
message: 'Email not found',
|
|
50
|
-
human: $t(`
|
|
52
|
+
human: $t(`%DR`),
|
|
51
53
|
statusCode: 404,
|
|
52
54
|
});
|
|
53
55
|
}
|
|
@@ -68,7 +70,7 @@ export class RetryEmailRecipientEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
68
70
|
throw new SimpleError({
|
|
69
71
|
code: 'already_sent',
|
|
70
72
|
message: 'Cant retry email recipient that is already sent',
|
|
71
|
-
human: $t(`
|
|
73
|
+
human: $t(`%1Ga`),
|
|
72
74
|
statusCode: 400,
|
|
73
75
|
});
|
|
74
76
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
2
2
|
import { Email } from '@stamhoofd/models';
|
|
3
|
-
import {
|
|
3
|
+
import type { PermissionLevel, StamhoofdFilter, WrapperFilter } from '@stamhoofd/structures';
|
|
4
|
+
import { FilterWrapperMarker, unwrapFilter } from '@stamhoofd/structures';
|
|
4
5
|
import { Context } from '../../../../helpers/Context.js';
|
|
5
6
|
|
|
6
7
|
export async function validateEmailRecipientFilter({ filter, permissionLevel }: { filter: StamhoofdFilter; permissionLevel: PermissionLevel }) {
|
|
@@ -42,7 +43,7 @@ export async function validateEmailRecipientFilter({ filter, permissionLevel }:
|
|
|
42
43
|
code: 'invalid_field',
|
|
43
44
|
field: 'filter',
|
|
44
45
|
message: 'You must filter on an email id of the email recipients you are trying to access',
|
|
45
|
-
human: $t(`
|
|
46
|
+
human: $t(`%1E1`),
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -72,7 +73,7 @@ export async function validateEmailRecipientFilter({ filter, permissionLevel }:
|
|
|
72
73
|
if (!await Context.auth.canAccessEmail(email, permissionLevel)) {
|
|
73
74
|
throw Context.auth.error({
|
|
74
75
|
message: 'You do not have access to this email',
|
|
75
|
-
human: $t(`
|
|
76
|
+
human: $t(`%1E2`),
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import { DecodedRequest,
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
3
4
|
import { CountFilteredRequest, CountResponse } from '@stamhoofd/structures';
|
|
4
5
|
|
|
5
6
|
import { Context } from '../../../helpers/Context.js';
|