@stamhoofd/backend 2.39.1 → 2.40.1
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/eslint.config.mjs +5 -0
- package/index.ts +81 -74
- package/jest.config.cjs +10 -0
- package/migrations.ts +16 -14
- package/package.json +11 -11
- package/src/crons/clear-excel-cache.test.ts +48 -50
- package/src/crons/clear-excel-cache.ts +18 -18
- package/src/crons/setup-steps.ts +2 -2
- package/src/crons.ts +325 -306
- package/src/decoders/StringArrayDecoder.ts +7 -7
- package/src/decoders/StringNullableDecoder.ts +1 -2
- package/src/email-recipient-loaders/members.ts +22 -22
- package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +8 -9
- package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +39 -40
- package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +8 -8
- package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +44 -45
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +58 -57
- package/src/endpoints/auth/CreateAdminEndpoint.ts +48 -45
- package/src/endpoints/auth/CreateTokenEndpoint.test.ts +31 -31
- package/src/endpoints/auth/CreateTokenEndpoint.ts +146 -147
- package/src/endpoints/auth/DeleteTokenEndpoint.ts +7 -7
- package/src/endpoints/auth/DeleteUserEndpoint.ts +15 -15
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +17 -18
- package/src/endpoints/auth/GetOtherUserEndpoint.ts +9 -10
- package/src/endpoints/auth/GetUserEndpoint.test.ts +32 -35
- package/src/endpoints/auth/GetUserEndpoint.ts +5 -6
- package/src/endpoints/auth/PatchApiUserEndpoint.ts +35 -33
- package/src/endpoints/auth/PatchUserEndpoint.ts +55 -52
- package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +9 -9
- package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +8 -8
- package/src/endpoints/auth/SignupEndpoint.ts +37 -36
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +29 -28
- package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +33 -33
- package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +7 -7
- package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +37 -37
- package/src/endpoints/global/email/CreateEmailEndpoint.ts +30 -30
- package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +13 -13
- package/src/endpoints/global/email/GetEmailEndpoint.ts +13 -13
- package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +16 -16
- package/src/endpoints/global/email/PatchEmailEndpoint.ts +25 -25
- package/src/endpoints/global/events/GetEventsEndpoint.ts +43 -44
- package/src/endpoints/global/events/PatchEventsEndpoint.ts +127 -172
- package/src/endpoints/global/files/ExportToExcelEndpoint.ts +49 -50
- package/src/endpoints/global/files/GetFileCache.ts +13 -13
- package/src/endpoints/global/files/UploadFile.ts +51 -54
- package/src/endpoints/global/files/UploadImage.ts +53 -53
- package/src/endpoints/global/groups/GetGroupsEndpoint.ts +25 -25
- package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +24 -23
- package/src/endpoints/global/members/GetMembersCountEndpoint.ts +8 -8
- package/src/endpoints/global/members/GetMembersEndpoint.ts +105 -102
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +240 -239
- package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +12 -14
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +32 -33
- package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +48 -57
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.test.ts +21 -22
- package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +28 -28
- package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +18 -18
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.test.ts +20 -20
- package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +17 -17
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +81 -75
- package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +14 -14
- package/src/endpoints/global/platform/GetPlatformEnpoint.ts +11 -11
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +71 -68
- package/src/endpoints/global/registration/GetPaymentRegistrations.ts +27 -27
- package/src/endpoints/global/registration/GetUserBillingStatusEndpoint.ts +30 -30
- package/src/endpoints/global/registration/GetUserDetailedBillingStatusEndpoint.ts +34 -34
- package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +26 -26
- package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +12 -12
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +90 -90
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +118 -121
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +362 -350
- package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -9
- package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +21 -21
- package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +65 -65
- package/src/endpoints/organization/dashboard/billing/GetOrganizationBillingStatusEndpoint.ts +9 -9
- package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedBillingStatusEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +17 -17
- package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +21 -21
- package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +15 -15
- package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +52 -52
- package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplateEndpoint.ts +37 -37
- package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/email/EmailEndpoint.ts +113 -112
- package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +29 -29
- package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +48 -47
- package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +22 -21
- package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +13 -14
- package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +12 -13
- package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +24 -24
- package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +10 -12
- package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +14 -14
- package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +13 -13
- package/src/endpoints/organization/dashboard/organization/GetOrganizationSSOEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +120 -124
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +172 -173
- package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +88 -89
- package/src/endpoints/organization/dashboard/organization/SetOrganizationSSOEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +17 -17
- package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +8 -8
- package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +66 -67
- package/src/endpoints/organization/dashboard/payments/PatchBalanceItemsEndpoint.ts +47 -47
- package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +93 -91
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +16 -17
- package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +170 -167
- package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +25 -24
- package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +22 -23
- package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +22 -22
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +17 -18
- package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +8 -9
- package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +17 -18
- package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +14 -15
- package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +19 -19
- package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +19 -19
- package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +12 -12
- package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +103 -100
- package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +11 -12
- package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +15 -15
- package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +14 -14
- package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +23 -23
- package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +54 -52
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +84 -81
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +120 -111
- package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +24 -24
- package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +18 -18
- package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +141 -130
- package/src/endpoints/organization/shared/GetDocumentHtml.ts +25 -25
- package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +18 -18
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.test.ts +36 -37
- package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +9 -9
- package/src/endpoints/organization/shared/auth/OpenIDConnectCallbackEndpoint.ts +11 -11
- package/src/endpoints/organization/shared/auth/OpenIDConnectStartEndpoint.ts +28 -27
- package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +20 -20
- package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +22 -22
- package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +14 -14
- package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +57 -56
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.test.ts +65 -66
- package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +18 -17
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +124 -128
- package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +154 -145
- package/src/excel-loaders/members.ts +275 -273
- package/src/excel-loaders/payments.ts +155 -156
- package/src/helpers/AddressValidator.test.ts +32 -32
- package/src/helpers/AddressValidator.ts +128 -122
- package/src/helpers/AdminPermissionChecker.ts +339 -236
- package/src/helpers/AuthenticatedStructures.ts +233 -134
- package/src/helpers/BuckarooHelper.ts +134 -134
- package/src/helpers/CheckSettlements.ts +94 -88
- package/src/helpers/Context.ts +87 -86
- package/src/helpers/CookieHelper.ts +23 -22
- package/src/helpers/EmailResumer.ts +10 -10
- package/src/helpers/FileCache.ts +62 -62
- package/src/helpers/ForwardHandler.test.ts +122 -124
- package/src/helpers/ForwardHandler.ts +76 -70
- package/src/helpers/MemberUserSyncer.ts +101 -96
- package/src/helpers/MembershipCharger.ts +69 -69
- package/src/helpers/MembershipHelper.ts +11 -12
- package/src/helpers/OpenIDConnectHelper.ts +85 -82
- package/src/helpers/PeriodHelper.ts +65 -70
- package/src/helpers/StripeHelper.ts +146 -137
- package/src/helpers/StripePayoutChecker.ts +51 -52
- package/src/helpers/ViesHelper.ts +46 -44
- package/src/helpers/fetchToAsyncIterator.ts +14 -14
- package/src/helpers/xlsxAddressTransformerColumnFactory.ts +58 -60
- package/src/middleware/ContextMiddleware.ts +5 -5
- package/src/migrations/1646578856-validate-addresses.ts +6 -9
- package/src/seeds/0000000000-example.ts +3 -5
- package/src/seeds/1715028563-user-permissions.ts +16 -18
- package/src/seeds/1722256498-group-update-occupancy.ts +12 -12
- package/src/seeds/1722344162-sync-member-users.ts +14 -15
- package/src/seeds/1722344162-update-membership.ts +6 -6
- package/src/seeds/1726055544-balance-item-paid.ts +4 -4
- package/src/seeds/1726055545-balance-item-pending.ts +4 -4
- package/src/seeds/1726494419-update-cached-outstanding-balance.ts +16 -16
- package/src/seeds/1726494420-update-cached-outstanding-balance-from-items.ts +12 -12
- package/src/seeds/1726572303-schedule-stock-updates.ts +12 -12
- package/src/seeds/1726847064-setup-steps.ts +16 -0
- package/src/sql-filters/balance-item-payments.ts +7 -7
- package/src/sql-filters/events.ts +14 -14
- package/src/sql-filters/members.ts +96 -96
- package/src/sql-filters/organizations.ts +139 -75
- package/src/sql-filters/payments.ts +28 -28
- package/src/sql-filters/registrations.ts +14 -14
- package/src/sql-sorters/events.ts +25 -25
- package/src/sql-sorters/members.ts +26 -26
- package/src/sql-sorters/organizations.ts +36 -36
- package/src/sql-sorters/payments.ts +26 -26
- package/tests/e2e/stock.test.ts +616 -621
- package/tests/e2e/tickets.test.ts +255 -260
- package/tests/helpers/StripeMocker.ts +177 -179
- package/tests/helpers/TestServer.ts +9 -9
- package/tests/jest.global.setup.ts +14 -13
- package/tests/jest.setup.ts +33 -32
- package/.eslintrc.js +0 -61
- package/jest.config.js +0 -11
- package/src/helpers/SetupStepsUpdater.ts +0 -359
- package/src/seeds/1724076679-setup-steps.ts +0 -16
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { XlsxTransformerColumn } from
|
|
2
|
-
import { Address, CountryHelper, MemberWithRegistrationsBlob, Parent, ParentTypeHelper } from
|
|
1
|
+
import { XlsxTransformerColumn } from '@stamhoofd/excel-writer';
|
|
2
|
+
import { Address, CountryHelper, MemberWithRegistrationsBlob, Parent, ParentTypeHelper, PlatformMember } from '@stamhoofd/structures';
|
|
3
3
|
|
|
4
4
|
export class XlsxTransformerColumnHelper {
|
|
5
5
|
static formatBoolean(value: boolean | undefined | null): string {
|
|
6
|
-
if(value === true) {
|
|
7
|
-
return
|
|
6
|
+
if (value === true) {
|
|
7
|
+
return 'Ja';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
if(value === false) {
|
|
11
|
-
return 'Nee'
|
|
10
|
+
if (value === false) {
|
|
11
|
+
return 'Nee';
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return '';
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static creatColumnsForParents(): XlsxTransformerColumn<
|
|
17
|
+
static creatColumnsForParents(): XlsxTransformerColumn<PlatformMember>[] {
|
|
18
18
|
return [
|
|
19
19
|
...this.createColumnsForParent(0),
|
|
20
20
|
...this.createColumnsForParent(1),
|
|
21
|
-
]
|
|
21
|
+
];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
static createColumnsForAddresses<T>({limit, getAddresses, matchIdStart, identifier}: {limit: number
|
|
24
|
+
static createColumnsForAddresses<T>({ limit, getAddresses, matchIdStart, identifier }: { limit: number; getAddresses: (object: T) => Address[]; matchIdStart: string; identifier: string }): XlsxTransformerColumn<T>[] {
|
|
25
25
|
const result: XlsxTransformerColumn<unknown>[] = [];
|
|
26
26
|
|
|
27
|
-
for(let i = 0; i <= limit; i++) {
|
|
27
|
+
for (let i = 0; i <= limit; i++) {
|
|
28
28
|
const column = this.createAddressColumns({
|
|
29
29
|
matchId: `${matchIdStart}.${i}`,
|
|
30
30
|
getAddress: (object: T) => getAddresses(object)[i],
|
|
@@ -37,79 +37,79 @@ export class XlsxTransformerColumnHelper {
|
|
|
37
37
|
return result;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
static createColumnsForParent(parentIndex: number): XlsxTransformerColumn<
|
|
41
|
-
const getParent = (member:
|
|
40
|
+
static createColumnsForParent(parentIndex: number): XlsxTransformerColumn<PlatformMember>[] {
|
|
41
|
+
const getParent = (member: PlatformMember): Parent | null | undefined => member.patchedMember.details.parents[parentIndex];
|
|
42
42
|
|
|
43
43
|
const parentNumber = parentIndex + 1;
|
|
44
44
|
|
|
45
|
-
const identifier = `Ouder ${parentNumber}
|
|
45
|
+
const identifier = `Ouder ${parentNumber}`;
|
|
46
46
|
const getId = (value: string) => `parent.${parentIndex}.${value}`;
|
|
47
|
-
const getName = (value: string) => `${identifier} - ${value}
|
|
47
|
+
const getName = (value: string) => `${identifier} - ${value}`;
|
|
48
48
|
|
|
49
49
|
return [
|
|
50
50
|
{
|
|
51
51
|
id: getId('type'),
|
|
52
52
|
name: getName('Type'),
|
|
53
53
|
width: 20,
|
|
54
|
-
getValue: (member:
|
|
54
|
+
getValue: (member: PlatformMember) => {
|
|
55
55
|
const parent = getParent(member);
|
|
56
56
|
|
|
57
57
|
return {
|
|
58
|
-
value: parent ? ParentTypeHelper.getName(parent.type) : ''
|
|
59
|
-
}
|
|
60
|
-
}
|
|
58
|
+
value: parent ? ParentTypeHelper.getName(parent.type) : '',
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
id: getId('firstName'),
|
|
64
64
|
name: getName('Voornaam'),
|
|
65
65
|
width: 20,
|
|
66
|
-
getValue: (member:
|
|
67
|
-
value: getParent(member)?.firstName ?? ''
|
|
68
|
-
})
|
|
66
|
+
getValue: (member: PlatformMember) => ({
|
|
67
|
+
value: getParent(member)?.firstName ?? '',
|
|
68
|
+
}),
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
id: getId('lastName'),
|
|
72
72
|
name: getName('Achternaam'),
|
|
73
73
|
width: 20,
|
|
74
|
-
getValue: (member:
|
|
75
|
-
value: getParent(member)?.lastName ?? ''
|
|
76
|
-
})
|
|
74
|
+
getValue: (member: PlatformMember) => ({
|
|
75
|
+
value: getParent(member)?.lastName ?? '',
|
|
76
|
+
}),
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
id: getId('phone'),
|
|
80
80
|
name: getName('Telefoonnummer'),
|
|
81
81
|
width: 20,
|
|
82
|
-
getValue: (member:
|
|
83
|
-
value: getParent(member)?.phone ?? ''
|
|
84
|
-
})
|
|
82
|
+
getValue: (member: PlatformMember) => ({
|
|
83
|
+
value: getParent(member)?.phone ?? '',
|
|
84
|
+
}),
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
id: getId('email'),
|
|
88
88
|
name: getName('E-mailadres'),
|
|
89
89
|
width: 20,
|
|
90
|
-
getValue: (member:
|
|
91
|
-
value: getParent(member)?.email ?? ''
|
|
92
|
-
})
|
|
90
|
+
getValue: (member: PlatformMember) => ({
|
|
91
|
+
value: getParent(member)?.email ?? '',
|
|
92
|
+
}),
|
|
93
93
|
},
|
|
94
|
-
XlsxTransformerColumnHelper.createAddressColumns<
|
|
94
|
+
XlsxTransformerColumnHelper.createAddressColumns<PlatformMember>({
|
|
95
95
|
matchId: getId('address'),
|
|
96
|
-
getAddress:
|
|
97
|
-
identifier: getName('Adres')
|
|
96
|
+
getAddress: member => getParent(member)?.address,
|
|
97
|
+
identifier: getName('Adres'),
|
|
98
98
|
}),
|
|
99
|
-
]
|
|
99
|
+
];
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
static createAddressColumns<T>({matchId, identifier, getAddress}
|
|
102
|
+
static createAddressColumns<T>({ matchId, identifier, getAddress }: { matchId: string; identifier?: string; getAddress: (object: T) => Address | null | undefined }): XlsxTransformerColumn<T> {
|
|
103
103
|
const getId = (value: string) => matchId + '.' + value;
|
|
104
104
|
const identifierText = identifier ? `${identifier} - ` : '';
|
|
105
105
|
const getName = (value: string) => {
|
|
106
|
-
const name
|
|
106
|
+
const name = `${identifierText}${value}`;
|
|
107
107
|
return name[0].toUpperCase() + name.slice(1);
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
return {
|
|
111
111
|
match: (id) => {
|
|
112
|
-
if(id === matchId) {
|
|
112
|
+
if (id === matchId) {
|
|
113
113
|
return [
|
|
114
114
|
{
|
|
115
115
|
id: getId('street'),
|
|
@@ -118,9 +118,9 @@ export class XlsxTransformerColumnHelper {
|
|
|
118
118
|
getValue: (object: T) => {
|
|
119
119
|
const address = getAddress(object);
|
|
120
120
|
return {
|
|
121
|
-
value: address?.street || ''
|
|
122
|
-
}
|
|
123
|
-
}
|
|
121
|
+
value: address?.street || '',
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
id: getId('number'),
|
|
@@ -129,9 +129,9 @@ export class XlsxTransformerColumnHelper {
|
|
|
129
129
|
getValue: (object: T) => {
|
|
130
130
|
const address = getAddress(object);
|
|
131
131
|
return {
|
|
132
|
-
value: address?.number || ''
|
|
133
|
-
}
|
|
134
|
-
}
|
|
132
|
+
value: address?.number || '',
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
id: getId('postalCode'),
|
|
@@ -140,9 +140,9 @@ export class XlsxTransformerColumnHelper {
|
|
|
140
140
|
getValue: (object: T) => {
|
|
141
141
|
const address = getAddress(object);
|
|
142
142
|
return {
|
|
143
|
-
value: address?.postalCode || ''
|
|
144
|
-
}
|
|
145
|
-
}
|
|
143
|
+
value: address?.postalCode || '',
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
id: getId('city'),
|
|
@@ -151,9 +151,9 @@ export class XlsxTransformerColumnHelper {
|
|
|
151
151
|
getValue: (object: T) => {
|
|
152
152
|
const address = getAddress(object);
|
|
153
153
|
return {
|
|
154
|
-
value: address?.city || ''
|
|
155
|
-
}
|
|
156
|
-
}
|
|
154
|
+
value: address?.city || '',
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
id: getId('country'),
|
|
@@ -163,15 +163,13 @@ export class XlsxTransformerColumnHelper {
|
|
|
163
163
|
const address = getAddress(object);
|
|
164
164
|
const country = address?.country;
|
|
165
165
|
return {
|
|
166
|
-
value: country ? CountryHelper.getName(country) : ''
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
]
|
|
166
|
+
value: country ? CountryHelper.getName(country) : '',
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
177
175
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Request, RequestMiddleware } from
|
|
1
|
+
import { Request, RequestMiddleware } from '@simonbackx/simple-endpoints';
|
|
2
2
|
|
|
3
|
-
import { ContextInstance } from
|
|
3
|
+
import { ContextInstance } from '../helpers/Context';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* This attaches a context to each request for authentication and authorization
|
|
7
7
|
*/
|
|
8
8
|
export const ContextMiddleware: RequestMiddleware = {
|
|
9
9
|
wrapRun<T>(run: () => Promise<T>, request: Request) {
|
|
10
|
-
return ContextInstance.start(request, run)
|
|
10
|
+
return ContextInstance.start(request, run);
|
|
11
11
|
},
|
|
12
12
|
|
|
13
13
|
handleRequest: function (request: Request) {
|
|
14
14
|
// Noop
|
|
15
|
-
}
|
|
16
|
-
}
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { Migration } from '@simonbackx/simple-database';
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
export default new Migration(async () => {
|
|
5
|
-
if (STAMHOOFD.environment ==
|
|
6
|
-
console.log(
|
|
4
|
+
if (STAMHOOFD.environment == 'test') {
|
|
5
|
+
console.log('skipped in tests');
|
|
7
6
|
return;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
return Promise.resolve()
|
|
9
|
+
return Promise.resolve();
|
|
11
10
|
|
|
12
|
-
/*let lastId = ""
|
|
11
|
+
/* let lastId = ""
|
|
13
12
|
|
|
14
13
|
while(true) {
|
|
15
14
|
const members = await Member.where({
|
|
@@ -37,7 +36,7 @@ export default new Migration(async () => {
|
|
|
37
36
|
const validatedAddress = await AddressValidator.validate(address)
|
|
38
37
|
const s = address.toString()
|
|
39
38
|
const e = validatedAddress.toString()
|
|
40
|
-
if (s
|
|
39
|
+
if (s !== e) {
|
|
41
40
|
if (StringCompare.typoCount(address.street, validatedAddress.street) > 4) {
|
|
42
41
|
console.log("Updated street: " + s + " => " + e)
|
|
43
42
|
}
|
|
@@ -54,7 +53,5 @@ export default new Migration(async () => {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
throw new Error("WIP")*/
|
|
56
|
+
throw new Error("WIP") */
|
|
58
57
|
});
|
|
59
|
-
|
|
60
|
-
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Migration } from '@simonbackx/simple-database';
|
|
2
2
|
|
|
3
3
|
export default new Migration(async () => {
|
|
4
|
-
if (STAMHOOFD.environment ==
|
|
5
|
-
console.log(
|
|
4
|
+
if (STAMHOOFD.environment == 'test') {
|
|
5
|
+
console.log('skipped in tests');
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// Do something here
|
|
10
|
-
return Promise.resolve()
|
|
10
|
+
return Promise.resolve();
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
|
|
@@ -3,39 +3,39 @@ import { User } from '@stamhoofd/models';
|
|
|
3
3
|
import { UserPermissions } from '@stamhoofd/structures';
|
|
4
4
|
|
|
5
5
|
export default new Migration(async () => {
|
|
6
|
-
if (STAMHOOFD.environment ==
|
|
7
|
-
console.log(
|
|
6
|
+
if (STAMHOOFD.environment == 'test') {
|
|
7
|
+
console.log('skipped in tests');
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
process.stdout.write('\n');
|
|
11
11
|
let c = 0;
|
|
12
|
-
while(true) {
|
|
12
|
+
while (true) {
|
|
13
13
|
const admins = await User.where({
|
|
14
14
|
organizationPermissions: {
|
|
15
15
|
value: null,
|
|
16
|
-
sign: '!='
|
|
16
|
+
sign: '!=',
|
|
17
17
|
},
|
|
18
18
|
organizationId: {
|
|
19
19
|
value: null,
|
|
20
|
-
sign: '!='
|
|
21
|
-
}
|
|
22
|
-
}, {limit: 100})
|
|
20
|
+
sign: '!=',
|
|
21
|
+
},
|
|
22
|
+
}, { limit: 100 });
|
|
23
23
|
|
|
24
24
|
for (const admin of admins) {
|
|
25
25
|
if (!admin.organizationPermissions || !admin.organizationId) {
|
|
26
|
-
continue
|
|
26
|
+
continue;
|
|
27
27
|
}
|
|
28
|
-
const p = UserPermissions.create({})
|
|
29
|
-
p.organizationPermissions.set(admin.organizationId, admin.organizationPermissions)
|
|
30
|
-
admin.permissions = UserPermissions.limitedAdd(admin.permissions, p, admin.organizationId)
|
|
31
|
-
admin.organizationPermissions = null
|
|
32
|
-
await admin.save()
|
|
28
|
+
const p = UserPermissions.create({});
|
|
29
|
+
p.organizationPermissions.set(admin.organizationId, admin.organizationPermissions);
|
|
30
|
+
admin.permissions = UserPermissions.limitedAdd(admin.permissions, p, admin.organizationId);
|
|
31
|
+
admin.organizationPermissions = null;
|
|
32
|
+
await admin.save();
|
|
33
33
|
c++;
|
|
34
34
|
|
|
35
|
-
if (c%1000 === 0) {
|
|
35
|
+
if (c % 1000 === 0) {
|
|
36
36
|
process.stdout.write('.');
|
|
37
37
|
}
|
|
38
|
-
if (c%10000 === 0) {
|
|
38
|
+
if (c % 10000 === 0) {
|
|
39
39
|
process.stdout.write('\n');
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -46,7 +46,5 @@ export default new Migration(async () => {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Do something here
|
|
49
|
-
return Promise.resolve()
|
|
49
|
+
return Promise.resolve();
|
|
50
50
|
});
|
|
51
|
-
|
|
52
|
-
|
|
@@ -2,13 +2,13 @@ import { Migration } from '@simonbackx/simple-database';
|
|
|
2
2
|
import { Group } from '@stamhoofd/models';
|
|
3
3
|
|
|
4
4
|
export default new Migration(async () => {
|
|
5
|
-
if (STAMHOOFD.environment ==
|
|
6
|
-
console.log(
|
|
5
|
+
if (STAMHOOFD.environment == 'test') {
|
|
6
|
+
console.log('skipped in tests');
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
if(STAMHOOFD.userMode !==
|
|
11
|
-
console.log(
|
|
10
|
+
if (STAMHOOFD.userMode !== 'platform') {
|
|
11
|
+
console.log('skipped seed group-update-occupancy because usermode not platform');
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,13 +16,13 @@ export default new Migration(async () => {
|
|
|
16
16
|
let c = 0;
|
|
17
17
|
let id: string = '';
|
|
18
18
|
|
|
19
|
-
while(true) {
|
|
19
|
+
while (true) {
|
|
20
20
|
const rawGroups = await Group.where({
|
|
21
21
|
id: {
|
|
22
22
|
value: id,
|
|
23
|
-
sign: '>'
|
|
24
|
-
}
|
|
25
|
-
}, {limit: 100, sort: ['id']});
|
|
23
|
+
sign: '>',
|
|
24
|
+
},
|
|
25
|
+
}, { limit: 100, sort: ['id'] });
|
|
26
26
|
|
|
27
27
|
const groups = await Group.getByIDs(...rawGroups.map(g => g.id));
|
|
28
28
|
|
|
@@ -32,10 +32,10 @@ export default new Migration(async () => {
|
|
|
32
32
|
|
|
33
33
|
c++;
|
|
34
34
|
|
|
35
|
-
if (c%1000 === 0) {
|
|
35
|
+
if (c % 1000 === 0) {
|
|
36
36
|
process.stdout.write('.');
|
|
37
37
|
}
|
|
38
|
-
if (c%10000 === 0) {
|
|
38
|
+
if (c % 10000 === 0) {
|
|
39
39
|
process.stdout.write('\n');
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -48,5 +48,5 @@ export default new Migration(async () => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// Do something here
|
|
51
|
-
return Promise.resolve()
|
|
52
|
-
})
|
|
51
|
+
return Promise.resolve();
|
|
52
|
+
});
|
|
@@ -4,13 +4,13 @@ import { MemberUserSyncer } from '../helpers/MemberUserSyncer';
|
|
|
4
4
|
import { logger } from '@simonbackx/simple-logging';
|
|
5
5
|
|
|
6
6
|
export default new Migration(async () => {
|
|
7
|
-
if (STAMHOOFD.environment ==
|
|
8
|
-
console.log(
|
|
7
|
+
if (STAMHOOFD.environment == 'test') {
|
|
8
|
+
console.log('skipped in tests');
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
if(STAMHOOFD.userMode !==
|
|
13
|
-
console.log(
|
|
12
|
+
if (STAMHOOFD.userMode !== 'platform') {
|
|
13
|
+
console.log('skipped seed update-membership because usermode not platform');
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -18,14 +18,14 @@ export default new Migration(async () => {
|
|
|
18
18
|
let c = 0;
|
|
19
19
|
let id: string = '';
|
|
20
20
|
|
|
21
|
-
await logger.setContext({tags: ['silent-seed', 'seed']}, async () => {
|
|
22
|
-
while(true) {
|
|
21
|
+
await logger.setContext({ tags: ['silent-seed', 'seed'] }, async () => {
|
|
22
|
+
while (true) {
|
|
23
23
|
const rawMembers = await Member.where({
|
|
24
24
|
id: {
|
|
25
25
|
value: id,
|
|
26
|
-
sign: '>'
|
|
27
|
-
}
|
|
28
|
-
}, {limit: 500, sort: ['id']});
|
|
26
|
+
sign: '>',
|
|
27
|
+
},
|
|
28
|
+
}, { limit: 500, sort: ['id'] });
|
|
29
29
|
|
|
30
30
|
if (rawMembers.length === 0) {
|
|
31
31
|
break;
|
|
@@ -40,10 +40,10 @@ export default new Migration(async () => {
|
|
|
40
40
|
await MemberUserSyncer.onChangeMember(memberWithRegistrations);
|
|
41
41
|
c++;
|
|
42
42
|
|
|
43
|
-
if (c%1000 === 0) {
|
|
43
|
+
if (c % 1000 === 0) {
|
|
44
44
|
process.stdout.write('.');
|
|
45
45
|
}
|
|
46
|
-
if (c%10000 === 0) {
|
|
46
|
+
if (c % 10000 === 0) {
|
|
47
47
|
process.stdout.write('\n');
|
|
48
48
|
}
|
|
49
49
|
})());
|
|
@@ -52,9 +52,8 @@ export default new Migration(async () => {
|
|
|
52
52
|
await Promise.all(promises);
|
|
53
53
|
id = rawMembers[rawMembers.length - 1].id;
|
|
54
54
|
}
|
|
55
|
-
})
|
|
56
|
-
|
|
55
|
+
});
|
|
57
56
|
|
|
58
57
|
// Do something here
|
|
59
|
-
return Promise.resolve()
|
|
60
|
-
})
|
|
58
|
+
return Promise.resolve();
|
|
59
|
+
});
|
|
@@ -2,16 +2,16 @@ import { Migration } from '@simonbackx/simple-database';
|
|
|
2
2
|
import { MembershipHelper } from '../helpers/MembershipHelper';
|
|
3
3
|
|
|
4
4
|
export default new Migration(async () => {
|
|
5
|
-
if (STAMHOOFD.environment ==
|
|
6
|
-
console.log(
|
|
5
|
+
if (STAMHOOFD.environment == 'test') {
|
|
6
|
+
console.log('skipped in tests');
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
if(STAMHOOFD.userMode !==
|
|
11
|
-
console.log(
|
|
10
|
+
if (STAMHOOFD.userMode !== 'platform') {
|
|
11
|
+
console.log('skipped seed update-membership because usermode not platform');
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
process.stdout.write('\n');
|
|
16
|
-
await MembershipHelper.updateAll()
|
|
17
|
-
})
|
|
16
|
+
await MembershipHelper.updateAll();
|
|
17
|
+
});
|
|
@@ -2,10 +2,10 @@ import { Migration } from '@simonbackx/simple-database';
|
|
|
2
2
|
import { BalanceItem } from '@stamhoofd/models';
|
|
3
3
|
|
|
4
4
|
export default new Migration(async () => {
|
|
5
|
-
if (STAMHOOFD.environment ==
|
|
6
|
-
console.log(
|
|
5
|
+
if (STAMHOOFD.environment == 'test') {
|
|
6
|
+
console.log('skipped in tests');
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
await BalanceItem.updatePricePaid('all')
|
|
11
|
-
})
|
|
10
|
+
await BalanceItem.updatePricePaid('all');
|
|
11
|
+
});
|
|
@@ -2,10 +2,10 @@ import { Migration } from '@simonbackx/simple-database';
|
|
|
2
2
|
import { BalanceItem } from '@stamhoofd/models';
|
|
3
3
|
|
|
4
4
|
export default new Migration(async () => {
|
|
5
|
-
if (STAMHOOFD.environment ==
|
|
6
|
-
console.log(
|
|
5
|
+
if (STAMHOOFD.environment == 'test') {
|
|
6
|
+
console.log('skipped in tests');
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
await BalanceItem.updatePricePending('all')
|
|
11
|
-
})
|
|
10
|
+
await BalanceItem.updatePricePending('all');
|
|
11
|
+
});
|
|
@@ -3,8 +3,8 @@ import { logger } from '@simonbackx/simple-logging';
|
|
|
3
3
|
import { BalanceItem, BalanceItemPayment, Payment } from '@stamhoofd/models';
|
|
4
4
|
|
|
5
5
|
export default new Migration(async () => {
|
|
6
|
-
if (STAMHOOFD.environment ==
|
|
7
|
-
console.log(
|
|
6
|
+
if (STAMHOOFD.environment == 'test') {
|
|
7
|
+
console.log('skipped in tests');
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -12,29 +12,29 @@ export default new Migration(async () => {
|
|
|
12
12
|
let c = 0;
|
|
13
13
|
let id: string = '';
|
|
14
14
|
|
|
15
|
-
await logger.setContext({tags: ['silent-seed', 'seed']}, async () => {
|
|
16
|
-
while(true) {
|
|
15
|
+
await logger.setContext({ tags: ['silent-seed', 'seed'] }, async () => {
|
|
16
|
+
while (true) {
|
|
17
17
|
const payments = await Payment.where({
|
|
18
18
|
id: {
|
|
19
19
|
value: id,
|
|
20
|
-
sign: '>'
|
|
21
|
-
}
|
|
22
|
-
}, {limit: 100, sort: ['id']});
|
|
20
|
+
sign: '>',
|
|
21
|
+
},
|
|
22
|
+
}, { limit: 100, sort: ['id'] });
|
|
23
23
|
|
|
24
24
|
for (const payment of payments) {
|
|
25
|
-
const unloaded = (await BalanceItemPayment.where({paymentId: payment.id})).map(r => r.setRelation(BalanceItemPayment.payment, payment))
|
|
25
|
+
const unloaded = (await BalanceItemPayment.where({ paymentId: payment.id })).map(r => r.setRelation(BalanceItemPayment.payment, payment));
|
|
26
26
|
const balanceItemPayments = await BalanceItemPayment.balanceItem.load(
|
|
27
|
-
unloaded
|
|
27
|
+
unloaded,
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
await BalanceItem.updateOutstanding(balanceItemPayments.map(p => p.balanceItem))
|
|
30
|
+
await BalanceItem.updateOutstanding(balanceItemPayments.map(p => p.balanceItem));
|
|
31
31
|
|
|
32
32
|
c++;
|
|
33
33
|
|
|
34
|
-
if (c%100 === 0) {
|
|
34
|
+
if (c % 100 === 0) {
|
|
35
35
|
process.stdout.write('.');
|
|
36
36
|
}
|
|
37
|
-
if (c%10000 === 0) {
|
|
37
|
+
if (c % 10000 === 0) {
|
|
38
38
|
process.stdout.write('\n');
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -44,10 +44,10 @@ export default new Migration(async () => {
|
|
|
44
44
|
}
|
|
45
45
|
id = payments[payments.length - 1].id;
|
|
46
46
|
}
|
|
47
|
-
})
|
|
47
|
+
});
|
|
48
48
|
|
|
49
|
-
console.log(
|
|
49
|
+
console.log('Updated outstanding balance for ' + c + ' payments');
|
|
50
50
|
|
|
51
51
|
// Do something here
|
|
52
|
-
return Promise.resolve()
|
|
53
|
-
})
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
});
|
|
@@ -3,8 +3,8 @@ import { logger } from '@simonbackx/simple-logging';
|
|
|
3
3
|
import { BalanceItem } from '@stamhoofd/models';
|
|
4
4
|
|
|
5
5
|
export default new Migration(async () => {
|
|
6
|
-
if (STAMHOOFD.environment ==
|
|
7
|
-
console.log(
|
|
6
|
+
if (STAMHOOFD.environment == 'test') {
|
|
7
|
+
console.log('skipped in tests');
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -12,16 +12,16 @@ export default new Migration(async () => {
|
|
|
12
12
|
let c = 0;
|
|
13
13
|
let id: string = '';
|
|
14
14
|
|
|
15
|
-
await logger.setContext({tags: ['silent-seed', 'seed']}, async () => {
|
|
16
|
-
while(true) {
|
|
15
|
+
await logger.setContext({ tags: ['silent-seed', 'seed'] }, async () => {
|
|
16
|
+
while (true) {
|
|
17
17
|
const items = await BalanceItem.where({
|
|
18
18
|
id: {
|
|
19
19
|
value: id,
|
|
20
|
-
sign: '>'
|
|
21
|
-
}
|
|
22
|
-
}, {limit: 1000, sort: ['id']});
|
|
20
|
+
sign: '>',
|
|
21
|
+
},
|
|
22
|
+
}, { limit: 1000, sort: ['id'] });
|
|
23
23
|
|
|
24
|
-
await BalanceItem.updateOutstanding(items)
|
|
24
|
+
await BalanceItem.updateOutstanding(items);
|
|
25
25
|
|
|
26
26
|
c += items.length;
|
|
27
27
|
process.stdout.write('.');
|
|
@@ -31,10 +31,10 @@ export default new Migration(async () => {
|
|
|
31
31
|
}
|
|
32
32
|
id = items[items.length - 1].id;
|
|
33
33
|
}
|
|
34
|
-
})
|
|
34
|
+
});
|
|
35
35
|
|
|
36
|
-
console.log(
|
|
36
|
+
console.log('Updated outstanding balance for ' + c + ' items');
|
|
37
37
|
|
|
38
38
|
// Do something here
|
|
39
|
-
return Promise.resolve()
|
|
40
|
-
})
|
|
39
|
+
return Promise.resolve();
|
|
40
|
+
});
|