@stamhoofd/backend 2.115.1 → 2.117.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/migrations.ts +1 -1
- package/package.json +10 -10
- package/src/audit-logs/DocumentTemplateLogger.ts +1 -1
- package/src/audit-logs/EmailAddressLogger.ts +1 -1
- package/src/audit-logs/EmailLogger.ts +1 -1
- package/src/audit-logs/EmailTemplateLogger.ts +1 -1
- package/src/audit-logs/EventLogger.ts +1 -1
- package/src/audit-logs/GroupLogger.ts +1 -1
- package/src/audit-logs/MemberLogger.ts +1 -1
- package/src/audit-logs/MemberPlatformMembershipLogger.ts +1 -1
- package/src/audit-logs/MemberResponsibilityRecordLogger.ts +1 -1
- package/src/audit-logs/ModelLogger.ts +27 -19
- package/src/audit-logs/OrderLogger.ts +1 -1
- package/src/audit-logs/OrganizationLogger.ts +23 -3
- package/src/audit-logs/OrganizationRegistrationPeriodLogger.ts +1 -1
- package/src/audit-logs/PaymentLogger.ts +1 -1
- package/src/audit-logs/PlatformLogger.ts +1 -1
- package/src/audit-logs/RegistrationLogger.ts +1 -1
- package/src/audit-logs/RegistrationPeriodLogger.ts +1 -1
- package/src/audit-logs/StripeAccountLogger.ts +1 -1
- package/src/audit-logs/UserLogger.ts +1 -1
- package/src/audit-logs/WebshopLogger.ts +1 -1
- package/src/audit-logs/init.ts +40 -0
- package/src/boot.ts +6 -4
- package/src/crons/amazon-ses.ts +1 -1
- package/src/crons/balance-emails.ts +1 -1
- package/src/crons/clearExcelCache.test.ts +1 -1
- package/src/crons/delete-archived-data.ts +47 -0
- package/src/crons/endFunctionsOfUsersWithoutRegistration.ts +1 -1
- package/src/crons/index.ts +1 -0
- package/src/crons.ts +3 -3
- package/src/debug.ts +230 -0
- package/src/email-recipient-loaders/documents.ts +1 -1
- package/src/email-recipient-loaders/members.ts +1 -1
- package/src/email-recipient-loaders/orders.ts +3 -3
- package/src/email-recipient-loaders/payments.ts +118 -353
- package/src/email-replacements/getEmailReplacementsForPayment.ts +321 -0
- package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +9 -7
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +2 -2
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +1 -1
- package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +16 -50
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +2 -2
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +4 -4
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +21 -6
- package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +9 -7
- package/src/endpoints/auth/CreateAdminEndpoint.ts +2 -2
- package/src/endpoints/auth/CreateTokenEndpoint.test.ts +2 -2
- package/src/endpoints/auth/CreateTokenEndpoint.ts +1 -1
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +1 -1
- package/src/endpoints/auth/DeleteUserEndpoint.ts +1 -1
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +1 -1
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +2 -2
- package/src/endpoints/auth/GetUserEndpoint.test.ts +2 -2
- package/src/endpoints/auth/GetUserEndpoint.ts +2 -2
- package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +2 -2
- package/src/endpoints/auth/OpenIDConnectCallbackEndpoint.ts +2 -2
- package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +2 -2
- package/src/endpoints/auth/PatchUserEndpoint.ts +4 -4
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +1 -1
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +1 -1
- package/src/endpoints/auth/SignupEndpoint.ts +1 -1
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +1 -1
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +1 -1
- package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +4 -4
- package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +191 -7
- package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +64 -0
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +2 -2
- package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +3 -3
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +1 -1
- package/src/endpoints/global/email/GetEmailEndpoint.ts +1 -1
- package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +2 -2
- package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +3 -3
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +62 -16
- package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +6 -6
- package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +2 -2
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +2 -2
- package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +4 -4
- package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +1 -1
- package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +1 -1
- package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +2 -2
- package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +4 -4
- package/src/endpoints/global/events/GetEventsEndpoint.ts +4 -4
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +2 -2
- package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +3 -3
- package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +2 -2
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +5 -5
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +4 -4
- package/src/endpoints/global/files/GetFileCache.ts +2 -2
- package/src/endpoints/global/files/UploadFile.ts +2 -2
- package/src/endpoints/global/files/UploadImage.ts +1 -1
- package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +3 -3
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +4 -4
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +4 -4
- package/src/endpoints/global/members/GetMembersEndpoint.test.ts +3 -3
- package/src/endpoints/global/members/GetMembersEndpoint.ts +4 -16
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +8 -7
- package/src/endpoints/global/members/helpers/validateGroupFilter.ts +1 -1
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +2 -2
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +23 -12
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.test.ts +2 -2
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +1 -1
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +1 -1
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.test.ts +2 -2
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +1 -1
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +3 -3
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +1 -1
- package/src/endpoints/global/platform/GetPlatformEndpoint.test.ts +2 -2
- package/src/endpoints/global/platform/GetPlatformEndpoint.ts +1 -1
- package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +2 -2
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +7 -7
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +2 -2
- package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +1 -2
- package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +2 -2
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +2 -2
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +2 -2
- package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +2 -2
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +2 -2
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +24 -389
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +3 -3
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +2 -2
- package/src/endpoints/global/sso/GetSSOEndpoint.ts +2 -2
- package/src/endpoints/global/sso/SetSSOEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +55 -0
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +43 -0
- package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +160 -0
- package/src/endpoints/organization/dashboard/{payments → balance-items}/PatchBalanceItemsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.test.ts +3 -3
- package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +1 -1
- package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +37 -6
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +53 -0
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +12 -1
- package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +4 -4
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +4 -4
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +4 -4
- package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +2 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +2 -2
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +3 -3
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.test.ts +3 -3
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.test.ts +3 -3
- package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +5 -5
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +5 -5
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +1 -1
- package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +1 -1
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +3 -3
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +1 -1
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +2 -2
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.test.ts +2 -2
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +2 -2
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +1 -1
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.test.ts +2 -2
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +2 -2
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +4 -4
- package/src/excel-loaders/balance-items.ts +268 -0
- package/src/excel-loaders/event-notifications.ts +3 -3
- package/src/excel-loaders/index.ts +6 -5
- package/src/excel-loaders/organizations.ts +4 -4
- package/src/excel-loaders/payments.ts +11 -3
- package/src/excel-loaders/receivable-balances.ts +2 -2
- package/src/helpers/AddressValidator.test.ts +1 -1
- package/src/helpers/AddressValidator.ts +1 -1
- package/src/helpers/AdminPermissionChecker.ts +20 -17
- package/src/helpers/AuthenticatedStructures.ts +194 -109
- package/src/helpers/Context.ts +2 -0
- package/src/helpers/EmailResumer.ts +1 -1
- package/src/helpers/FlagMomentCleanup.ts +1 -1
- package/src/helpers/ForwardHandler.test.ts +1 -1
- package/src/helpers/ForwardHandler.ts +1 -1
- package/src/helpers/GlobalHelper.ts +4 -4
- package/src/helpers/GroupBuilder.ts +417 -0
- package/src/helpers/GroupedThrottledQueue.test.ts +1 -1
- package/src/helpers/GroupedThrottledQueue.ts +1 -1
- package/src/helpers/MemberUserSyncer.test.ts +1 -1
- package/src/helpers/MemberUserSyncer.ts +1 -1
- package/src/helpers/PeriodHelper.ts +5 -45
- package/src/helpers/ServiceFeeHelper.ts +5 -1
- package/src/helpers/SetupStepUpdater.ts +5 -4
- package/src/helpers/TagHelper.ts +1 -1
- package/src/helpers/ThrottledQueue.test.ts +1 -1
- package/src/helpers/ViesHelper.ts +9 -0
- package/src/helpers/email-html-helpers.ts +0 -41
- package/src/helpers/outstandingBalanceJoin.ts +3 -1
- package/src/middleware/ContextMiddleware.ts +1 -1
- package/src/seeds/1726572303-schedule-stock-updates.ts +1 -1
- package/src/seeds/1726847064-setup-steps.ts +1 -1
- package/src/seeds/1728928974-update-cached-outstanding-balance-from-items.ts +1 -1
- package/src/seeds/1740046783-update-membership.ts +1 -1
- package/src/seeds/1754560914-groups-prices.test.ts +1 -1
- package/src/seeds/1755876819-remove-duplicate-members.ts +1 -1
- package/src/seeds/1760702454-update-cached-outstanding-balance-from-items.ts +1 -1
- package/src/seeds/1761665607-sync-member-users.ts +1 -1
- package/src/seeds/data/default-email-templates.sql +1 -1
- package/src/seeds-temporary/1732117645-move-rrn.ts +1 -1
- package/src/services/AuditLogService.ts +1 -41
- package/src/services/BalanceItemPaymentService.ts +1 -1
- package/src/services/BalanceItemService.ts +12 -5
- package/src/services/EventNotificationService.ts +3 -3
- package/src/services/InvoiceService.ts +131 -17
- package/src/services/MemberRecordStore.ts +1 -1
- package/src/services/PaymentReallocationService.test.ts +9 -10
- package/src/services/PaymentReallocationService.ts +1 -1
- package/src/services/PaymentService.ts +560 -18
- package/src/services/PlatformMembershipService.ts +3 -3
- package/src/services/RegistrationService.ts +3 -3
- package/src/services/SSOService.ts +2 -2
- package/src/services/STPackageService.ts +241 -0
- package/src/services/uitpas/UitpasService.test.ts +1 -1
- package/src/sql-filters/balance-items.ts +56 -0
- package/src/sql-filters/emails.ts +1 -1
- package/src/sql-filters/event-notifications.ts +2 -2
- package/src/sql-filters/events.ts +51 -0
- package/src/sql-filters/members.ts +38 -2
- package/src/sql-filters/receivable-balances.ts +3 -3
- package/src/sql-filters/users.ts +10 -0
- package/src/sql-sorters/balance-items.ts +36 -0
- package/src/sql-sorters/document-templates.ts +2 -2
- package/src/sql-sorters/documents.ts +2 -2
- package/src/sql-sorters/event-notifications.ts +1 -1
- package/src/sql-sorters/members.ts +2 -2
- package/src/sql-sorters/orders.ts +2 -2
- package/src/sql-sorters/tickets.ts +2 -2
- package/tests/actions/patchOrganizationMember.ts +3 -3
- package/tests/actions/patchPaymentStatus.ts +3 -3
- package/tests/actions/patchUserMember.ts +2 -2
- package/tests/assertions/assertBalances.ts +1 -1
- package/tests/e2e/api-rate-limits.test.ts +3 -3
- package/tests/e2e/charge-members.test.ts +14 -14
- package/tests/e2e/documents.test.ts +8 -8
- package/tests/e2e/private-files.test.ts +4 -4
- package/tests/e2e/register.test.ts +10 -10
- package/tests/e2e/stock.test.ts +4 -4
- package/tests/e2e/tickets.test.ts +4 -4
- package/tests/helpers/TestServer.ts +2 -2
- package/tests/init/index.ts +7 -7
- package/tests/init/initAdmin.ts +1 -1
- package/src/endpoints/global/registration/GetPaymentRegistrations.ts +0 -67
|
@@ -12,7 +12,7 @@ export const ticketSorters: SQLSortDefinitions<Ticket> = {
|
|
|
12
12
|
// What if you need mapping? simply map the sorters in the frontend: name -> firstname, lastname, age -> birthDay, etc.
|
|
13
13
|
createdAt: {
|
|
14
14
|
getValue(a) {
|
|
15
|
-
return Formatter.dateTimeIso(a.createdAt);
|
|
15
|
+
return Formatter.dateTimeIso(a.createdAt, 'UTC');
|
|
16
16
|
},
|
|
17
17
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
18
18
|
return new SQLOrderBy({
|
|
@@ -23,7 +23,7 @@ export const ticketSorters: SQLSortDefinitions<Ticket> = {
|
|
|
23
23
|
},
|
|
24
24
|
updatedAt: {
|
|
25
25
|
getValue(a) {
|
|
26
|
-
return Formatter.dateTimeIso(a.updatedAt);
|
|
26
|
+
return Formatter.dateTimeIso(a.updatedAt, 'UTC');
|
|
27
27
|
},
|
|
28
28
|
toSQL: (direction: SQLOrderByDirection): SQLOrderBy => {
|
|
29
29
|
return new SQLOrderBy({
|
|
@@ -2,9 +2,9 @@ import { AutoEncoderPatchType, PatchableArray } from '@simonbackx/simple-encodin
|
|
|
2
2
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { Organization } from '@stamhoofd/models';
|
|
4
4
|
import { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
|
|
5
|
-
import { PatchOrganizationMembersEndpoint } from '../../src/endpoints/global/members/PatchOrganizationMembersEndpoint';
|
|
6
|
-
import { testServer } from '../helpers/TestServer';
|
|
7
|
-
import { initAdmin } from '../init/initAdmin';
|
|
5
|
+
import { PatchOrganizationMembersEndpoint } from '../../src/endpoints/global/members/PatchOrganizationMembersEndpoint.js';
|
|
6
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
7
|
+
import { initAdmin } from '../init/initAdmin.js';
|
|
8
8
|
|
|
9
9
|
export async function patchOrganizationMember({ patch, organization }: { patch: AutoEncoderPatchType<MemberWithRegistrationsBlob>; organization: Organization }) {
|
|
10
10
|
expect(patch.id).toBeString();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PatchableArray } from '@simonbackx/simple-encoding';
|
|
2
2
|
import { PaymentStatus, PaymentGeneral } from '@stamhoofd/structures';
|
|
3
|
-
import { PatchPaymentsEndpoint } from '../../src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint';
|
|
4
|
-
import { testServer } from '../helpers/TestServer';
|
|
3
|
+
import { PatchPaymentsEndpoint } from '../../src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.js';
|
|
4
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
5
5
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
6
6
|
import { Organization } from '@stamhoofd/models';
|
|
7
|
-
import { initAdmin } from '../init/initAdmin';
|
|
7
|
+
import { initAdmin } from '../init/initAdmin.js';
|
|
8
8
|
|
|
9
9
|
export async function changePaymentStatus({ payment, organization, status }: { payment: { id: string }; organization: Organization; status: PaymentStatus }) {
|
|
10
10
|
expect(payment.id).toBeString();
|
|
@@ -2,8 +2,8 @@ import { AutoEncoderPatchType, PatchableArray } from '@simonbackx/simple-encodin
|
|
|
2
2
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
3
3
|
import { Organization, Token, User } from '@stamhoofd/models';
|
|
4
4
|
import { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
|
|
5
|
-
import { PatchUserMembersEndpoint } from '../../src/endpoints/global/registration/PatchUserMembersEndpoint';
|
|
6
|
-
import { testServer } from '../helpers/TestServer';
|
|
5
|
+
import { PatchUserMembersEndpoint } from '../../src/endpoints/global/registration/PatchUserMembersEndpoint.js';
|
|
6
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
7
7
|
|
|
8
8
|
export async function patchUserMember({ patch, organization, user }: { patch: AutoEncoderPatchType<MemberWithRegistrationsBlob>; organization: Organization; user: User }) {
|
|
9
9
|
expect(patch.id).toBeString();
|
|
@@ -5,9 +5,9 @@ import { Organization, OrganizationFactory, Token, UserFactory } from '@stamhoof
|
|
|
5
5
|
import { PatchMap } from '@simonbackx/simple-encoding';
|
|
6
6
|
import { ApiUser, ApiUserRateLimits, PermissionLevel, Permissions, PermissionsResourceType, ResourcePermissions, UserMeta, UserPermissions } from '@stamhoofd/structures';
|
|
7
7
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
8
|
-
import { CreateApiUserEndpoint } from '../../src/endpoints/organization/dashboard/users/CreateApiUserEndpoint';
|
|
9
|
-
import { testServer } from '../helpers/TestServer';
|
|
10
|
-
import { GetUserEndpoint } from '../../src/endpoints/auth/GetUserEndpoint';
|
|
8
|
+
import { CreateApiUserEndpoint } from '../../src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.js';
|
|
9
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
10
|
+
import { GetUserEndpoint } from '../../src/endpoints/auth/GetUserEndpoint.js';
|
|
11
11
|
|
|
12
12
|
describe('E2E.APIRateLimits', () => {
|
|
13
13
|
// Test endpoint
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Request, Response } from '@simonbackx/simple-endpoints';
|
|
2
2
|
import { GroupFactory, MemberFactory, Organization, OrganizationFactory, RegistrationFactory, RegistrationPeriod, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
|
-
import { AccessRight, BalanceItemWithPayments,
|
|
3
|
+
import { AccessRight, BalanceItemWithPayments, ChargeRequest, LimitedFilteredRequest, PermissionLevel, PermissionRoleDetailed, Permissions, PermissionsResourceType, ResourcePermissions, StamhoofdFilter, Version } from '@stamhoofd/structures';
|
|
4
4
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
5
|
-
import { ChargeMembersEndpoint } from '../../src/endpoints/admin/members/ChargeMembersEndpoint';
|
|
6
|
-
import { testServer } from '../helpers/TestServer';
|
|
7
|
-
import { GetReceivableBalanceEndpoint } from '../../src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint';
|
|
5
|
+
import { ChargeMembersEndpoint } from '../../src/endpoints/admin/members/ChargeMembersEndpoint.js';
|
|
6
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
7
|
+
import { GetReceivableBalanceEndpoint } from '../../src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.js';
|
|
8
8
|
|
|
9
9
|
describe('E2E.ChargeMembers', () => {
|
|
10
10
|
const chargeMembersEndpoint = new ChargeMembersEndpoint();
|
|
@@ -16,7 +16,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
16
16
|
let financialDirectorRole: PermissionRoleDetailed;
|
|
17
17
|
let financialDirectorRoleOfOtherOrganization: PermissionRoleDetailed;
|
|
18
18
|
|
|
19
|
-
const postCharge = async (filter: StamhoofdFilter, organization: Organization, body:
|
|
19
|
+
const postCharge = async (filter: StamhoofdFilter, organization: Organization, body: ChargeRequest, token: Token) => {
|
|
20
20
|
const request = Request.buildJson('POST', `/v${Version}/admin/charge-members`, organization.getApiHost(), body);
|
|
21
21
|
const filterRequest = new LimitedFilteredRequest({
|
|
22
22
|
filter,
|
|
@@ -105,7 +105,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
105
105
|
},
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
const body =
|
|
108
|
+
const body = ChargeRequest.create({
|
|
109
109
|
description: 'test description',
|
|
110
110
|
price: 3,
|
|
111
111
|
amount: 4,
|
|
@@ -169,7 +169,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
169
169
|
},
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
const body =
|
|
172
|
+
const body = ChargeRequest.create({
|
|
173
173
|
description: 'test description',
|
|
174
174
|
price: 3,
|
|
175
175
|
amount: 4,
|
|
@@ -233,7 +233,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
233
233
|
|
|
234
234
|
const otherFinancialDirectorToken = await Token.createToken(otherFinancialDirector);
|
|
235
235
|
|
|
236
|
-
const body =
|
|
236
|
+
const body = ChargeRequest.create({
|
|
237
237
|
description: 'test description',
|
|
238
238
|
price: 3,
|
|
239
239
|
amount: 4,
|
|
@@ -270,9 +270,9 @@ describe('E2E.ChargeMembers', () => {
|
|
|
270
270
|
},
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
-
const testCases: [body:
|
|
273
|
+
const testCases: [body: ChargeRequest, expectedErrorMessage: string][] = [
|
|
274
274
|
// empty description
|
|
275
|
-
[
|
|
275
|
+
[ChargeRequest.create({
|
|
276
276
|
description: ' ',
|
|
277
277
|
price: 3,
|
|
278
278
|
amount: 4,
|
|
@@ -281,7 +281,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
281
281
|
}), 'Invalid description'],
|
|
282
282
|
|
|
283
283
|
// price 0
|
|
284
|
-
[
|
|
284
|
+
[ChargeRequest.create({
|
|
285
285
|
description: 'test description',
|
|
286
286
|
price: 0,
|
|
287
287
|
amount: 4,
|
|
@@ -290,7 +290,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
290
290
|
}), 'Invalid price'],
|
|
291
291
|
|
|
292
292
|
// amount 0
|
|
293
|
-
[
|
|
293
|
+
[ChargeRequest.create({
|
|
294
294
|
description: 'test description',
|
|
295
295
|
price: 3,
|
|
296
296
|
amount: 0,
|
|
@@ -348,7 +348,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
348
348
|
},
|
|
349
349
|
};
|
|
350
350
|
|
|
351
|
-
const body =
|
|
351
|
+
const body = ChargeRequest.create({
|
|
352
352
|
description: 'test description',
|
|
353
353
|
price: 3,
|
|
354
354
|
amount: 4,
|
|
@@ -417,7 +417,7 @@ describe('E2E.ChargeMembers', () => {
|
|
|
417
417
|
},
|
|
418
418
|
};
|
|
419
419
|
|
|
420
|
-
const body =
|
|
420
|
+
const body = ChargeRequest.create({
|
|
421
421
|
description: 'test description',
|
|
422
422
|
price: 3,
|
|
423
423
|
amount: 4,
|
|
@@ -3,14 +3,14 @@ import { Document, DocumentTemplateFactory, Group, GroupFactory, Member, MemberF
|
|
|
3
3
|
import { IDRegisterCart, IDRegisterCheckout, IDRegisterItem, MemberDetails, MemberWithRegistrationsBlob, PaymentMethod } from '@stamhoofd/structures';
|
|
4
4
|
import { TestUtils } from '@stamhoofd/test-utils';
|
|
5
5
|
import { Formatter } from '@stamhoofd/utility';
|
|
6
|
-
import { RegisterMembersEndpoint } from '../../src/endpoints/global/registration/RegisterMembersEndpoint';
|
|
7
|
-
import { patchOrganizationMember } from '../actions/patchOrganizationMember';
|
|
8
|
-
import { markNotPaid, markPaid } from '../actions/patchPaymentStatus';
|
|
9
|
-
import { patchUserMember } from '../actions/patchUserMember';
|
|
10
|
-
import { testServer } from '../helpers/TestServer';
|
|
11
|
-
import { initAdmin } from '../init/initAdmin';
|
|
12
|
-
import { initStripe } from '../init/initStripe';
|
|
13
|
-
import { registrationUpdateQueue } from '../../src/services/BalanceItemService';
|
|
6
|
+
import { RegisterMembersEndpoint } from '../../src/endpoints/global/registration/RegisterMembersEndpoint.js';
|
|
7
|
+
import { patchOrganizationMember } from '../actions/patchOrganizationMember.js';
|
|
8
|
+
import { markNotPaid, markPaid } from '../actions/patchPaymentStatus.js';
|
|
9
|
+
import { patchUserMember } from '../actions/patchUserMember.js';
|
|
10
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
11
|
+
import { initAdmin } from '../init/initAdmin.js';
|
|
12
|
+
import { initStripe } from '../init/initStripe.js';
|
|
13
|
+
import { registrationUpdateQueue } from '../../src/services/BalanceItemService.js';
|
|
14
14
|
|
|
15
15
|
const baseUrl = `/members/register`;
|
|
16
16
|
|
|
@@ -4,10 +4,10 @@ import { PatchableArray, PatchableArrayAutoEncoder } from '@simonbackx/simple-en
|
|
|
4
4
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
5
5
|
import { Member, OrganizationFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
6
6
|
import { PermissionLevel, Permissions } from '@stamhoofd/structures';
|
|
7
|
-
import { PatchUserMembersEndpoint } from '../../src/endpoints/global/registration/PatchUserMembersEndpoint';
|
|
8
|
-
import { testServer } from '../helpers/TestServer';
|
|
9
|
-
import { GetUserMembersEndpoint } from '../../src/endpoints/global/registration/GetUserMembersEndpoint';
|
|
10
|
-
import { FileSignService } from '../../src/services/FileSignService';
|
|
7
|
+
import { PatchUserMembersEndpoint } from '../../src/endpoints/global/registration/PatchUserMembersEndpoint.js';
|
|
8
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
9
|
+
import { GetUserMembersEndpoint } from '../../src/endpoints/global/registration/GetUserMembersEndpoint.js';
|
|
10
|
+
import { FileSignService } from '../../src/services/FileSignService.js';
|
|
11
11
|
|
|
12
12
|
const baseUrl = `/v${Version}/members`;
|
|
13
13
|
const endpoint = new PatchUserMembersEndpoint();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Request } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import { BalanceItemFactory, GroupFactory, MemberFactory,
|
|
2
|
+
import { BalanceItemFactory, GroupFactory, MemberFactory, MemberWithUsersRegistrationsAndGroups, Organization, OrganizationFactory, OrganizationRegistrationPeriod, Platform, RegistrationPeriod, RegistrationPeriodFactory, Token, UserFactory } from '@stamhoofd/models';
|
|
3
3
|
import { AdministrationFeeSettings, BalanceItemCartItem, BalanceItemRelation, BalanceItemRelationType, BalanceItemStatus, BalanceItemType, BooleanStatus, DefaultAgeGroup, FreeContributionSettings, GroupOption, GroupOptionMenu, IDRegisterCart, IDRegisterCheckout, IDRegisterItem, PaymentMethod, PermissionLevel, Permissions, PlatformMembershipType, PlatformMembershipTypeConfig, ReceivableBalanceType, ReduceablePrice, RegisterItemOption, TranslatedString, Version } from '@stamhoofd/structures';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
-
import { GetMemberFamilyEndpoint } from '../../src/endpoints/global/members/GetMemberFamilyEndpoint';
|
|
6
|
-
import { RegisterMembersEndpoint } from '../../src/endpoints/global/registration/RegisterMembersEndpoint';
|
|
7
|
-
import { GetMemberBalanceEndpoint } from '../../src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint';
|
|
8
|
-
import { GetReceivableBalanceEndpoint } from '../../src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint';
|
|
9
|
-
import { PlatformMembershipService } from '../../src/services/PlatformMembershipService';
|
|
10
|
-
import { testServer } from '../helpers/TestServer';
|
|
5
|
+
import { GetMemberFamilyEndpoint } from '../../src/endpoints/global/members/GetMemberFamilyEndpoint.js';
|
|
6
|
+
import { RegisterMembersEndpoint } from '../../src/endpoints/global/registration/RegisterMembersEndpoint.js';
|
|
7
|
+
import { GetMemberBalanceEndpoint } from '../../src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.js';
|
|
8
|
+
import { GetReceivableBalanceEndpoint } from '../../src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.js';
|
|
9
|
+
import { PlatformMembershipService } from '../../src/services/PlatformMembershipService.js';
|
|
10
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
11
11
|
import { TestUtils } from '@stamhoofd/test-utils';
|
|
12
|
-
import { BalanceItemService } from '../../src/services/BalanceItemService';
|
|
13
|
-
import { assertBalances } from '../assertions/assertBalances';
|
|
12
|
+
import { BalanceItemService } from '../../src/services/BalanceItemService.js';
|
|
13
|
+
import { assertBalances } from '../assertions/assertBalances.js';
|
|
14
14
|
|
|
15
15
|
describe('E2E.Register', () => {
|
|
16
16
|
const registerEndpoint = new RegisterMembersEndpoint();
|
|
@@ -78,7 +78,7 @@ describe('E2E.Register', () => {
|
|
|
78
78
|
|
|
79
79
|
const member = await new MemberFactory({ organization, user }).create();
|
|
80
80
|
|
|
81
|
-
const otherMembers:
|
|
81
|
+
const otherMembers: MemberWithUsersRegistrationsAndGroups[] = [];
|
|
82
82
|
|
|
83
83
|
for (let i = 0; i < otherMemberAmount; i++) {
|
|
84
84
|
otherMembers.push(await new MemberFactory({ organization, user }).create());
|
package/tests/e2e/stock.test.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { Order, Organization, OrganizationFactory, StripeAccount, Token, UserFac
|
|
|
7
7
|
import { Address, Cart, CartItem, CartItemOption, CartReservedSeat, Country, Customer, Option, OptionMenu, OrderData, OrderStatus, PaymentConfiguration, PaymentMethod, PermissionLevel, Permissions, PrivateOrder, PrivatePaymentConfiguration, Product, ProductPrice, ProductType, ReservedSeat, SeatingPlan, SeatingPlanRow, SeatingPlanSeat, SeatingPlanSection, TransferSettings, ValidatedAddress, WebshopDeliveryMethod, WebshopMetaData, WebshopOnSiteMethod, WebshopPrivateMetaData, WebshopTakeoutMethod, WebshopTimeSlot } from '@stamhoofd/structures';
|
|
8
8
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
9
|
|
|
10
|
-
import { PatchWebshopOrdersEndpoint } from '../../src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint';
|
|
11
|
-
import { PlaceOrderEndpoint } from '../../src/endpoints/organization/webshops/PlaceOrderEndpoint';
|
|
12
|
-
import { StripeMocker } from '../helpers/StripeMocker';
|
|
13
|
-
import { testServer } from '../helpers/TestServer';
|
|
10
|
+
import { PatchWebshopOrdersEndpoint } from '../../src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.js';
|
|
11
|
+
import { PlaceOrderEndpoint } from '../../src/endpoints/organization/webshops/PlaceOrderEndpoint.js';
|
|
12
|
+
import { StripeMocker } from '../helpers/StripeMocker.js';
|
|
13
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
14
14
|
|
|
15
15
|
const address = Address.create({
|
|
16
16
|
street: 'Demostraat',
|
|
@@ -3,10 +3,10 @@ import { Request } from '@simonbackx/simple-endpoints';
|
|
|
3
3
|
import { Organization, OrganizationFactory, StripeAccount, Ticket, Token, UserFactory, Webshop, WebshopFactory } from '@stamhoofd/models';
|
|
4
4
|
import { Cart, CartItem, CartReservedSeat, Customer, OrderData, OrderStatus, PaymentConfiguration, PaymentMethod, PermissionLevel, Permissions, PrivateOrder, PrivatePaymentConfiguration, Product, ProductType, SeatingPlan, SeatingPlanRow, SeatingPlanSeat, SeatingPlanSection, TransferSettings, WebshopMetaData, WebshopPrivateMetaData, WebshopTicketType } from '@stamhoofd/structures';
|
|
5
5
|
|
|
6
|
-
import { PatchWebshopOrdersEndpoint } from '../../src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint';
|
|
7
|
-
import { PlaceOrderEndpoint } from '../../src/endpoints/organization/webshops/PlaceOrderEndpoint';
|
|
8
|
-
import { StripeMocker } from '../helpers/StripeMocker';
|
|
9
|
-
import { testServer } from '../helpers/TestServer';
|
|
6
|
+
import { PatchWebshopOrdersEndpoint } from '../../src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.js';
|
|
7
|
+
import { PlaceOrderEndpoint } from '../../src/endpoints/organization/webshops/PlaceOrderEndpoint.js';
|
|
8
|
+
import { StripeMocker } from '../helpers/StripeMocker.js';
|
|
9
|
+
import { testServer } from '../helpers/TestServer.js';
|
|
10
10
|
|
|
11
11
|
const customer = Customer.create({
|
|
12
12
|
firstName: 'John',
|
|
@@ -2,8 +2,8 @@ import { TestServer } from '@simonbackx/simple-endpoints';
|
|
|
2
2
|
import { VersionMiddleware } from '@stamhoofd/backend-middleware';
|
|
3
3
|
import { Version } from '@stamhoofd/structures';
|
|
4
4
|
|
|
5
|
-
import { ContextMiddleware } from '../../src/middleware/ContextMiddleware';
|
|
6
|
-
import { FileSignService } from '../../src/services/FileSignService';
|
|
5
|
+
import { ContextMiddleware } from '../../src/middleware/ContextMiddleware.js';
|
|
6
|
+
import { FileSignService } from '../../src/services/FileSignService.js';
|
|
7
7
|
|
|
8
8
|
export const testServer = new TestServer();
|
|
9
9
|
|
package/tests/init/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './initAdmin';
|
|
2
|
-
export * from './initPlatformAdmin';
|
|
3
|
-
export * from './initPayconiq';
|
|
4
|
-
export * from './initBundleDiscount';
|
|
5
|
-
export * from './initStripe';
|
|
6
|
-
export * from './initPermissionRole';
|
|
7
|
-
export * from './initUitpasApi';
|
|
1
|
+
export * from './initAdmin.js';
|
|
2
|
+
export * from './initPlatformAdmin.js';
|
|
3
|
+
export * from './initPayconiq.js';
|
|
4
|
+
export * from './initBundleDiscount.js';
|
|
5
|
+
export * from './initStripe.js';
|
|
6
|
+
export * from './initPermissionRole.js';
|
|
7
|
+
export * from './initUitpasApi.js';
|
package/tests/init/initAdmin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Organization, Token, UserFactory } from '@stamhoofd/models';
|
|
2
2
|
import { AccessRight, PermissionLevel, PermissionRole, Permissions } from '@stamhoofd/structures';
|
|
3
|
-
import { initPermissionRole } from './initPermissionRole';
|
|
3
|
+
import { initPermissionRole } from './initPermissionRole.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* You cannot assign access rights directy to a user, but it can be done using roles. So when setting accessRights, a role wil be created and assigned to the user.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
|
|
2
|
-
import { SimpleError } from '@simonbackx/simple-errors';
|
|
3
|
-
import { Group, Member, Payment, Registration } from '@stamhoofd/models';
|
|
4
|
-
import { PaymentWithRegistrations } from '@stamhoofd/structures';
|
|
5
|
-
import { Formatter } from '@stamhoofd/utility';
|
|
6
|
-
|
|
7
|
-
import { Context } from '../../../helpers/Context';
|
|
8
|
-
type Params = { id: string };
|
|
9
|
-
type Query = undefined;
|
|
10
|
-
type Body = undefined;
|
|
11
|
-
type ResponseBody = PaymentWithRegistrations | undefined;
|
|
12
|
-
|
|
13
|
-
export class GetPaymentRegistrations extends Endpoint<Params, Query, Body, ResponseBody> {
|
|
14
|
-
protected doesMatch(request: Request): [true, Params] | [false] {
|
|
15
|
-
if (request.method !== 'GET') {
|
|
16
|
-
return [false];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const params = Endpoint.parseParameters(request.url, '/payments/@id/registrations', { id: String });
|
|
20
|
-
|
|
21
|
-
if (params) {
|
|
22
|
-
return [true, params as Params];
|
|
23
|
-
}
|
|
24
|
-
return [false];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async handle(request: DecodedRequest<Params, Query, Body>) {
|
|
28
|
-
await Context.setUserOrganizationScope();
|
|
29
|
-
const { user } = await Context.authenticate();
|
|
30
|
-
|
|
31
|
-
const payment = await Payment.getByID(request.params.id);
|
|
32
|
-
if (!payment) {
|
|
33
|
-
throw new SimpleError({
|
|
34
|
-
code: '',
|
|
35
|
-
message: $t(`35b369bd-5766-41d1-8da3-3d362e316c1a`),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
const registrations = await Member.getRegistrationWithMembersForPayment(payment.id);
|
|
39
|
-
const authorizedMembers = (await Member.getMembersWithRegistrationForUser(user)).map(m => m.id);
|
|
40
|
-
const groups = await Group.getByIDs(...Formatter.uniqueArray(registrations.map(r => r.groupId)));
|
|
41
|
-
|
|
42
|
-
// Check permissions
|
|
43
|
-
for (const registration of registrations) {
|
|
44
|
-
if (!authorizedMembers.includes(registration.member.id)) {
|
|
45
|
-
throw new SimpleError({
|
|
46
|
-
code: '',
|
|
47
|
-
message: $t(`35b369bd-5766-41d1-8da3-3d362e316c1a`),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return new Response(
|
|
53
|
-
PaymentWithRegistrations.create({
|
|
54
|
-
id: payment.id,
|
|
55
|
-
method: payment.method,
|
|
56
|
-
status: payment.status,
|
|
57
|
-
price: payment.price,
|
|
58
|
-
freeContribution: payment.freeContribution,
|
|
59
|
-
transferDescription: payment.transferDescription,
|
|
60
|
-
paidAt: payment.paidAt,
|
|
61
|
-
createdAt: payment.createdAt,
|
|
62
|
-
updatedAt: payment.updatedAt,
|
|
63
|
-
registrations: registrations.map(r => Member.getRegistrationWithTinyMemberStructure(r.setRelation(Registration.group, groups.find(g => g.id === r.groupId)!))),
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|