@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
|
@@ -0,0 +1,221 @@
|
|
|
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';
|
|
4
|
+
import { SimpleError } from '@simonbackx/simple-errors';
|
|
5
|
+
import { Organization, Webshop } from '@stamhoofd/models';
|
|
6
|
+
import { SQL, applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
7
|
+
import type { CountFilteredRequest, StamhoofdFilter } from '@stamhoofd/structures';
|
|
8
|
+
import { LimitedFilteredRequest, PaginatedResponse, PermissionLevel, WebshopWithOrganization, assertSort, getSortFilter } from '@stamhoofd/structures';
|
|
9
|
+
|
|
10
|
+
import type { SQLResultNamespacedRow } from '@simonbackx/simple-database';
|
|
11
|
+
import { Formatter } from '@stamhoofd/utility';
|
|
12
|
+
import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures.js';
|
|
13
|
+
import { Context } from '../../../helpers/Context.js';
|
|
14
|
+
import { organizationFilterCompilers } from '../../../sql-filters/organizations.js';
|
|
15
|
+
import { webshopFilterCompilers } from '../../../sql-filters/webshops.js';
|
|
16
|
+
import { webshopSorters } from '../../../sql-sorters/webshops.js';
|
|
17
|
+
|
|
18
|
+
type Params = Record<string, never>;
|
|
19
|
+
type Query = LimitedFilteredRequest;
|
|
20
|
+
type Body = undefined;
|
|
21
|
+
type ResponseBody = PaginatedResponse<WebshopWithOrganization[], LimitedFilteredRequest>;
|
|
22
|
+
|
|
23
|
+
const sorters = webshopSorters;
|
|
24
|
+
const filterCompilers = webshopFilterCompilers;
|
|
25
|
+
|
|
26
|
+
export class GetWebshopsEndpoint extends Endpoint<Params, Query, Body, ResponseBody> {
|
|
27
|
+
queryDecoder = LimitedFilteredRequest as Decoder<LimitedFilteredRequest>;
|
|
28
|
+
|
|
29
|
+
protected doesMatch(request: Request): [true, Params] | [false] {
|
|
30
|
+
if (request.method !== 'GET') {
|
|
31
|
+
return [false];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const params = Endpoint.parseParameters(request.url, '/webshops', {});
|
|
35
|
+
|
|
36
|
+
if (params) {
|
|
37
|
+
return [true, params as Params];
|
|
38
|
+
}
|
|
39
|
+
return [false];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static async buildQuery(q: CountFilteredRequest | LimitedFilteredRequest) {
|
|
43
|
+
const organization = Context.organization;
|
|
44
|
+
|
|
45
|
+
const query = SQL
|
|
46
|
+
.select(
|
|
47
|
+
SQL.wildcard('webshops'),
|
|
48
|
+
)
|
|
49
|
+
.setMaxExecutionTime(15 * 1000)
|
|
50
|
+
.from(
|
|
51
|
+
SQL.table('webshops'),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (organization) {
|
|
55
|
+
// Organization context: scope to this organization's webshops only
|
|
56
|
+
const scopeFilter: StamhoofdFilter = {
|
|
57
|
+
organizationId: {
|
|
58
|
+
$eq: organization.id,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
query.where(await compileToSQLFilter(scopeFilter, filterCompilers));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Platform context: check platform access
|
|
65
|
+
const tags = Context.auth.getPlatformAccessibleOrganizationTags(PermissionLevel.Read);
|
|
66
|
+
|
|
67
|
+
if (tags !== 'all' && tags.length === 0) {
|
|
68
|
+
throw Context.auth.error();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (tags !== 'all') {
|
|
72
|
+
// Join with organizations table to filter by accessible organization tags
|
|
73
|
+
query.join(
|
|
74
|
+
SQL.join(SQL.table('organizations'))
|
|
75
|
+
.where(
|
|
76
|
+
SQL.column('webshops', 'organizationId'),
|
|
77
|
+
SQL.column('organizations', 'id'),
|
|
78
|
+
),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Apply tag scope filter using the organizations filter compiler
|
|
82
|
+
const tagScopeFilter: StamhoofdFilter = {
|
|
83
|
+
tags: {
|
|
84
|
+
$in: tags,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
query.where(await compileToSQLFilter(tagScopeFilter, organizationFilterCompilers));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (q.filter) {
|
|
92
|
+
query.where(await compileToSQLFilter(q.filter, filterCompilers));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (q.search) {
|
|
96
|
+
const searchFilter: StamhoofdFilter = {
|
|
97
|
+
$or: [
|
|
98
|
+
{
|
|
99
|
+
name: {
|
|
100
|
+
$contains: q.search,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
query.where(await compileToSQLFilter(searchFilter, filterCompilers));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (q instanceof LimitedFilteredRequest) {
|
|
109
|
+
if (q.pageFilter) {
|
|
110
|
+
query.where(await compileToSQLFilter(q.pageFilter, filterCompilers));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
q.sort = assertSort(q.sort, [{ key: 'id' }]);
|
|
114
|
+
applySQLSorter(query, q.sort, sorters);
|
|
115
|
+
query.limit(q.limit);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return query;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static async buildData(requestQuery: LimitedFilteredRequest): Promise<PaginatedResponse<WebshopWithOrganization[], LimitedFilteredRequest>> {
|
|
122
|
+
const query = await GetWebshopsEndpoint.buildQuery(requestQuery);
|
|
123
|
+
let data: SQLResultNamespacedRow[];
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
data = await query.fetch();
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error.message.includes('ER_QUERY_TIMEOUT')) {
|
|
130
|
+
throw new SimpleError({
|
|
131
|
+
code: 'timeout',
|
|
132
|
+
message: 'Query took too long',
|
|
133
|
+
human: $t(`%Cv`),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const webshops = Webshop.fromRows(data, 'webshops');
|
|
140
|
+
|
|
141
|
+
// Filter out webshops the user cannot access (e.g. specific resource-level permissions)
|
|
142
|
+
const accessibleWebshops: Webshop[] = [];
|
|
143
|
+
for (const webshop of webshops) {
|
|
144
|
+
if (await Context.auth.canAccessWebshop(webshop, PermissionLevel.Read)) {
|
|
145
|
+
accessibleWebshops.push(webshop);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Batch-load organizations for accessible webshops
|
|
150
|
+
const organizationIds = Formatter.uniqueArray(accessibleWebshops.map(w => w.organizationId));
|
|
151
|
+
const organizationModels = organizationIds.length > 0 ? await Organization.getByIDs(...organizationIds) : [];
|
|
152
|
+
|
|
153
|
+
let next: LimitedFilteredRequest | undefined;
|
|
154
|
+
|
|
155
|
+
if (webshops.length >= requestQuery.limit) {
|
|
156
|
+
const lastObject = webshops[webshops.length - 1];
|
|
157
|
+
const nextFilter = getSortFilter(lastObject, sorters, requestQuery.sort);
|
|
158
|
+
|
|
159
|
+
next = new LimitedFilteredRequest({
|
|
160
|
+
filter: requestQuery.filter,
|
|
161
|
+
pageFilter: nextFilter,
|
|
162
|
+
sort: requestQuery.sort,
|
|
163
|
+
limit: requestQuery.limit,
|
|
164
|
+
search: requestQuery.search,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
if (JSON.stringify(nextFilter) === JSON.stringify(requestQuery.pageFilter)) {
|
|
168
|
+
console.error('Found infinite loading loop for', requestQuery);
|
|
169
|
+
next = undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const results: WebshopWithOrganization[] = [];
|
|
174
|
+
for (const webshop of accessibleWebshops) {
|
|
175
|
+
const organizationModel = organizationModels.find(o => o.id === webshop.organizationId);
|
|
176
|
+
if (!organizationModel) {
|
|
177
|
+
// Skip webshops whose organization cannot be found
|
|
178
|
+
console.warn('Organization not found for webshop', webshop.id, webshop.organizationId);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const webshopStruct = AuthenticatedStructures.webshopPreview(webshop);
|
|
183
|
+
results.push(WebshopWithOrganization.create({
|
|
184
|
+
webshop: webshopStruct,
|
|
185
|
+
organization: organizationModel.getBaseStructure(),
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return new PaginatedResponse<WebshopWithOrganization[], LimitedFilteredRequest>({
|
|
190
|
+
results,
|
|
191
|
+
next,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async handle(request: DecodedRequest<Params, Query, Body>) {
|
|
196
|
+
await Context.setOptionalOrganizationScope();
|
|
197
|
+
await Context.authenticate();
|
|
198
|
+
|
|
199
|
+
const maxLimit = Context.auth.hasSomePlatformAccess() ? 1000 : 100;
|
|
200
|
+
|
|
201
|
+
if (request.query.limit > maxLimit) {
|
|
202
|
+
throw new SimpleError({
|
|
203
|
+
code: 'invalid_field',
|
|
204
|
+
field: 'limit',
|
|
205
|
+
message: 'Limit can not be more than ' + maxLimit,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (request.query.limit < 1) {
|
|
210
|
+
throw new SimpleError({
|
|
211
|
+
code: 'invalid_field',
|
|
212
|
+
field: 'limit',
|
|
213
|
+
message: 'Limit can not be less than 1',
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return new Response(
|
|
218
|
+
await GetWebshopsEndpoint.buildData(request.query),
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
@@ -1,7 +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 { SimpleError } from '@simonbackx/simple-errors';
|
|
3
4
|
import { BalanceItem } from '@stamhoofd/models';
|
|
4
|
-
import { BalanceItemWithPayments } from '@stamhoofd/structures';
|
|
5
|
+
import type { BalanceItemWithPayments } from '@stamhoofd/structures';
|
|
5
6
|
|
|
6
7
|
import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
|
|
7
8
|
import { Context } from '../../../../helpers/Context.js';
|
|
@@ -40,7 +41,7 @@ export class GetBalanceItemEndpoint extends Endpoint<Params, Query, Body, Respon
|
|
|
40
41
|
code: 'not_found',
|
|
41
42
|
statusCode: 404,
|
|
42
43
|
message: 'Balance item not found',
|
|
43
|
-
human: $t('
|
|
44
|
+
human: $t('%1L6'),
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -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 { BalanceItem } from '@stamhoofd/models';
|
|
5
6
|
import { applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
6
|
-
import { BalanceItem as BalanceItemStruct, CountFilteredRequest,
|
|
7
|
+
import type { BalanceItem as BalanceItemStruct, CountFilteredRequest, 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';
|
|
@@ -99,7 +101,7 @@ export class GetBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Respo
|
|
|
99
101
|
throw new SimpleError({
|
|
100
102
|
code: 'timeout',
|
|
101
103
|
message: 'Query took too long',
|
|
102
|
-
human: $t(`
|
|
104
|
+
human: $t(`%Cv`),
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
throw error;
|
|
@@ -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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
6
|
import { BalanceItem, Member, Order, User } from '@stamhoofd/models';
|
|
5
7
|
import { QueueHandler } from '@stamhoofd/queues';
|
|
@@ -74,13 +76,13 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
74
76
|
if (put.payingOrganizationId) {
|
|
75
77
|
// Not allowed if not full admin
|
|
76
78
|
if (!Context.auth.hasPlatformFullAccess()) {
|
|
77
|
-
throw Context.auth.error($t(`
|
|
79
|
+
throw Context.auth.error($t(`%Ef`));
|
|
78
80
|
}
|
|
79
81
|
if (put.payingOrganizationId === model.organizationId) {
|
|
80
82
|
throw new SimpleError({
|
|
81
83
|
code: 'invalid_field',
|
|
82
84
|
message: 'payingOrganizationId cannot be the same as organizationId',
|
|
83
|
-
human: $t(`
|
|
85
|
+
human: $t(`%Eg`),
|
|
84
86
|
field: 'payingOrganizationId',
|
|
85
87
|
});
|
|
86
88
|
}
|
|
@@ -92,7 +94,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
92
94
|
throw new SimpleError({
|
|
93
95
|
code: 'invalid_price',
|
|
94
96
|
message: 'Cannot create negative balance in the future',
|
|
95
|
-
human: $t(`
|
|
97
|
+
human: $t(`%Eh`),
|
|
96
98
|
});
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -100,7 +102,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
100
102
|
throw new SimpleError({
|
|
101
103
|
code: 'invalid_field',
|
|
102
104
|
message: 'createdAt cannot be in the future',
|
|
103
|
-
human: $t(`
|
|
105
|
+
human: $t(`%Ei`),
|
|
104
106
|
field: 'createdAt',
|
|
105
107
|
});
|
|
106
108
|
}
|
|
@@ -130,13 +132,13 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
130
132
|
if (patch.payingOrganizationId !== undefined) {
|
|
131
133
|
// Not allowed if not full admin
|
|
132
134
|
if (!Context.auth.hasPlatformFullAccess()) {
|
|
133
|
-
throw Context.auth.error($t(`
|
|
135
|
+
throw Context.auth.error($t(`%Ef`));
|
|
134
136
|
}
|
|
135
137
|
if (patch.payingOrganizationId === model.organizationId) {
|
|
136
138
|
throw new SimpleError({
|
|
137
139
|
code: 'invalid_field',
|
|
138
140
|
message: 'payingOrganizationId cannot be the same as organizationId',
|
|
139
|
-
human: $t(`
|
|
141
|
+
human: $t(`%Eg`),
|
|
140
142
|
field: 'payingOrganizationId',
|
|
141
143
|
});
|
|
142
144
|
}
|
|
@@ -158,7 +160,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
158
160
|
throw new SimpleError({
|
|
159
161
|
code: 'invalid_field',
|
|
160
162
|
message: 'No user or member provided',
|
|
161
|
-
human: $t(`
|
|
163
|
+
human: $t(`%Ej`),
|
|
162
164
|
field: 'memberId',
|
|
163
165
|
});
|
|
164
166
|
}
|
|
@@ -176,7 +178,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
176
178
|
throw new SimpleError({
|
|
177
179
|
code: 'invalid_field',
|
|
178
180
|
message: 'createdAt cannot be in the future',
|
|
179
|
-
human: $t(`
|
|
181
|
+
human: $t(`%Ei`),
|
|
180
182
|
field: 'createdAt',
|
|
181
183
|
});
|
|
182
184
|
}
|
|
@@ -194,7 +196,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
194
196
|
throw new SimpleError({
|
|
195
197
|
code: 'invalid_price',
|
|
196
198
|
message: 'Cannot create negative balance in the future',
|
|
197
|
-
human: $t(`
|
|
199
|
+
human: $t(`%Eh`),
|
|
198
200
|
field: 'dueAt',
|
|
199
201
|
});
|
|
200
202
|
}
|
|
@@ -248,7 +250,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
248
250
|
throw new SimpleError({
|
|
249
251
|
code: 'permission_denied',
|
|
250
252
|
message: 'No permission to link balance items to this member',
|
|
251
|
-
human: $t(`
|
|
253
|
+
human: $t(`%Ek`),
|
|
252
254
|
field: 'memberId',
|
|
253
255
|
});
|
|
254
256
|
}
|
|
@@ -262,7 +264,7 @@ export class PatchBalanceItemsEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
262
264
|
throw new SimpleError({
|
|
263
265
|
code: 'permission_denied',
|
|
264
266
|
message: 'No permission to link balance items to this user',
|
|
265
|
-
human: $t(`
|
|
267
|
+
human: $t(`%El`),
|
|
266
268
|
field: 'userId',
|
|
267
269
|
});
|
|
268
270
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
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 { DetailedPayableBalanceCollection} from '@stamhoofd/structures';
|
|
4
|
+
import { PaymentStatus } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
6
|
import { BalanceItem, Payment } from '@stamhoofd/models';
|
|
5
7
|
import { SQL } from '@stamhoofd/sql';
|
package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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 { PayableBalanceCollection} from '@stamhoofd/structures';
|
|
4
|
+
import { ReceivableBalanceType } from '@stamhoofd/structures';
|
|
3
5
|
|
|
4
6
|
import { Context } from '../../../../helpers/Context.js';
|
|
5
7
|
import { GetUserPayableBalanceEndpoint } from '../../../global/registration/GetUserPayableBalanceEndpoint.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 { OrganizationPackagesStatus, STPackage as STPackageStruct } from '@stamhoofd/structures';
|
|
3
4
|
import { Context } from '../../../../helpers/Context.js';
|
|
4
5
|
import { STPackageService } from '../../../../services/STPackageService.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 { SimpleError } from '@simonbackx/simple-errors';
|
|
3
4
|
import { DocumentTemplate } from '@stamhoofd/models';
|
|
4
5
|
|
|
@@ -37,7 +38,7 @@ export class GetDocumentTemplateXMLEndpoint extends Endpoint<Params, Query, Body
|
|
|
37
38
|
|
|
38
39
|
const template = await DocumentTemplate.getByID(request.params.id);
|
|
39
40
|
if (!template || !await Context.auth.canAccessDocumentTemplate(template)) {
|
|
40
|
-
throw Context.auth.notFoundOrNoAccess($t(`
|
|
41
|
+
throw Context.auth.notFoundOrNoAccess($t(`%EK`));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// Update documents
|
|
@@ -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,12 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
2
3
|
import { DocumentTemplate } from '@stamhoofd/models';
|
|
3
|
-
import {
|
|
4
|
+
import type { CountFilteredRequest, DocumentTemplatePrivate, StamhoofdFilter } from '@stamhoofd/structures';
|
|
5
|
+
import { assertSort, LimitedFilteredRequest, PaginatedResponse, SearchFilterFactory } from '@stamhoofd/structures';
|
|
4
6
|
|
|
5
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
6
|
-
import {
|
|
7
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
8
|
+
import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
9
|
+
import { applySQLSorter, compileToSQLFilter, SQL } from '@stamhoofd/sql';
|
|
7
10
|
import { Context } from '../../../../helpers/Context.js';
|
|
8
11
|
import { LimitedFilteredRequestHelper } from '../../../../helpers/LimitedFilteredRequestHelper.js';
|
|
9
12
|
import { documentTemplateFilterCompilers } from '../../../../sql-filters/document-templates.js';
|
|
@@ -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,12 @@
|
|
|
1
|
-
import { DecodedRequest,
|
|
1
|
+
import type { DecodedRequest, Request} from '@simonbackx/simple-endpoints';
|
|
2
|
+
import { Endpoint, Response } from '@simonbackx/simple-endpoints';
|
|
2
3
|
import { Document } from '@stamhoofd/models';
|
|
3
|
-
import {
|
|
4
|
+
import type { CountFilteredRequest, Document as DocumentStruct, StamhoofdFilter } from '@stamhoofd/structures';
|
|
5
|
+
import { assertSort, getSortFilter, LimitedFilteredRequest, PaginatedResponse, SearchFilterFactory } from '@stamhoofd/structures';
|
|
4
6
|
|
|
5
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
6
|
-
import {
|
|
7
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
8
|
+
import type { SQLFilterDefinitions, SQLSortDefinitions } from '@stamhoofd/sql';
|
|
9
|
+
import { applySQLSorter, compileToSQLFilter, SQL } from '@stamhoofd/sql';
|
|
7
10
|
import { AuthenticatedStructures } from '../../../../helpers/AuthenticatedStructures.js';
|
|
8
11
|
import { Context } from '../../../../helpers/Context.js';
|
|
9
12
|
import { LimitedFilteredRequestHelper } from '../../../../helpers/LimitedFilteredRequestHelper.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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
6
|
import { Document, DocumentTemplate, Member, Registration } from '@stamhoofd/models';
|
|
5
7
|
import { DocumentStatus, Document as DocumentStruct, PermissionLevel } from '@stamhoofd/structures';
|
|
@@ -40,7 +42,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
40
42
|
for (const patch of request.body.getPatches()) {
|
|
41
43
|
const document = await Document.getByID(patch.id);
|
|
42
44
|
if (!document || !(await Context.auth.canAccessDocument(document, PermissionLevel.Write))) {
|
|
43
|
-
throw Context.auth.notFoundOrNoAccess($t(`
|
|
45
|
+
throw Context.auth.notFoundOrNoAccess($t(`%EK`));
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
if (patch.data) {
|
|
@@ -57,7 +59,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
57
59
|
throw new SimpleError({
|
|
58
60
|
code: 'not_found',
|
|
59
61
|
message: 'Document not found',
|
|
60
|
-
human: $t(`
|
|
62
|
+
human: $t(`%EL`),
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -78,7 +80,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
78
80
|
throw new SimpleError({
|
|
79
81
|
code: 'not_found',
|
|
80
82
|
message: 'Document template not found',
|
|
81
|
-
human: $t(`
|
|
83
|
+
human: $t(`%EM`),
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
const document = new Document();
|
|
@@ -97,7 +99,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
97
99
|
throw new SimpleError({
|
|
98
100
|
code: 'not_found',
|
|
99
101
|
message: 'Registration not found',
|
|
100
|
-
human: $t(`
|
|
102
|
+
human: $t(`%EN`),
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
document.registrationId = put.registrationId;
|
|
@@ -109,7 +111,7 @@ export class PatchDocumentEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
109
111
|
throw new SimpleError({
|
|
110
112
|
code: 'not_found',
|
|
111
113
|
message: 'Member not found',
|
|
112
|
-
human: $t(`
|
|
114
|
+
human: $t(`%EO`),
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
document.memberId = put.memberId;
|
package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PatchableArray } from '@simonbackx/simple-encoding';
|
|
2
|
-
import { Endpoint
|
|
3
|
-
import {
|
|
2
|
+
import type { Endpoint} from '@simonbackx/simple-endpoints';
|
|
3
|
+
import { Request } from '@simonbackx/simple-endpoints';
|
|
4
|
+
import type { Organization, RegistrationPeriod, User} from '@stamhoofd/models';
|
|
5
|
+
import { DocumentTemplate, DocumentTemplateFactory, OrganizationFactory, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
4
6
|
import { SQL } from '@stamhoofd/sql';
|
|
5
7
|
import { DocumentPrivateSettings, DocumentStatus, DocumentTemplateDefinition, DocumentTemplatePrivate, PermissionLevel, Permissions } from '@stamhoofd/structures';
|
|
6
8
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
@@ -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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
6
|
import { DocumentTemplate } from '@stamhoofd/models';
|
|
5
7
|
import { DocumentTemplatePrivate, PermissionLevel } from '@stamhoofd/structures';
|
|
@@ -67,7 +69,7 @@ export class PatchDocumentTemplatesEndpoint extends Endpoint<Params, Query, Body
|
|
|
67
69
|
for (const patch of request.body.getPatches()) {
|
|
68
70
|
const template = await DocumentTemplate.getByID(patch.id);
|
|
69
71
|
if (!template || !await Context.auth.canAccessDocumentTemplate(template, PermissionLevel.Full)) {
|
|
70
|
-
throw Context.auth.notFoundOrNoAccess($t(`
|
|
72
|
+
throw Context.auth.notFoundOrNoAccess($t(`%EP`));
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
let shouldCheckIfAlreadyHasFiscalDocument = false;
|
|
@@ -124,7 +126,7 @@ export class PatchDocumentTemplatesEndpoint extends Endpoint<Params, Query, Body
|
|
|
124
126
|
throw new SimpleError({
|
|
125
127
|
code: 'not_found',
|
|
126
128
|
message: 'Template not found',
|
|
127
|
-
human: $t(`
|
|
129
|
+
human: $t(`%EQ`),
|
|
128
130
|
});
|
|
129
131
|
}
|
|
130
132
|
|
|
@@ -158,7 +160,7 @@ export class PatchDocumentTemplatesEndpoint extends Endpoint<Params, Query, Body
|
|
|
158
160
|
code: 'double_fiscal_document',
|
|
159
161
|
field: 'year',
|
|
160
162
|
message: 'This year already has a fiscal document',
|
|
161
|
-
human: $t('
|
|
163
|
+
human: $t('%1IS'),
|
|
162
164
|
});
|
|
163
165
|
}
|
|
164
166
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ArrayDecoder, 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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
5
|
import { EmailAddress } from '@stamhoofd/email';
|
|
5
6
|
import { EmailInformation } from '@stamhoofd/structures';
|
|
@@ -42,7 +43,7 @@ export class CheckEmailBouncesEndpoint extends Endpoint<Params, Query, Body, Res
|
|
|
42
43
|
throw new SimpleError({
|
|
43
44
|
code: 'too_many_recipients',
|
|
44
45
|
message: 'Too many recipients',
|
|
45
|
-
human: $t(`
|
|
46
|
+
human: $t(`%ER`),
|
|
46
47
|
field: 'recipients',
|
|
47
48
|
});
|
|
48
49
|
}
|