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