@stamhoofd/backend 2.118.1 → 2.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +32 -22
- package/src/audit-logs/ModelLogger.ts +4 -2
- package/src/audit-logs/OrderLogger.ts +1 -1
- package/src/boot.ts +32 -14
- package/src/crons/balance-emails.ts +4 -2
- package/src/crons/clearExcelCache.test.ts +8 -8
- package/src/crons/update-cached-balances.ts +40 -14
- package/src/debug.ts +3 -2
- package/src/decoders/StringArrayDecoder.ts +1 -1
- package/src/decoders/StringNullableDecoder.ts +1 -1
- package/src/email-recipient-loaders/documents.ts +2 -1
- package/src/email-recipient-loaders/members.ts +2 -1
- package/src/email-recipient-loaders/orders.ts +2 -1
- package/src/email-recipient-loaders/payments.ts +6 -3
- package/src/email-recipient-loaders/receivable-balances.ts +2 -1
- package/src/email-recipient-loaders/registrations.ts +2 -1
- package/src/email-replacements/getEmailReplacementsForPayment.ts +8 -7
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +7 -6
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +3 -2
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +2 -1
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +4 -3
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +3 -2
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +7 -5
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +12 -10
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +4 -3
- package/src/endpoints/auth/CreateAdminEndpoint.ts +8 -6
- package/src/endpoints/auth/CreateTokenEndpoint.ts +14 -12
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/DeleteUserEndpoint.ts +2 -1
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +5 -4
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +3 -2
- package/src/endpoints/auth/GetUserEndpoint.ts +3 -2
- package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +2 -1
- package/src/endpoints/auth/OpenIDConnectCallbackEndpoint.ts +4 -2
- package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +3 -2
- package/src/endpoints/auth/PatchUserEndpoint.ts +15 -12
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +3 -2
- package/src/endpoints/auth/SignupEndpoint.ts +5 -4
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +6 -5
- package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +3 -2
- package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +8 -5
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +5 -3
- package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +8 -5
- package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +9 -7
- package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +4 -3
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +4 -2
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +9 -7
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +22 -19
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +6 -4
- package/src/endpoints/global/email/GetEmailEndpoint.ts +4 -3
- package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +3 -2
- package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +7 -4
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +7 -5
- package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +11 -11
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +14 -11
- package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +3 -2
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +2 -1
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +8 -5
- package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +7 -5
- package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +4 -3
- package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +9 -6
- package/src/endpoints/global/events/GetEventsEndpoint.ts +7 -4
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +17 -15
- package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +4 -2
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +28 -26
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +8 -5
- package/src/endpoints/global/files/GetFileCache.ts +5 -3
- package/src/endpoints/global/files/UploadFile.ts +10 -4
- package/src/endpoints/global/files/UploadImage.ts +4 -2
- package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +4 -2
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +8 -5
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +7 -5
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +3 -2
- package/src/endpoints/global/members/GetMembersEndpoint.test.ts +4 -2
- package/src/endpoints/global/members/GetMembersEndpoint.ts +10 -8
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +257 -6
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +162 -107
- package/src/endpoints/global/members/helpers/validateGroupFilter.ts +4 -3
- package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +3 -2
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +3 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +8 -7
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +5 -3
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +5 -3
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +8 -5
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +4 -2
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +2 -1
- package/src/endpoints/global/platform/GetPlatformEndpoint.ts +3 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +3 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +7 -4
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +47 -0
- package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +206 -0
- package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +3 -2
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +2 -1
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +10 -7
- package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +4 -2
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +3 -2
- package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +2 -1
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +5 -3
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +13 -9
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +50 -49
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +25 -22
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -5
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +9 -7
- package/src/endpoints/global/sso/GetSSOEndpoint.ts +4 -2
- package/src/endpoints/global/sso/SetSSOEndpoint.ts +3 -2
- package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +4 -2
- package/src/endpoints/global/webshops/GetWebshopsCountEndpoint.ts +43 -0
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.test.ts +808 -0
- package/src/endpoints/global/webshops/GetWebshopsEndpoint.ts +221 -0
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +15 -13
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +9 -7
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +36 -1
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +13 -4
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +6 -3
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +4 -2
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +3 -2
- package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +5 -3
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +22 -19
- package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +11 -9
- package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +8 -7
- package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +7 -5
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +18 -16
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +2 -1
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +8 -5
- package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +4 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +4 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +32 -29
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +6 -3
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +4 -3
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +2 -1
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +7 -6
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +3 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +7 -4
- package/src/endpoints/organization/dashboard/webshops/{GetWebshopTicketsCountEndpoint → GetWebshopTicketsCountEndpoint.ts} +7 -7
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +9 -6
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +13 -12
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +4 -2
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +5 -3
- package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +6 -4
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -1
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +6 -4
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +4 -3
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +4 -3
- package/src/endpoints/organization/shared/GetUitpasNumberDetailsEndpoint.ts +3 -2
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +3 -2
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +5 -4
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +7 -5
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +4 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +7 -3
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +11 -10
- package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +5 -4
- package/src/endpoints/system/HealthEndpoint.test.ts +44 -0
- package/src/endpoints/system/HealthEndpoint.ts +14 -6
- package/src/excel-loaders/balance-items.ts +19 -17
- package/src/excel-loaders/event-notifications.ts +15 -13
- package/src/excel-loaders/index.ts +1 -0
- package/src/excel-loaders/members.ts +45 -43
- package/src/excel-loaders/organizations.ts +26 -25
- package/src/excel-loaders/payments.ts +44 -42
- package/src/excel-loaders/platform-memberships.ts +202 -0
- package/src/excel-loaders/receivable-balances.ts +25 -23
- package/src/excel-loaders/registrations.ts +30 -28
- package/src/helpers/AddressValidator.test.ts +2 -1
- package/src/helpers/AddressValidator.ts +13 -10
- package/src/helpers/AdminPermissionChecker.ts +193 -95
- package/src/helpers/AuthenticatedStructures.ts +13 -11
- package/src/helpers/BuckarooHelper.ts +3 -2
- package/src/helpers/Context.ts +8 -6
- package/src/helpers/CookieHelper.ts +2 -2
- package/src/helpers/FileCache.ts +9 -9
- package/src/helpers/ForwardHandler.ts +3 -2
- package/src/helpers/GlobalHelper.ts +2 -0
- package/src/helpers/GroupBuilder.ts +2 -1
- package/src/helpers/GroupedThrottledQueue.test.ts +19 -19
- package/src/helpers/LimitedFilteredRequestHelper.ts +1 -1
- package/src/helpers/MemberCharger.ts +2 -1
- package/src/helpers/MemberUserSyncer.ts +6 -3
- package/src/helpers/MembershipCharger.ts +2 -2
- package/src/helpers/OrganizationCharger.ts +2 -1
- package/src/helpers/PeriodHelper.ts +2 -1
- package/src/helpers/SQLTranslatedString.ts +3 -2
- package/src/helpers/ServiceFeeHelper.ts +1 -1
- package/src/helpers/SetupStepUpdater.ts +6 -5
- package/src/helpers/StripeHelper.ts +9 -8
- package/src/helpers/TagHelper.test.ts +5 -5
- package/src/helpers/TagHelper.ts +2 -1
- package/src/helpers/TemporaryMemberAccess.ts +2 -1
- package/src/helpers/ThrottledQueue.test.ts +20 -20
- package/src/helpers/UitpasTokenRepository.ts +7 -7
- package/src/helpers/ViesHelper.ts +5 -4
- package/src/helpers/XlsxTransformerColumnHelper.ts +21 -19
- package/src/helpers/email-html-helpers.ts +13 -12
- package/src/helpers/fetchToAsyncIterator.ts +1 -1
- package/src/helpers/outstandingBalanceJoin.ts +2 -1
- package/src/helpers/updateMemberDetailsUitpasNumber.ts +5 -4
- package/src/middleware/ContextMiddleware.ts +1 -1
- package/src/migrate.ts +21 -4
- package/src/seeds/0000000003-default-email-templates.ts +1 -1
- package/src/seeds/0000000004-single-organization.ts +2 -1
- package/src/seeds/1752848561-groups-registration-periods.ts +3 -2
- package/src/seeds/1754560914-groups-prices.test.ts +2 -1
- package/src/seeds/1754560914-groups-prices.ts +2 -1
- package/src/seeds/1755790070-fill-email-recipient-errors.ts +6 -6
- package/src/seeds/1755876819-remove-duplicate-members.ts +2 -1
- package/src/seeds/1765896674-document-update-year.test.ts +2 -1
- package/src/seeds/1773754928-force-save-members.ts +15 -0
- package/src/services/AuditLogService.ts +3 -2
- package/src/services/BalanceItemPaymentService.ts +2 -2
- package/src/services/BalanceItemService.ts +2 -1
- package/src/services/BootChecksService.test.ts +33 -0
- package/src/services/BootChecksService.ts +21 -0
- package/src/services/DatabaseCollationService.test.ts +18 -0
- package/src/services/DatabaseCollationService.ts +81 -0
- package/src/services/DocumentService.ts +1 -1
- package/src/services/EventNotificationService.ts +5 -4
- package/src/services/FileSignService.ts +2 -2
- package/src/services/InvoiceService.ts +3 -3
- package/src/services/MemberNumberService.ts +6 -4
- package/src/services/MemberRecordStore.ts +28 -19
- package/src/services/PaymentReallocationService.test.ts +2 -1
- package/src/services/PaymentReallocationService.ts +2 -1
- package/src/services/PaymentService.ts +28 -26
- package/src/services/RegistrationService.ts +65 -3
- package/src/services/SSOService.ts +13 -9
- package/src/services/STPackageService.ts +7 -5
- package/src/services/StartupHealthService.ts +15 -0
- package/src/services/uitpas/PassholderEndpoints.ts +2 -2
- package/src/services/uitpas/UitpasService.ts +11 -8
- package/src/services/uitpas/cancelTicketSales.ts +1 -1
- package/src/services/uitpas/checkPermissionsFor.ts +9 -9
- package/src/services/uitpas/getSocialTariffForEvent.ts +4 -4
- package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +5 -5
- package/src/services/uitpas/handleUitpasResponse.ts +1 -1
- package/src/services/uitpas/registerTicketSales.ts +4 -4
- package/src/services/uitpas/searchUitpasEvents.ts +3 -3
- package/src/services/uitpas/searchUitpasOrganizers.ts +3 -3
- package/src/sql-filters/audit-logs.ts +2 -1
- package/src/sql-filters/balance-item-payments.ts +2 -1
- package/src/sql-filters/balance-items.ts +2 -1
- package/src/sql-filters/base-registration-filter-compilers.ts +6 -4
- package/src/sql-filters/document-templates.ts +2 -1
- package/src/sql-filters/documents.ts +2 -1
- package/src/sql-filters/email-recipients.ts +2 -1
- package/src/sql-filters/emails.ts +2 -1
- package/src/sql-filters/event-notifications.ts +2 -1
- package/src/sql-filters/events.ts +2 -1
- package/src/sql-filters/groups.ts +2 -1
- package/src/sql-filters/invoiced-balance-items.ts +2 -1
- package/src/sql-filters/invoices.ts +2 -1
- package/src/sql-filters/member-responsibility-records.ts +2 -1
- package/src/sql-filters/members.ts +8 -7
- package/src/sql-filters/orders.ts +3 -2
- package/src/sql-filters/organization-registration-periods.ts +2 -1
- package/src/sql-filters/organizations.ts +2 -1
- package/src/sql-filters/payments.ts +2 -1
- package/src/sql-filters/platform-memberships.ts +67 -0
- package/src/sql-filters/receivable-balances.ts +2 -1
- package/src/sql-filters/registration-periods.ts +2 -1
- package/src/sql-filters/registrations.ts +2 -1
- package/src/sql-filters/tickets.ts +2 -1
- package/src/sql-filters/users.ts +2 -1
- package/src/sql-filters/webshops.ts +38 -0
- package/src/sql-sorters/audit-logs.ts +3 -2
- package/src/sql-sorters/balance-items.ts +3 -2
- package/src/sql-sorters/document-templates.ts +3 -2
- package/src/sql-sorters/documents.ts +3 -2
- package/src/sql-sorters/email-recipients.ts +3 -2
- package/src/sql-sorters/emails.ts +3 -2
- package/src/sql-sorters/event-notifications.ts +3 -2
- package/src/sql-sorters/events.ts +3 -2
- package/src/sql-sorters/groups.ts +3 -2
- package/src/sql-sorters/invoices.ts +3 -2
- package/src/sql-sorters/members.ts +3 -2
- package/src/sql-sorters/orders.ts +3 -2
- package/src/sql-sorters/organization-registration-periods.ts +3 -2
- package/src/sql-sorters/organizations.ts +3 -2
- package/src/sql-sorters/payments.ts +3 -2
- package/src/sql-sorters/platform-memberships.ts +40 -0
- package/src/sql-sorters/receivable-balances.ts +3 -2
- package/src/sql-sorters/registration-periods.ts +3 -2
- package/src/sql-sorters/registrations.ts +3 -2
- package/src/sql-sorters/tickets.ts +3 -2
- package/src/sql-sorters/webshops.ts +40 -0
- package/tests/actions/patchOrganizationMember.ts +5 -4
- package/tests/actions/patchPaymentStatus.ts +2 -2
- package/tests/actions/patchUserMember.ts +6 -4
- package/tests/e2e/api-rate-limits.test.ts +4 -5
- package/tests/e2e/bundle-discounts.test.ts +3 -2
- package/tests/e2e/charge-members.test.ts +7 -5
- package/tests/e2e/documents.test.ts +3 -2
- package/tests/e2e/private-files.test.ts +11 -13
- package/tests/e2e/register.test.ts +6 -5
- package/tests/e2e/stock.test.ts +6 -8
- package/tests/e2e/tickets.test.ts +4 -2
- package/tests/helpers/StripeMocker.ts +3 -3
- package/tests/init/initAdmin.ts +4 -2
- package/tests/init/initBundleDiscount.ts +3 -2
- package/tests/init/initPayconiq.ts +1 -1
- package/tests/init/initPermissionRole.ts +4 -2
- package/tests/init/initPlatformRecordCategory.ts +1 -1
- package/tests/init/initStripe.ts +1 -1
- package/tests/vitest.global.setup.ts +26 -0
- package/tests/{jest.setup.ts → vitest.setup.ts} +4 -3
- package/tsconfig.build.json +17 -0
- package/tsconfig.json +10 -41
- package/tsconfig.test.json +17 -0
- package/vitest.config.js +13 -0
- package/eslint.config.mjs +0 -5
- package/jest.config.cjs +0 -27
- package/tests/jest.global.setup.ts +0 -33
- package/tests/toMatchMap.ts +0 -68
|
@@ -1,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 { Organization } from '@stamhoofd/models';
|
|
5
6
|
import { SQL, applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
6
|
-
import { CountFilteredRequest,
|
|
7
|
+
import type { CountFilteredRequest, Organization as OrganizationStruct, StamhoofdFilter} from '@stamhoofd/structures';
|
|
8
|
+
import { LimitedFilteredRequest, PaginatedResponse, PermissionLevel, 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 { organizationFilterCompilers } from '../../../sql-filters/organizations.js';
|
|
@@ -129,7 +131,7 @@ export class GetOrganizationsEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
129
131
|
throw new SimpleError({
|
|
130
132
|
code: 'timeout',
|
|
131
133
|
message: 'Query took too long',
|
|
132
|
-
human: $t(`
|
|
134
|
+
human: $t(`%Cv`),
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
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 { Organization, OrganizationRegistrationPeriod, Platform, RegistrationPeriod } from '@stamhoofd/models';
|
|
5
7
|
import { Organization as OrganizationStruct } from '@stamhoofd/structures';
|
|
@@ -43,7 +45,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
43
45
|
|
|
44
46
|
for (const id of request.body.getDeletes()) {
|
|
45
47
|
if (!Context.auth.hasPlatformFullAccess()) {
|
|
46
|
-
throw Context.auth.error($t(`
|
|
48
|
+
throw Context.auth.error($t(`%Cw`));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
const organization = await Organization.getByID(id);
|
|
@@ -55,7 +57,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
55
57
|
throw new SimpleError({
|
|
56
58
|
code: 'cannot_delete_membership_organization',
|
|
57
59
|
message: 'Cannot delete membership organization',
|
|
58
|
-
human: $t(`
|
|
60
|
+
human: $t(`%Cx`),
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -65,7 +67,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
65
67
|
// Organization creation
|
|
66
68
|
for (const { put } of request.body.getPuts()) {
|
|
67
69
|
if (!Context.auth.hasPlatformFullAccess()) {
|
|
68
|
-
throw Context.auth.error($t(`
|
|
70
|
+
throw Context.auth.error($t(`%Cy`));
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
if (put.name.length < 4) {
|
|
@@ -73,7 +75,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
73
75
|
throw new SimpleError({
|
|
74
76
|
code: 'invalid_field',
|
|
75
77
|
message: 'Should not be empty',
|
|
76
|
-
human: $t(`
|
|
78
|
+
human: $t(`%Cz`),
|
|
77
79
|
field: 'organization.name',
|
|
78
80
|
});
|
|
79
81
|
}
|
|
@@ -81,7 +83,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
81
83
|
throw new SimpleError({
|
|
82
84
|
code: 'invalid_field',
|
|
83
85
|
message: 'Field is too short',
|
|
84
|
-
human: $t(`
|
|
86
|
+
human: $t(`%D0`),
|
|
85
87
|
field: 'organization.name',
|
|
86
88
|
});
|
|
87
89
|
}
|
|
@@ -92,7 +94,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
92
94
|
throw new SimpleError({
|
|
93
95
|
code: 'invalid_field',
|
|
94
96
|
message: 'Field is too long',
|
|
95
|
-
human: $t(`
|
|
97
|
+
human: $t(`%D1`),
|
|
96
98
|
field: 'organization.name',
|
|
97
99
|
});
|
|
98
100
|
}
|
|
@@ -102,7 +104,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
102
104
|
throw new SimpleError({
|
|
103
105
|
code: 'name_taken',
|
|
104
106
|
message: 'An organization with the same name already exists',
|
|
105
|
-
human: $t(`
|
|
107
|
+
human: $t(`%D2`),
|
|
106
108
|
field: 'name',
|
|
107
109
|
});
|
|
108
110
|
}
|
|
@@ -113,7 +115,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
113
115
|
throw new SimpleError({
|
|
114
116
|
code: 'name_taken',
|
|
115
117
|
message: 'An organization with the same name already exists',
|
|
116
|
-
human: $t(`
|
|
118
|
+
human: $t(`%D3`),
|
|
117
119
|
field: 'name',
|
|
118
120
|
});
|
|
119
121
|
}
|
|
@@ -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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
5
|
import { ChargeRequest, LimitedFilteredRequest, PermissionLevel } from '@stamhoofd/structures';
|
|
5
6
|
|
|
@@ -49,7 +50,7 @@ export class ChargeRegistrationsEndpoint extends Endpoint<Params, Query, Body, R
|
|
|
49
50
|
throw new SimpleError({
|
|
50
51
|
code: 'charge_pending',
|
|
51
52
|
message: 'Charge registrations already pending',
|
|
52
|
-
human: $t(`
|
|
53
|
+
human: $t(`%Cu`),
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -1,8 +1,10 @@
|
|
|
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 { PasswordToken, Platform, sendEmailTemplate, User } from '@stamhoofd/models';
|
|
5
|
-
import {
|
|
6
|
+
import type { UserWithMembers } from '@stamhoofd/structures';
|
|
7
|
+
import { EmailTemplateType, Recipient, Replacement, UserPermissions, User as UserStruct } from '@stamhoofd/structures';
|
|
6
8
|
import { Formatter } from '@stamhoofd/utility';
|
|
7
9
|
|
|
8
10
|
import { AuthenticatedStructures } from '../../helpers/AuthenticatedStructures.js';
|
|
@@ -59,7 +61,7 @@ export class CreateAdminEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
59
61
|
throw new SimpleError({
|
|
60
62
|
code: 'internal_error',
|
|
61
63
|
message: 'Something went wrong while creating the admin',
|
|
62
|
-
human: $t(`
|
|
64
|
+
human: $t(`%D4`),
|
|
63
65
|
statusCode: 500,
|
|
64
66
|
});
|
|
65
67
|
}
|
|
@@ -101,7 +103,7 @@ export class CreateAdminEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
101
103
|
const platformName = ((await Platform.getSharedStruct()).config.name);
|
|
102
104
|
|
|
103
105
|
const name = organization?.name ?? platformName;
|
|
104
|
-
const what = organization ? $t('
|
|
106
|
+
const what = organization ? $t('%C4', { name, platform: platformName }) : platformName;
|
|
105
107
|
|
|
106
108
|
const emailTo = admin.getEmailTo();
|
|
107
109
|
const email: string = typeof emailTo === 'string' ? emailTo : emailTo[0]?.email;
|
|
@@ -123,7 +125,7 @@ export class CreateAdminEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
123
125
|
}),
|
|
124
126
|
Replacement.create({
|
|
125
127
|
token: 'inviterName',
|
|
126
|
-
value: user.firstName ?? $t(`
|
|
128
|
+
value: user.firstName ?? $t(`%D5`),
|
|
127
129
|
}),
|
|
128
130
|
Replacement.create({
|
|
129
131
|
token: 'validUntil',
|
|
@@ -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 { EmailVerificationCode, PasswordToken, Platform, Token, User } from '@stamhoofd/models';
|
|
4
|
-
import { ChallengeGrantStruct,
|
|
5
|
+
import type { ChallengeGrantStruct, PasswordGrantStruct, PasswordTokenGrantStruct, RefreshTokenGrantStruct, RequestChallengeGrantStruct} from '@stamhoofd/structures';
|
|
6
|
+
import { CreateTokenStruct, LoginMethod, SignupResponse, Token as TokenStruct } from '@stamhoofd/structures';
|
|
5
7
|
|
|
6
8
|
import { Context } from '../../helpers/Context.js';
|
|
7
9
|
|
|
@@ -74,7 +76,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
74
76
|
throw new SimpleError({
|
|
75
77
|
code: 'error',
|
|
76
78
|
message: 'Could not generate token',
|
|
77
|
-
human: $t(`
|
|
79
|
+
human: $t(`%D6`),
|
|
78
80
|
statusCode: 500,
|
|
79
81
|
});
|
|
80
82
|
}
|
|
@@ -91,7 +93,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
91
93
|
throw new SimpleError({
|
|
92
94
|
code: 'not_supported',
|
|
93
95
|
message: 'This platform does not support password login',
|
|
94
|
-
human: $t(`
|
|
96
|
+
human: $t(`%D7`),
|
|
95
97
|
statusCode: 400,
|
|
96
98
|
});
|
|
97
99
|
}
|
|
@@ -100,7 +102,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
100
102
|
throw new SimpleError({
|
|
101
103
|
code: 'not_supported',
|
|
102
104
|
message: 'Login method not supported',
|
|
103
|
-
human: $t(`
|
|
105
|
+
human: $t(`%D8`),
|
|
104
106
|
statusCode: 400,
|
|
105
107
|
});
|
|
106
108
|
}
|
|
@@ -111,7 +113,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
111
113
|
const errBody = {
|
|
112
114
|
code: 'invalid_username_or_password',
|
|
113
115
|
message: 'Invalid username or password',
|
|
114
|
-
human: $t(`
|
|
116
|
+
human: $t(`%D9`),
|
|
115
117
|
statusCode: 400,
|
|
116
118
|
};
|
|
117
119
|
|
|
@@ -130,7 +132,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
130
132
|
throw new SimpleError({
|
|
131
133
|
code: 'verify_email',
|
|
132
134
|
message: 'Your email address needs verification',
|
|
133
|
-
human: $t(`
|
|
135
|
+
human: $t(`%DA`),
|
|
134
136
|
meta: SignupResponse.create({
|
|
135
137
|
token: code.token,
|
|
136
138
|
}).encode({ version: request.request.getVersion() }),
|
|
@@ -144,7 +146,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
144
146
|
throw new SimpleError({
|
|
145
147
|
code: 'error',
|
|
146
148
|
message: 'Could not generate token',
|
|
147
|
-
human: $t(`
|
|
149
|
+
human: $t(`%D6`),
|
|
148
150
|
statusCode: 500,
|
|
149
151
|
});
|
|
150
152
|
}
|
|
@@ -159,7 +161,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
159
161
|
throw new SimpleError({
|
|
160
162
|
code: 'invalid_token',
|
|
161
163
|
message: 'Invalid token',
|
|
162
|
-
human: $t(`
|
|
164
|
+
human: $t(`%DB`),
|
|
163
165
|
statusCode: 400,
|
|
164
166
|
});
|
|
165
167
|
}
|
|
@@ -170,7 +172,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
170
172
|
throw new SimpleError({
|
|
171
173
|
code: 'invalid_token',
|
|
172
174
|
message: 'Invalid token',
|
|
173
|
-
human: $t(`
|
|
175
|
+
human: $t(`%DB`),
|
|
174
176
|
statusCode: 400,
|
|
175
177
|
});
|
|
176
178
|
}
|
|
@@ -180,7 +182,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
180
182
|
throw new SimpleError({
|
|
181
183
|
code: 'invalid_token',
|
|
182
184
|
message: 'Invalid token',
|
|
183
|
-
human: $t(`
|
|
185
|
+
human: $t(`%DB`),
|
|
184
186
|
statusCode: 400,
|
|
185
187
|
});
|
|
186
188
|
}
|
|
@@ -194,7 +196,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
194
196
|
throw new SimpleError({
|
|
195
197
|
code: 'error',
|
|
196
198
|
message: 'Could not generate token',
|
|
197
|
-
human: $t(`
|
|
199
|
+
human: $t(`%DC`),
|
|
198
200
|
statusCode: 500,
|
|
199
201
|
});
|
|
200
202
|
}
|
|
@@ -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
|
|
|
3
4
|
import { Context } from '../../helpers/Context.js';
|
|
4
5
|
|
|
@@ -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
|
|
|
3
4
|
import { getDefaultEmailFrom, sendEmailTemplate } from '@stamhoofd/models';
|
|
4
5
|
import { EmailTemplateType, Recipient } from '@stamhoofd/structures';
|
|
@@ -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 { PasswordToken, Platform, sendEmailTemplate, User } from '@stamhoofd/models';
|
|
4
5
|
import { EmailTemplateType, ForgotPasswordRequest, LoginMethod, Recipient, Replacement } from '@stamhoofd/structures';
|
|
5
6
|
|
|
@@ -37,7 +38,7 @@ export class ForgotPasswordEndpoint extends Endpoint<Params, Query, Body, Respon
|
|
|
37
38
|
throw new SimpleError({
|
|
38
39
|
code: 'not_supported',
|
|
39
40
|
message: 'This platform does not support password login',
|
|
40
|
-
human: $t(`
|
|
41
|
+
human: $t(`%D7`),
|
|
41
42
|
statusCode: 400,
|
|
42
43
|
});
|
|
43
44
|
}
|
|
@@ -46,7 +47,7 @@ export class ForgotPasswordEndpoint extends Endpoint<Params, Query, Body, Respon
|
|
|
46
47
|
throw new SimpleError({
|
|
47
48
|
code: 'not_supported',
|
|
48
49
|
message: 'Login method not supported',
|
|
49
|
-
human: $t(`
|
|
50
|
+
human: $t(`%DD`),
|
|
50
51
|
statusCode: 400,
|
|
51
52
|
});
|
|
52
53
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
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 { UserWithMembers } from '@stamhoofd/structures';
|
|
3
4
|
|
|
4
5
|
import { AuthenticatedStructures } from '../../helpers/AuthenticatedStructures.js';
|
|
5
6
|
import { Context } from '../../helpers/Context.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
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 { UserWithMembers } from '@stamhoofd/structures';
|
|
3
4
|
|
|
4
5
|
import { AuthenticatedStructures } from '../../helpers/AuthenticatedStructures.js';
|
|
5
6
|
import { Context } from '../../helpers/Context.js';
|
|
@@ -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
|
|
|
4
5
|
import { Context } from '../../helpers/Context.js';
|
|
5
6
|
import { SSOService } from '../../services/SSOService.js';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
+
import { AnyDecoder } from '@simonbackx/simple-encoding';
|
|
3
|
+
import type { DecodedRequest, Request } from '@simonbackx/simple-endpoints';
|
|
4
|
+
import { Endpoint } from '@simonbackx/simple-endpoints';
|
|
3
5
|
|
|
4
6
|
import { Context } from '../../helpers/Context.js';
|
|
5
7
|
import { SSOServiceWithSession } from '../../services/SSOService.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 } from '@simonbackx/simple-endpoints';
|
|
3
4
|
import { StartOpenIDFlowStruct } from '@stamhoofd/structures';
|
|
4
5
|
|
|
5
6
|
import { Context } from '../../helpers/Context.js';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { AutoEncoderPatchType, Decoder
|
|
2
|
-
import {
|
|
1
|
+
import type { AutoEncoderPatchType, Decoder} from '@simonbackx/simple-encoding';
|
|
2
|
+
import { isPatch } 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 { EmailVerificationCode, Member, PasswordToken, Platform, Token, User } from '@stamhoofd/models';
|
|
5
|
-
import {
|
|
7
|
+
import type { UserWithMembers } from '@stamhoofd/structures';
|
|
8
|
+
import { LoginMethod, NewUser, PermissionLevel, SignupResponse, UserPermissions } from '@stamhoofd/structures';
|
|
6
9
|
|
|
7
10
|
import { Context } from '../../helpers/Context.js';
|
|
8
11
|
import { MemberUserSyncer } from '../../helpers/MemberUserSyncer.js';
|
|
@@ -44,7 +47,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
44
47
|
const editUser = request.body.id === user.id ? user : await User.getByID(request.body.id);
|
|
45
48
|
|
|
46
49
|
if (!editUser || !await Context.auth.canAccessUser(editUser, PermissionLevel.Write) || editUser.isApiUser) {
|
|
47
|
-
throw Context.auth.notFoundOrNoAccess($t(`
|
|
50
|
+
throw Context.auth.notFoundOrNoAccess($t(`%DE`));
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
if (await Context.auth.canEditUserName(editUser)) {
|
|
@@ -72,7 +75,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
72
75
|
if (!await Context.auth.canAccessUser(editUser, PermissionLevel.Full)) {
|
|
73
76
|
throw new SimpleError({
|
|
74
77
|
code: 'permission_denied',
|
|
75
|
-
message: $t(`
|
|
78
|
+
message: $t(`%DF`),
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
|
|
@@ -83,7 +86,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
83
86
|
if (editUser.id === user.id && (!editUser.permissions || !editUser.permissions.forOrganization(organization)?.hasFullAccess()) && STAMHOOFD.environment !== 'development') {
|
|
84
87
|
throw new SimpleError({
|
|
85
88
|
code: 'permission_denied',
|
|
86
|
-
message: $t(`
|
|
89
|
+
message: $t(`%DG`),
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
92
|
}
|
|
@@ -102,7 +105,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
102
105
|
if (editUser.id === user.id && !editUser.permissions?.platform?.hasFullAccess() && STAMHOOFD.environment !== 'development') {
|
|
103
106
|
throw new SimpleError({
|
|
104
107
|
code: 'permission_denied',
|
|
105
|
-
message: $t(`
|
|
108
|
+
message: $t(`%DG`),
|
|
106
109
|
});
|
|
107
110
|
}
|
|
108
111
|
}
|
|
@@ -124,7 +127,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
124
127
|
throw new SimpleError({
|
|
125
128
|
code: 'invalid_request',
|
|
126
129
|
message: 'You cannot remove the last login provider',
|
|
127
|
-
human: $t(`
|
|
130
|
+
human: $t(`%DH`),
|
|
128
131
|
statusCode: 400,
|
|
129
132
|
});
|
|
130
133
|
}
|
|
@@ -142,7 +145,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
142
145
|
throw new SimpleError({
|
|
143
146
|
code: 'not_supported',
|
|
144
147
|
message: 'This platform does not support password login',
|
|
145
|
-
human: $t(`
|
|
148
|
+
human: $t(`%D7`),
|
|
146
149
|
statusCode: 400,
|
|
147
150
|
});
|
|
148
151
|
}
|
|
@@ -151,7 +154,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
151
154
|
throw new SimpleError({
|
|
152
155
|
code: 'not_supported',
|
|
153
156
|
message: 'Login method not supported',
|
|
154
|
-
human: $t(`
|
|
157
|
+
human: $t(`%DD`),
|
|
155
158
|
statusCode: 400,
|
|
156
159
|
});
|
|
157
160
|
}
|
|
@@ -170,7 +173,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
170
173
|
throw new SimpleError({
|
|
171
174
|
code: 'invalid_request',
|
|
172
175
|
message: 'You cannot remove the last login provider',
|
|
173
|
-
human: $t(`
|
|
176
|
+
human: $t(`%DI`),
|
|
174
177
|
statusCode: 400,
|
|
175
178
|
});
|
|
176
179
|
}
|
|
@@ -192,7 +195,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
192
195
|
throw new SimpleError({
|
|
193
196
|
code: 'verify_email',
|
|
194
197
|
message: 'Your email address needs verification',
|
|
195
|
-
human: editUser.id === user.id ? $t(`
|
|
198
|
+
human: editUser.id === user.id ? $t(`%DJ`) : $t(`%DK`) + ' ' + request.body.email + ' ' + $t(`%DL`),
|
|
196
199
|
meta: SignupResponse.create({
|
|
197
200
|
token: code.token,
|
|
198
201
|
}).encode({ version: request.request.getVersion() }),
|
|
@@ -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 { EmailVerificationCode } from '@stamhoofd/models';
|
|
4
5
|
import { PollEmailVerificationRequest, PollEmailVerificationResponse } from '@stamhoofd/structures';
|
|
5
6
|
|
|
@@ -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 { EmailVerificationCode } from '@stamhoofd/models';
|
|
4
5
|
import { PollEmailVerificationRequest, PollEmailVerificationResponse } from '@stamhoofd/structures';
|
|
5
6
|
|
|
@@ -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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
5
|
import { EmailVerificationCode, PasswordToken, Platform, sendEmailTemplate, User } from '@stamhoofd/models';
|
|
5
6
|
import { EmailTemplateType, LoginMethod, NewUser, Recipient, Replacement, SignupResponse } from '@stamhoofd/structures';
|
|
@@ -36,7 +37,7 @@ export class SignupEndpoint extends Endpoint<Params, Query, Body, ResponseBody>
|
|
|
36
37
|
throw new SimpleError({
|
|
37
38
|
code: 'not_supported',
|
|
38
39
|
message: 'This platform does not support password login',
|
|
39
|
-
human: $t(`
|
|
40
|
+
human: $t(`%D7`),
|
|
40
41
|
statusCode: 400,
|
|
41
42
|
});
|
|
42
43
|
}
|
|
@@ -62,7 +63,7 @@ export class SignupEndpoint extends Endpoint<Params, Query, Body, ResponseBody>
|
|
|
62
63
|
throw new SimpleError({
|
|
63
64
|
code: 'unexpected_error',
|
|
64
65
|
message: 'Something went wrong',
|
|
65
|
-
human: $t(`
|
|
66
|
+
human: $t(`%DM`),
|
|
66
67
|
statusCode: 500,
|
|
67
68
|
});
|
|
68
69
|
}
|
|
@@ -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 { SimpleError } from '@simonbackx/simple-errors';
|
|
4
5
|
import { EmailVerificationCode, Token, User } from '@stamhoofd/models';
|
|
5
6
|
import { Token as TokenStruct, VerifyEmailRequest } from '@stamhoofd/structures';
|
|
@@ -36,7 +37,7 @@ export class VerifyEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
36
37
|
throw new SimpleError({
|
|
37
38
|
code: 'invalid_code',
|
|
38
39
|
message: 'This code is invalid',
|
|
39
|
-
human: $t(`
|
|
40
|
+
human: $t(`%DN`),
|
|
40
41
|
statusCode: 400,
|
|
41
42
|
});
|
|
42
43
|
}
|
|
@@ -47,7 +48,7 @@ export class VerifyEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
47
48
|
throw new SimpleError({
|
|
48
49
|
code: 'invalid_code',
|
|
49
50
|
message: 'This code is invalid',
|
|
50
|
-
human: $t(`
|
|
51
|
+
human: $t(`%DN`),
|
|
51
52
|
statusCode: 400,
|
|
52
53
|
});
|
|
53
54
|
}
|
|
@@ -77,7 +78,7 @@ export class VerifyEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
77
78
|
throw new SimpleError({
|
|
78
79
|
code: 'email_in_use',
|
|
79
80
|
message: 'This e-mail is already in use, we cannot set it',
|
|
80
|
-
human: $t(
|
|
81
|
+
human: $t(`%DO`, { email: code.email, contactEmail: request.$t('%2a') }),
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
throw e;
|
|
@@ -1,8 +1,11 @@
|
|
|
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 { City, Province } from '@stamhoofd/models';
|
|
4
|
-
import { City as CityStruct,
|
|
6
|
+
import { City as CityStruct, Province as ProvinceStruct, SearchRegions } from '@stamhoofd/structures';
|
|
5
7
|
import { StringCompare } from '@stamhoofd/utility';
|
|
8
|
+
import { Country } from '@stamhoofd/types/Country';
|
|
6
9
|
|
|
7
10
|
type Params = Record<string, never>;
|
|
8
11
|
class Query extends AutoEncoder {
|
|
@@ -30,14 +33,14 @@ export class SearchRegionsEndpoint extends Endpoint<Params, Query, Body, Respons
|
|
|
30
33
|
|
|
31
34
|
async handle(request: DecodedRequest<Params, Query, Body>) {
|
|
32
35
|
// Escape query
|
|
33
|
-
const rawQuery = request.query.query.replace(/
|
|
36
|
+
const rawQuery = request.query.query.replace(/[-+><()~*"@\s]+/g, ' ');
|
|
34
37
|
const words = rawQuery.split(' ').filter(w => w.length > 0);
|
|
35
38
|
|
|
36
39
|
// Escape words
|
|
37
40
|
const cleanedWords: string[] = [];
|
|
38
41
|
for (const [index, word] of words.entries()) {
|
|
39
42
|
// If contains special char (non a-zA-Z) - escape with " character
|
|
40
|
-
if (/^[a-
|
|
43
|
+
if (/^[a-z0-9]*$/i.test(word)) {
|
|
41
44
|
if (index === words.length - 1) {
|
|
42
45
|
cleanedWords.push('+' + word + '*');
|
|
43
46
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Decoder } from '@simonbackx/simple-encoding';
|
|
2
|
-
import { DecodedRequest,
|
|
3
|
-
import {
|
|
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 type { ValidatedAddress } from '@stamhoofd/structures';
|
|
5
|
+
import { Address } from '@stamhoofd/structures';
|
|
4
6
|
|
|
5
7
|
import { AddressValidator } from '../../../helpers/AddressValidator.js';
|
|
6
8
|
|
|
@@ -1,9 +1,12 @@
|
|
|
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 { AuditLog } from '@stamhoofd/models';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import type { SQLSortDefinitions} from '@stamhoofd/sql';
|
|
7
|
+
import { SQL, applySQLSorter, compileToSQLFilter } from '@stamhoofd/sql';
|
|
8
|
+
import type { AuditLog as AuditLogStruct, CountFilteredRequest, StamhoofdFilter} from '@stamhoofd/structures';
|
|
9
|
+
import { LimitedFilteredRequest, PaginatedResponse, assertSort, getSortFilter } from '@stamhoofd/structures';
|
|
7
10
|
|
|
8
11
|
import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures.js';
|
|
9
12
|
import { Context } from '../../../helpers/Context.js';
|
|
@@ -81,7 +84,7 @@ export class GetAuditLogsEndpoint extends Endpoint<Params, Query, Body, Response
|
|
|
81
84
|
throw new SimpleError({
|
|
82
85
|
code: 'not_supported',
|
|
83
86
|
message: 'Search is not possible in audit logs',
|
|
84
|
-
human: $t(`
|
|
87
|
+
human: $t(`%DP`),
|
|
85
88
|
});
|
|
86
89
|
}
|
|
87
90
|
|