@stamhoofd/backend 2.39.1 → 2.40.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/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 +102 -103
- 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 +50 -52
- 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,23 +1,23 @@
|
|
|
1
|
-
import { XlsxBuiltInNumberFormat } from
|
|
2
|
-
import { Platform } from
|
|
3
|
-
import { ExcelExportType, Gender, GroupType, LimitedFilteredRequest, MemberWithRegistrationsBlob, PlatformFamily, PlatformMember, UnencodeablePaginatedResponse, Platform as PlatformStruct } from
|
|
4
|
-
import { ExportToExcelEndpoint } from
|
|
5
|
-
import { GetMembersEndpoint } from
|
|
6
|
-
import { Context } from
|
|
7
|
-
import { XlsxTransformerColumnHelper } from
|
|
8
|
-
import { Formatter } from
|
|
9
|
-
import { AuthenticatedStructures } from
|
|
1
|
+
import { XlsxBuiltInNumberFormat } from '@stamhoofd/excel-writer';
|
|
2
|
+
import { Platform } from '@stamhoofd/models';
|
|
3
|
+
import { ExcelExportType, Gender, GroupType, LimitedFilteredRequest, MemberWithRegistrationsBlob, PlatformFamily, PlatformMember, UnencodeablePaginatedResponse, Platform as PlatformStruct } from '@stamhoofd/structures';
|
|
4
|
+
import { ExportToExcelEndpoint } from '../endpoints/global/files/ExportToExcelEndpoint';
|
|
5
|
+
import { GetMembersEndpoint } from '../endpoints/global/members/GetMembersEndpoint';
|
|
6
|
+
import { Context } from '../helpers/Context';
|
|
7
|
+
import { XlsxTransformerColumnHelper } from '../helpers/xlsxAddressTransformerColumnFactory';
|
|
8
|
+
import { Formatter } from '@stamhoofd/utility';
|
|
9
|
+
import { AuthenticatedStructures } from '../helpers/AuthenticatedStructures';
|
|
10
10
|
|
|
11
11
|
ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
12
12
|
fetch: async (query: LimitedFilteredRequest) => {
|
|
13
|
-
const result = await GetMembersEndpoint.buildData(query)
|
|
13
|
+
const result = await GetMembersEndpoint.buildData(query);
|
|
14
14
|
|
|
15
15
|
return new UnencodeablePaginatedResponse({
|
|
16
16
|
results: PlatformFamily.createSingles(result.results, {
|
|
17
17
|
contextOrganization: Context.organization ? (await AuthenticatedStructures.organization(Context.organization)) : null,
|
|
18
|
-
platform: await Platform.getSharedStruct()
|
|
18
|
+
platform: await Platform.getSharedStruct(),
|
|
19
19
|
}),
|
|
20
|
-
next: result.next
|
|
20
|
+
next: result.next,
|
|
21
21
|
});
|
|
22
22
|
},
|
|
23
23
|
sheets: [
|
|
@@ -29,135 +29,135 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
|
29
29
|
id: 'id',
|
|
30
30
|
name: 'ID',
|
|
31
31
|
width: 20,
|
|
32
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
33
|
-
value: object.id
|
|
34
|
-
})
|
|
32
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
33
|
+
value: object.id,
|
|
34
|
+
}),
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
id: 'memberNumber',
|
|
38
38
|
name: 'Nummer',
|
|
39
39
|
width: 20,
|
|
40
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
41
|
-
value: object.details.memberNumber
|
|
42
|
-
})
|
|
40
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
41
|
+
value: object.details.memberNumber,
|
|
42
|
+
}),
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
id: 'firstName',
|
|
46
46
|
name: 'Voornaam',
|
|
47
47
|
width: 20,
|
|
48
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
49
|
-
value: object.details.firstName
|
|
50
|
-
})
|
|
48
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
49
|
+
value: object.details.firstName,
|
|
50
|
+
}),
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
id: 'lastName',
|
|
54
54
|
name: 'Achternaam',
|
|
55
55
|
width: 20,
|
|
56
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
57
|
-
value: object.details.lastName
|
|
58
|
-
})
|
|
56
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
57
|
+
value: object.details.lastName,
|
|
58
|
+
}),
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
id: 'birthDay',
|
|
62
62
|
name: 'Geboortedatum',
|
|
63
63
|
width: 20,
|
|
64
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
64
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
65
65
|
value: object.details.birthDay,
|
|
66
66
|
style: {
|
|
67
67
|
numberFormat: {
|
|
68
|
-
id: XlsxBuiltInNumberFormat.DateSlash
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})
|
|
68
|
+
id: XlsxBuiltInNumberFormat.DateSlash,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
id: 'age',
|
|
75
75
|
name: 'Leeftijd',
|
|
76
76
|
width: 20,
|
|
77
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
77
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
78
78
|
value: object.details.age,
|
|
79
|
-
})
|
|
79
|
+
}),
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
id: 'gender',
|
|
83
83
|
name: 'Geslacht',
|
|
84
84
|
width: 20,
|
|
85
|
-
getValue: ({patchedMember: object}: PlatformMember) => {
|
|
85
|
+
getValue: ({ patchedMember: object }: PlatformMember) => {
|
|
86
86
|
const gender = object.details.gender;
|
|
87
87
|
|
|
88
88
|
return ({
|
|
89
|
-
value: formatGender(gender)
|
|
90
|
-
})
|
|
91
|
-
}
|
|
89
|
+
value: formatGender(gender),
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
id: 'phone',
|
|
95
95
|
name: 'Telefoonnummer',
|
|
96
96
|
width: 20,
|
|
97
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
97
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
98
98
|
value: object.details.phone,
|
|
99
|
-
})
|
|
99
|
+
}),
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
id: 'email',
|
|
103
103
|
name: 'E-mailadres',
|
|
104
104
|
width: 20,
|
|
105
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
105
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
106
106
|
value: object.details.email,
|
|
107
|
-
})
|
|
107
|
+
}),
|
|
108
108
|
},
|
|
109
109
|
XlsxTransformerColumnHelper.createAddressColumns<PlatformMember>({
|
|
110
110
|
matchId: 'address',
|
|
111
111
|
identifier: 'Adres',
|
|
112
|
-
getAddress: ({patchedMember: object}: PlatformMember) => {
|
|
112
|
+
getAddress: ({ patchedMember: object }: PlatformMember) => {
|
|
113
113
|
// get member address if exists
|
|
114
114
|
const memberAddress = object.details.address;
|
|
115
|
-
if(memberAddress) {
|
|
115
|
+
if (memberAddress) {
|
|
116
116
|
return memberAddress;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// else get address of first parent with address
|
|
120
|
-
for(const parent of object.details.parents) {
|
|
121
|
-
if(parent.address) {
|
|
120
|
+
for (const parent of object.details.parents) {
|
|
121
|
+
if (parent.address) {
|
|
122
122
|
return parent.address;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
return null;
|
|
127
|
-
}
|
|
127
|
+
},
|
|
128
128
|
}),
|
|
129
129
|
{
|
|
130
130
|
id: 'securityCode',
|
|
131
131
|
name: 'Beveiligingscode',
|
|
132
132
|
width: 20,
|
|
133
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
133
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
134
134
|
value: object.details.securityCode,
|
|
135
|
-
})
|
|
135
|
+
}),
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
id: 'uitpasNumber',
|
|
139
139
|
name: 'UiTPAS-nummer',
|
|
140
140
|
width: 20,
|
|
141
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
141
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
142
142
|
value: object.details.uitpasNumber,
|
|
143
|
-
})
|
|
143
|
+
}),
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
id: 'requiresFinancialSupport',
|
|
147
147
|
// todo: use correct term
|
|
148
148
|
name: 'Financiële ondersteuning',
|
|
149
149
|
width: 20,
|
|
150
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
150
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
151
151
|
value: XlsxTransformerColumnHelper.formatBoolean(object.details.requiresFinancialSupport?.value),
|
|
152
|
-
})
|
|
152
|
+
}),
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
id: 'notes',
|
|
156
156
|
name: 'Notities',
|
|
157
157
|
width: 20,
|
|
158
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
158
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
159
159
|
value: object.details.notes,
|
|
160
|
-
})
|
|
160
|
+
}),
|
|
161
161
|
},
|
|
162
162
|
|
|
163
163
|
{
|
|
@@ -165,13 +165,13 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
|
165
165
|
name: 'Groep',
|
|
166
166
|
width: 40,
|
|
167
167
|
getValue: (member: PlatformMember) => {
|
|
168
|
-
const organizations =
|
|
169
|
-
const str = Formatter.joinLast(organizations.map(o => o.name).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f')
|
|
168
|
+
const organizations = member.filterOrganizations({ currentPeriod: true, types: [GroupType.Membership] });
|
|
169
|
+
const str = Formatter.joinLast(organizations.map(o => o.name).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
|
|
170
170
|
|
|
171
171
|
return {
|
|
172
|
-
value: str
|
|
173
|
-
}
|
|
174
|
-
}
|
|
172
|
+
value: str,
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
175
|
},
|
|
176
176
|
|
|
177
177
|
{
|
|
@@ -179,13 +179,13 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
|
179
179
|
name: 'Groepsnummer',
|
|
180
180
|
width: 30,
|
|
181
181
|
getValue: (member: PlatformMember) => {
|
|
182
|
-
const organizations =
|
|
183
|
-
const str = Formatter.joinLast(organizations.map(o => o.uri).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f')
|
|
182
|
+
const organizations = member.filterOrganizations({ currentPeriod: true, types: [GroupType.Membership] });
|
|
183
|
+
const str = Formatter.joinLast(organizations.map(o => o.uri).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
|
|
184
184
|
|
|
185
185
|
return {
|
|
186
|
-
value: str
|
|
187
|
-
}
|
|
188
|
-
}
|
|
186
|
+
value: str,
|
|
187
|
+
};
|
|
188
|
+
},
|
|
189
189
|
},
|
|
190
190
|
|
|
191
191
|
{
|
|
@@ -193,13 +193,13 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
|
193
193
|
name: 'Leeftijdsgroep',
|
|
194
194
|
width: 40,
|
|
195
195
|
getValue: (member: PlatformMember) => {
|
|
196
|
-
const groups =
|
|
197
|
-
const str = Formatter.joinLast(Formatter.uniqueArray(groups.map(o => o.group.settings.name)).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f')
|
|
196
|
+
const groups = member.filterRegistrations({ currentPeriod: true, types: [GroupType.Membership], organizationId: Context.organization?.id });
|
|
197
|
+
const str = Formatter.joinLast(Formatter.uniqueArray(groups.map(o => o.group.settings.name)).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
|
|
198
198
|
|
|
199
199
|
return {
|
|
200
|
-
value: str
|
|
201
|
-
}
|
|
202
|
-
}
|
|
200
|
+
value: str,
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
203
|
},
|
|
204
204
|
|
|
205
205
|
{
|
|
@@ -207,15 +207,15 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
|
207
207
|
name: 'Standaard leeftijdsgroep',
|
|
208
208
|
width: 40,
|
|
209
209
|
getValue: (member: PlatformMember) => {
|
|
210
|
-
const groups =
|
|
211
|
-
const defaultAgeGroupIds = Formatter.uniqueArray(groups.filter(o => o.group.defaultAgeGroupId))
|
|
212
|
-
const defaultAgeGroups = defaultAgeGroupIds.map(o => PlatformStruct.shared.config.defaultAgeGroups.find(g => g.id === o.group.defaultAgeGroupId)?.name ?? 'verwijderde leeftijdsgroep')
|
|
213
|
-
const str = Formatter.joinLast(Formatter.uniqueArray(defaultAgeGroups).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f')
|
|
210
|
+
const groups = member.filterRegistrations({ currentPeriod: true, types: [GroupType.Membership], organizationId: Context.organization?.id });
|
|
211
|
+
const defaultAgeGroupIds = Formatter.uniqueArray(groups.filter(o => o.group.defaultAgeGroupId));
|
|
212
|
+
const defaultAgeGroups = defaultAgeGroupIds.map(o => PlatformStruct.shared.config.defaultAgeGroups.find(g => g.id === o.group.defaultAgeGroupId)?.name ?? 'verwijderde leeftijdsgroep');
|
|
213
|
+
const str = Formatter.joinLast(Formatter.uniqueArray(defaultAgeGroups).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
|
|
214
214
|
|
|
215
215
|
return {
|
|
216
|
-
value: str
|
|
217
|
-
}
|
|
218
|
-
}
|
|
216
|
+
value: str,
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
219
|
},
|
|
220
220
|
|
|
221
221
|
...XlsxTransformerColumnHelper.creatColumnsForParents(),
|
|
@@ -225,78 +225,77 @@ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
|
|
|
225
225
|
id: 'unverifiedPhones',
|
|
226
226
|
name: 'Niet-geverifieerde telefoonnummers',
|
|
227
227
|
width: 20,
|
|
228
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
228
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
229
229
|
value: object.details.unverifiedPhones.join(', '),
|
|
230
|
-
})
|
|
230
|
+
}),
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
id: 'unverifiedEmails',
|
|
234
234
|
name: 'Niet-geverifieerde e-mailadressen',
|
|
235
235
|
width: 20,
|
|
236
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
236
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
237
237
|
value: object.details.unverifiedEmails.join(', '),
|
|
238
|
-
})
|
|
238
|
+
}),
|
|
239
239
|
},
|
|
240
240
|
...XlsxTransformerColumnHelper.createColumnsForAddresses<MemberWithRegistrationsBlob>({
|
|
241
241
|
matchIdStart: 'unverifiedAddresses',
|
|
242
242
|
identifier: 'Niet-geverifieerd adres',
|
|
243
|
-
getAddresses:
|
|
244
|
-
limit: 2
|
|
243
|
+
getAddresses: object => object.details.unverifiedAddresses,
|
|
244
|
+
limit: 2,
|
|
245
245
|
}),
|
|
246
246
|
{
|
|
247
247
|
id: 'unverifiedAddresses',
|
|
248
248
|
name: 'Niet-geverifieerde adressen',
|
|
249
249
|
width: 20,
|
|
250
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
250
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
251
251
|
value: object.details.unverifiedAddresses.map(a => a.toString()).join('; '),
|
|
252
|
-
})
|
|
252
|
+
}),
|
|
253
253
|
},
|
|
254
254
|
|
|
255
255
|
// Dynamic records
|
|
256
256
|
{
|
|
257
257
|
match(id) {
|
|
258
258
|
if (id.startsWith('recordAnswers.')) {
|
|
259
|
-
const platform = PlatformStruct.shared
|
|
260
|
-
const organization = Context.organization
|
|
259
|
+
const platform = PlatformStruct.shared;
|
|
260
|
+
const organization = Context.organization;
|
|
261
261
|
|
|
262
262
|
const recordSettings = [
|
|
263
263
|
...(organization?.meta.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords()) ?? []),
|
|
264
|
-
...platform.config.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords())
|
|
265
|
-
]
|
|
264
|
+
...platform.config.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords()),
|
|
265
|
+
];
|
|
266
266
|
|
|
267
267
|
const recordSettingId = id.split('.')[1];
|
|
268
|
-
console.log('recordSettingId', recordSettingId)
|
|
269
|
-
const recordSetting = recordSettings.find(r => r.id === recordSettingId)
|
|
270
|
-
|
|
268
|
+
console.log('recordSettingId', recordSettingId);
|
|
269
|
+
const recordSetting = recordSettings.find(r => r.id === recordSettingId);
|
|
271
270
|
|
|
272
271
|
if (!recordSetting) {
|
|
273
272
|
// Will throw a proper error itself
|
|
274
|
-
console.log('recordSetting not found', recordSettings)
|
|
275
|
-
return
|
|
273
|
+
console.log('recordSetting not found', recordSettings);
|
|
274
|
+
return;
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
const columns = recordSetting.excelColumns
|
|
277
|
+
const columns = recordSetting.excelColumns;
|
|
279
278
|
|
|
280
279
|
return columns.map((columnName, index) => {
|
|
281
280
|
return {
|
|
282
281
|
id: `recordAnswers.${recordSettingId}.${index}`,
|
|
283
282
|
name: columnName,
|
|
284
283
|
width: 20,
|
|
285
|
-
getValue: ({patchedMember: object}: PlatformMember) => ({
|
|
286
|
-
value: object.details.recordAnswers.get(recordSettingId)?.excelValues[index]?.value ?? ''
|
|
287
|
-
})
|
|
288
|
-
}
|
|
289
|
-
})
|
|
284
|
+
getValue: ({ patchedMember: object }: PlatformMember) => ({
|
|
285
|
+
value: object.details.recordAnswers.get(recordSettingId)?.excelValues[index]?.value ?? '',
|
|
286
|
+
}),
|
|
287
|
+
};
|
|
288
|
+
});
|
|
290
289
|
}
|
|
291
290
|
},
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
})
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
});
|
|
297
296
|
|
|
298
297
|
function formatGender(gender: Gender) {
|
|
299
|
-
switch(gender) {
|
|
298
|
+
switch (gender) {
|
|
300
299
|
case Gender.Male: return 'Man';
|
|
301
300
|
case Gender.Female: return 'Vrouw';
|
|
302
301
|
default: return 'Andere';
|