@stamhoofd/backend 2.40.0 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamhoofd/backend",
3
- "version": "2.40.0",
3
+ "version": "2.41.0",
4
4
  "main": "./dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -36,14 +36,14 @@
36
36
  "@simonbackx/simple-encoding": "2.15.1",
37
37
  "@simonbackx/simple-endpoints": "1.14.0",
38
38
  "@simonbackx/simple-logging": "^1.0.1",
39
- "@stamhoofd/backend-i18n": "2.40.0",
40
- "@stamhoofd/backend-middleware": "2.40.0",
41
- "@stamhoofd/email": "2.40.0",
42
- "@stamhoofd/models": "2.40.0",
43
- "@stamhoofd/queues": "2.40.0",
44
- "@stamhoofd/sql": "2.40.0",
45
- "@stamhoofd/structures": "2.40.0",
46
- "@stamhoofd/utility": "2.40.0",
39
+ "@stamhoofd/backend-i18n": "2.41.0",
40
+ "@stamhoofd/backend-middleware": "2.41.0",
41
+ "@stamhoofd/email": "2.41.0",
42
+ "@stamhoofd/models": "2.41.0",
43
+ "@stamhoofd/queues": "2.41.0",
44
+ "@stamhoofd/sql": "2.41.0",
45
+ "@stamhoofd/structures": "2.41.0",
46
+ "@stamhoofd/utility": "2.41.0",
47
47
  "archiver": "^7.0.1",
48
48
  "aws-sdk": "^2.885.0",
49
49
  "axios": "1.6.8",
@@ -60,5 +60,5 @@
60
60
  "postmark": "^4.0.5",
61
61
  "stripe": "^16.6.0"
62
62
  },
63
- "gitHead": "6839689f56361c6ba6f34f6113a5cdc4bbd7b209"
63
+ "gitHead": "03f83c0617324280ab302a12fc0669f021b6dceb"
64
64
  }
@@ -113,6 +113,10 @@ export class PatchPlatformEndpoint extends Endpoint<
113
113
  if (d.defaultMembershipTypeId !== undefined) {
114
114
  shouldUpdateMemberships = true;
115
115
  }
116
+
117
+ if (d.minimumRequiredMembers !== undefined) {
118
+ shouldUpdateSetupSteps = true;
119
+ }
116
120
  }
117
121
  }
118
122
  }
@@ -267,6 +267,11 @@ export class PatchOrganizationRegistrationPeriodsEndpoint extends Endpoint<Param
267
267
  throw Context.auth.error('Je hebt geen toegangsrechten om deze groep te wijzigen');
268
268
  }
269
269
 
270
+ const previousProperties = {
271
+ deletedAt: model.deletedAt,
272
+ defaultAgeGroupId: model.defaultAgeGroupId,
273
+ };
274
+
270
275
  if (struct.settings) {
271
276
  struct.settings.period = undefined; // Not allowed to patch manually
272
277
  model.settings.patchOrPut(struct.settings);
@@ -376,7 +381,9 @@ export class PatchOrganizationRegistrationPeriodsEndpoint extends Endpoint<Param
376
381
  }
377
382
  }
378
383
 
379
- await model.updateOccupancy();
384
+ await model.updateOccupancy({
385
+ previousProperties,
386
+ });
380
387
  await model.save();
381
388
 
382
389
  if (struct.deletedAt !== undefined || struct.defaultAgeGroupId !== undefined) {
@@ -1,297 +1,300 @@
1
- import { XlsxBuiltInNumberFormat } from '@stamhoofd/excel-writer';
1
+ import { XlsxBuiltInNumberFormat, XlsxTransformerSheet } from '@stamhoofd/excel-writer';
2
2
  import { Platform } from '@stamhoofd/models';
3
- import { ExcelExportType, Gender, GroupType, LimitedFilteredRequest, MemberWithRegistrationsBlob, PlatformFamily, PlatformMember, UnencodeablePaginatedResponse, Platform as PlatformStruct } from '@stamhoofd/structures';
3
+ import { ExcelExportType, Gender, GroupType, LimitedFilteredRequest, PlatformFamily, PlatformMember, Platform as PlatformStruct, UnencodeablePaginatedResponse } from '@stamhoofd/structures';
4
+ import { Formatter } from '@stamhoofd/utility';
4
5
  import { ExportToExcelEndpoint } from '../endpoints/global/files/ExportToExcelEndpoint';
5
6
  import { GetMembersEndpoint } from '../endpoints/global/members/GetMembersEndpoint';
7
+ import { AuthenticatedStructures } from '../helpers/AuthenticatedStructures';
6
8
  import { Context } from '../helpers/Context';
7
9
  import { XlsxTransformerColumnHelper } from '../helpers/xlsxAddressTransformerColumnFactory';
8
- import { Formatter } from '@stamhoofd/utility';
9
- import { AuthenticatedStructures } from '../helpers/AuthenticatedStructures';
10
-
11
- ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
12
- fetch: async (query: LimitedFilteredRequest) => {
13
- const result = await GetMembersEndpoint.buildData(query);
14
10
 
15
- return new UnencodeablePaginatedResponse({
16
- results: PlatformFamily.createSingles(result.results, {
17
- contextOrganization: Context.organization ? (await AuthenticatedStructures.organization(Context.organization)) : null,
18
- platform: await Platform.getSharedStruct(),
11
+ // Assign to a typed variable to assure we have correct type checking in place
12
+ const sheet: XlsxTransformerSheet<PlatformMember, PlatformMember> = {
13
+ id: 'members',
14
+ name: 'Leden',
15
+ columns: [
16
+ {
17
+ id: 'id',
18
+ name: 'ID',
19
+ width: 20,
20
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
21
+ value: object.id,
19
22
  }),
20
- next: result.next,
21
- });
22
- },
23
- sheets: [
23
+ },
24
24
  {
25
- id: 'members',
26
- name: 'Leden',
27
- columns: [
28
- {
29
- id: 'id',
30
- name: 'ID',
31
- width: 20,
32
- getValue: ({ patchedMember: object }: PlatformMember) => ({
33
- value: object.id,
34
- }),
35
- },
36
- {
37
- id: 'memberNumber',
38
- name: 'Nummer',
39
- width: 20,
40
- getValue: ({ patchedMember: object }: PlatformMember) => ({
41
- value: object.details.memberNumber,
42
- }),
43
- },
44
- {
45
- id: 'firstName',
46
- name: 'Voornaam',
47
- width: 20,
48
- getValue: ({ patchedMember: object }: PlatformMember) => ({
49
- value: object.details.firstName,
50
- }),
51
- },
52
- {
53
- id: 'lastName',
54
- name: 'Achternaam',
55
- width: 20,
56
- getValue: ({ patchedMember: object }: PlatformMember) => ({
57
- value: object.details.lastName,
58
- }),
59
- },
60
- {
61
- id: 'birthDay',
62
- name: 'Geboortedatum',
63
- width: 20,
64
- getValue: ({ patchedMember: object }: PlatformMember) => ({
65
- value: object.details.birthDay,
66
- style: {
67
- numberFormat: {
68
- id: XlsxBuiltInNumberFormat.DateSlash,
69
- },
70
- },
71
- }),
72
- },
73
- {
74
- id: 'age',
75
- name: 'Leeftijd',
76
- width: 20,
77
- getValue: ({ patchedMember: object }: PlatformMember) => ({
78
- value: object.details.age,
79
- }),
80
- },
81
- {
82
- id: 'gender',
83
- name: 'Geslacht',
84
- width: 20,
85
- getValue: ({ patchedMember: object }: PlatformMember) => {
86
- const gender = object.details.gender;
87
-
88
- return ({
89
- value: formatGender(gender),
90
- });
25
+ id: 'memberNumber',
26
+ name: 'Nummer',
27
+ width: 20,
28
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
29
+ value: object.details.memberNumber,
30
+ }),
31
+ },
32
+ {
33
+ id: 'firstName',
34
+ name: 'Voornaam',
35
+ width: 20,
36
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
37
+ value: object.details.firstName,
38
+ }),
39
+ },
40
+ {
41
+ id: 'lastName',
42
+ name: 'Achternaam',
43
+ width: 20,
44
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
45
+ value: object.details.lastName,
46
+ }),
47
+ },
48
+ {
49
+ id: 'birthDay',
50
+ name: 'Geboortedatum',
51
+ width: 20,
52
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
53
+ value: object.details.birthDay,
54
+ style: {
55
+ numberFormat: {
56
+ id: XlsxBuiltInNumberFormat.DateSlash,
91
57
  },
92
58
  },
93
- {
94
- id: 'phone',
95
- name: 'Telefoonnummer',
96
- width: 20,
97
- getValue: ({ patchedMember: object }: PlatformMember) => ({
98
- value: object.details.phone,
99
- }),
100
- },
101
- {
102
- id: 'email',
103
- name: 'E-mailadres',
104
- width: 20,
105
- getValue: ({ patchedMember: object }: PlatformMember) => ({
106
- value: object.details.email,
107
- }),
108
- },
109
- XlsxTransformerColumnHelper.createAddressColumns<PlatformMember>({
110
- matchId: 'address',
111
- identifier: 'Adres',
112
- getAddress: ({ patchedMember: object }: PlatformMember) => {
113
- // get member address if exists
114
- const memberAddress = object.details.address;
115
- if (memberAddress) {
116
- return memberAddress;
117
- }
59
+ }),
60
+ },
61
+ {
62
+ id: 'age',
63
+ name: 'Leeftijd',
64
+ width: 20,
65
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
66
+ value: object.details.age,
67
+ }),
68
+ },
69
+ {
70
+ id: 'gender',
71
+ name: 'Geslacht',
72
+ width: 20,
73
+ getValue: ({ patchedMember: object }: PlatformMember) => {
74
+ const gender = object.details.gender;
118
75
 
119
- // else get address of first parent with address
120
- for (const parent of object.details.parents) {
121
- if (parent.address) {
122
- return parent.address;
123
- }
124
- }
76
+ return ({
77
+ value: formatGender(gender),
78
+ });
79
+ },
80
+ },
81
+ {
82
+ id: 'phone',
83
+ name: 'Telefoonnummer',
84
+ width: 20,
85
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
86
+ value: object.details.phone,
87
+ }),
88
+ },
89
+ {
90
+ id: 'email',
91
+ name: 'E-mailadres',
92
+ width: 20,
93
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
94
+ value: object.details.email,
95
+ }),
96
+ },
97
+ XlsxTransformerColumnHelper.createAddressColumns<PlatformMember>({
98
+ matchId: 'address',
99
+ identifier: 'Adres',
100
+ getAddress: ({ patchedMember: object }: PlatformMember) => {
101
+ // get member address if exists
102
+ const memberAddress = object.details.address;
103
+ if (memberAddress) {
104
+ return memberAddress;
105
+ }
125
106
 
126
- return null;
127
- },
128
- }),
129
- {
130
- id: 'securityCode',
131
- name: 'Beveiligingscode',
132
- width: 20,
133
- getValue: ({ patchedMember: object }: PlatformMember) => ({
134
- value: object.details.securityCode,
135
- }),
136
- },
137
- {
138
- id: 'uitpasNumber',
139
- name: 'UiTPAS-nummer',
140
- width: 20,
141
- getValue: ({ patchedMember: object }: PlatformMember) => ({
142
- value: object.details.uitpasNumber,
143
- }),
144
- },
145
- {
146
- id: 'requiresFinancialSupport',
147
- // todo: use correct term
148
- name: 'Financiële ondersteuning',
149
- width: 20,
150
- getValue: ({ patchedMember: object }: PlatformMember) => ({
151
- value: XlsxTransformerColumnHelper.formatBoolean(object.details.requiresFinancialSupport?.value),
152
- }),
153
- },
154
- {
155
- id: 'notes',
156
- name: 'Notities',
157
- width: 20,
158
- getValue: ({ patchedMember: object }: PlatformMember) => ({
159
- value: object.details.notes,
160
- }),
161
- },
107
+ // else get address of first parent with address
108
+ for (const parent of object.details.parents) {
109
+ if (parent.address) {
110
+ return parent.address;
111
+ }
112
+ }
162
113
 
163
- {
164
- id: 'organization',
165
- name: 'Groep',
166
- width: 40,
167
- getValue: (member: PlatformMember) => {
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');
114
+ return null;
115
+ },
116
+ }),
117
+ {
118
+ id: 'securityCode',
119
+ name: 'Beveiligingscode',
120
+ width: 20,
121
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
122
+ value: object.details.securityCode,
123
+ }),
124
+ },
125
+ {
126
+ id: 'uitpasNumber',
127
+ name: 'UiTPAS-nummer',
128
+ width: 20,
129
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
130
+ value: object.details.uitpasNumber,
131
+ }),
132
+ },
133
+ {
134
+ id: 'requiresFinancialSupport',
135
+ // todo: use correct term
136
+ name: 'Financiële ondersteuning',
137
+ width: 20,
138
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
139
+ value: XlsxTransformerColumnHelper.formatBoolean(object.details.requiresFinancialSupport?.value),
140
+ }),
141
+ },
142
+ {
143
+ id: 'notes',
144
+ name: 'Notities',
145
+ width: 20,
146
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
147
+ value: object.details.notes,
148
+ }),
149
+ },
170
150
 
171
- return {
172
- value: str,
173
- };
174
- },
175
- },
151
+ {
152
+ id: 'organization',
153
+ name: 'Groep',
154
+ width: 40,
155
+ getValue: (member: PlatformMember) => {
156
+ const organizations = member.filterOrganizations({ currentPeriod: true, types: [GroupType.Membership] });
157
+ const str = Formatter.joinLast(organizations.map(o => o.name).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
176
158
 
177
- {
178
- id: 'uri',
179
- name: 'Groepsnummer',
180
- width: 30,
181
- getValue: (member: PlatformMember) => {
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');
159
+ return {
160
+ value: str,
161
+ };
162
+ },
163
+ },
184
164
 
185
- return {
186
- value: str,
187
- };
188
- },
189
- },
165
+ {
166
+ id: 'uri',
167
+ name: 'Groepsnummer',
168
+ width: 30,
169
+ getValue: (member: PlatformMember) => {
170
+ const organizations = member.filterOrganizations({ currentPeriod: true, types: [GroupType.Membership] });
171
+ const str = Formatter.joinLast(organizations.map(o => o.uri).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
190
172
 
191
- {
192
- id: 'group',
193
- name: 'Leeftijdsgroep',
194
- width: 40,
195
- getValue: (member: PlatformMember) => {
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');
173
+ return {
174
+ value: str,
175
+ };
176
+ },
177
+ },
198
178
 
199
- return {
200
- value: str,
201
- };
202
- },
203
- },
179
+ {
180
+ id: 'group',
181
+ name: 'Leeftijdsgroep',
182
+ width: 40,
183
+ getValue: (member: PlatformMember) => {
184
+ const groups = member.filterRegistrations({ currentPeriod: true, types: [GroupType.Membership], organizationId: Context.organization?.id });
185
+ const str = Formatter.joinLast(Formatter.uniqueArray(groups.map(o => o.group.settings.name)).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
204
186
 
205
- {
206
- id: 'defaultAgeGroup',
207
- name: 'Standaard leeftijdsgroep',
208
- width: 40,
209
- getValue: (member: PlatformMember) => {
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');
187
+ return {
188
+ value: str,
189
+ };
190
+ },
191
+ },
214
192
 
215
- return {
216
- value: str,
217
- };
218
- },
219
- },
193
+ {
194
+ id: 'defaultAgeGroup',
195
+ name: 'Standaard leeftijdsgroep',
196
+ width: 40,
197
+ getValue: (member: PlatformMember) => {
198
+ const groups = member.filterRegistrations({ currentPeriod: true, types: [GroupType.Membership], organizationId: Context.organization?.id });
199
+ const defaultAgeGroupIds = Formatter.uniqueArray(groups.filter(o => o.group.defaultAgeGroupId));
200
+ const defaultAgeGroups = defaultAgeGroupIds.map(o => PlatformStruct.shared.config.defaultAgeGroups.find(g => g.id === o.group.defaultAgeGroupId)?.name ?? 'verwijderde leeftijdsgroep');
201
+ const str = Formatter.joinLast(Formatter.uniqueArray(defaultAgeGroups).sort(), ', ', ' en ') || Context.i18n.$t('1a16a32a-7ee4-455d-af3d-6073821efa8f');
220
202
 
221
- ...XlsxTransformerColumnHelper.creatColumnsForParents(),
203
+ return {
204
+ value: str,
205
+ };
206
+ },
207
+ },
222
208
 
223
- // unverified data
224
- {
225
- id: 'unverifiedPhones',
226
- name: 'Niet-geverifieerde telefoonnummers',
227
- width: 20,
228
- getValue: ({ patchedMember: object }: PlatformMember) => ({
229
- value: object.details.unverifiedPhones.join(', '),
230
- }),
231
- },
232
- {
233
- id: 'unverifiedEmails',
234
- name: 'Niet-geverifieerde e-mailadressen',
235
- width: 20,
236
- getValue: ({ patchedMember: object }: PlatformMember) => ({
237
- value: object.details.unverifiedEmails.join(', '),
238
- }),
239
- },
240
- ...XlsxTransformerColumnHelper.createColumnsForAddresses<MemberWithRegistrationsBlob>({
241
- matchIdStart: 'unverifiedAddresses',
242
- identifier: 'Niet-geverifieerd adres',
243
- getAddresses: object => object.details.unverifiedAddresses,
244
- limit: 2,
245
- }),
246
- {
247
- id: 'unverifiedAddresses',
248
- name: 'Niet-geverifieerde adressen',
249
- width: 20,
250
- getValue: ({ patchedMember: object }: PlatformMember) => ({
251
- value: object.details.unverifiedAddresses.map(a => a.toString()).join('; '),
252
- }),
253
- },
209
+ ...XlsxTransformerColumnHelper.creatColumnsForParents(),
254
210
 
255
- // Dynamic records
256
- {
257
- match(id) {
258
- if (id.startsWith('recordAnswers.')) {
259
- const platform = PlatformStruct.shared;
260
- const organization = Context.organization;
211
+ // unverified data
212
+ {
213
+ id: 'unverifiedPhones',
214
+ name: 'Niet-geverifieerde telefoonnummers',
215
+ width: 20,
216
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
217
+ value: object.details.unverifiedPhones.join(', '),
218
+ }),
219
+ },
220
+ {
221
+ id: 'unverifiedEmails',
222
+ name: 'Niet-geverifieerde e-mailadressen',
223
+ width: 20,
224
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
225
+ value: object.details.unverifiedEmails.join(', '),
226
+ }),
227
+ },
228
+ ...XlsxTransformerColumnHelper.createColumnsForAddresses<PlatformMember>({
229
+ matchIdStart: 'unverifiedAddresses',
230
+ identifier: 'Niet-geverifieerd adres',
231
+ getAddresses: object => object.patchedMember.details.unverifiedAddresses,
232
+ limit: 2,
233
+ }),
234
+ {
235
+ id: 'unverifiedAddresses',
236
+ name: 'Niet-geverifieerde adressen',
237
+ width: 20,
238
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
239
+ value: object.details.unverifiedAddresses.map(a => a.toString()).join('; '),
240
+ }),
241
+ },
261
242
 
262
- const recordSettings = [
263
- ...(organization?.meta.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords()) ?? []),
264
- ...platform.config.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords()),
265
- ];
243
+ // Dynamic records
244
+ {
245
+ match(id) {
246
+ if (id.startsWith('recordAnswers.')) {
247
+ const platform = PlatformStruct.shared;
248
+ const organization = Context.organization;
266
249
 
267
- const recordSettingId = id.split('.')[1];
268
- console.log('recordSettingId', recordSettingId);
269
- const recordSetting = recordSettings.find(r => r.id === recordSettingId);
250
+ const recordSettings = [
251
+ ...(organization?.meta.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords()) ?? []),
252
+ ...platform.config.recordsConfiguration.recordCategories.flatMap(category => category.getAllRecords()),
253
+ ];
270
254
 
271
- if (!recordSetting) {
272
- // Will throw a proper error itself
273
- console.log('recordSetting not found', recordSettings);
274
- return;
275
- }
255
+ const recordSettingId = id.split('.')[1];
256
+ console.log('recordSettingId', recordSettingId);
257
+ const recordSetting = recordSettings.find(r => r.id === recordSettingId);
276
258
 
277
- const columns = recordSetting.excelColumns;
259
+ if (!recordSetting) {
260
+ // Will throw a proper error itself
261
+ console.log('recordSetting not found', recordSettings);
262
+ return;
263
+ }
278
264
 
279
- return columns.map((columnName, index) => {
280
- return {
281
- id: `recordAnswers.${recordSettingId}.${index}`,
282
- name: columnName,
283
- width: 20,
284
- getValue: ({ patchedMember: object }: PlatformMember) => ({
285
- value: object.details.recordAnswers.get(recordSettingId)?.excelValues[index]?.value ?? '',
286
- }),
287
- };
288
- });
289
- }
290
- },
291
- },
292
- ],
265
+ const columns = recordSetting.excelColumns;
266
+
267
+ return columns.map((columnName, index) => {
268
+ return {
269
+ id: `recordAnswers.${recordSettingId}.${index}`,
270
+ name: columnName,
271
+ width: 20,
272
+ getValue: ({ patchedMember: object }: PlatformMember) => ({
273
+ value: object.details.recordAnswers.get(recordSettingId)?.excelValues[index]?.value ?? '',
274
+ }),
275
+ };
276
+ });
277
+ }
278
+ },
293
279
  },
294
280
  ],
281
+ };
282
+
283
+ ExportToExcelEndpoint.loaders.set(ExcelExportType.Members, {
284
+ fetch: async (query: LimitedFilteredRequest) => {
285
+ const result = await GetMembersEndpoint.buildData(query);
286
+
287
+ return new UnencodeablePaginatedResponse({
288
+ results: PlatformFamily.createSingles(result.results, {
289
+ contextOrganization: Context.organization ? (await AuthenticatedStructures.organization(Context.organization)) : null,
290
+ platform: await Platform.getSharedStruct(),
291
+ }),
292
+ next: result.next,
293
+ });
294
+ },
295
+ sheets: [
296
+ sheet,
297
+ ],
295
298
  });
296
299
 
297
300
  function formatGender(gender: Gender) {
@@ -1,5 +1,5 @@
1
1
  import { XlsxTransformerColumn } from '@stamhoofd/excel-writer';
2
- import { Address, CountryHelper, MemberWithRegistrationsBlob, Parent, ParentTypeHelper } from '@stamhoofd/structures';
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 {
@@ -14,14 +14,14 @@ export class XlsxTransformerColumnHelper {
14
14
  return '';
15
15
  }
16
16
 
17
- static creatColumnsForParents(): XlsxTransformerColumn<unknown>[] {
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; getAddresses: (object: T) => Address[]; matchIdStart: string; identifier: string }): XlsxTransformerColumn<unknown>[] {
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
27
  for (let i = 0; i <= limit; i++) {
@@ -37,8 +37,8 @@ export class XlsxTransformerColumnHelper {
37
37
  return result;
38
38
  }
39
39
 
40
- static createColumnsForParent(parentIndex: number): XlsxTransformerColumn<unknown>[] {
41
- const getParent = (member: MemberWithRegistrationsBlob): Parent | null | undefined => member.details.parents[parentIndex];
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
 
@@ -51,7 +51,7 @@ export class XlsxTransformerColumnHelper {
51
51
  id: getId('type'),
52
52
  name: getName('Type'),
53
53
  width: 20,
54
- getValue: (member: MemberWithRegistrationsBlob) => {
54
+ getValue: (member: PlatformMember) => {
55
55
  const parent = getParent(member);
56
56
 
57
57
  return {
@@ -63,7 +63,7 @@ export class XlsxTransformerColumnHelper {
63
63
  id: getId('firstName'),
64
64
  name: getName('Voornaam'),
65
65
  width: 20,
66
- getValue: (member: MemberWithRegistrationsBlob) => ({
66
+ getValue: (member: PlatformMember) => ({
67
67
  value: getParent(member)?.firstName ?? '',
68
68
  }),
69
69
  },
@@ -71,7 +71,7 @@ export class XlsxTransformerColumnHelper {
71
71
  id: getId('lastName'),
72
72
  name: getName('Achternaam'),
73
73
  width: 20,
74
- getValue: (member: MemberWithRegistrationsBlob) => ({
74
+ getValue: (member: PlatformMember) => ({
75
75
  value: getParent(member)?.lastName ?? '',
76
76
  }),
77
77
  },
@@ -79,7 +79,7 @@ export class XlsxTransformerColumnHelper {
79
79
  id: getId('phone'),
80
80
  name: getName('Telefoonnummer'),
81
81
  width: 20,
82
- getValue: (member: MemberWithRegistrationsBlob) => ({
82
+ getValue: (member: PlatformMember) => ({
83
83
  value: getParent(member)?.phone ?? '',
84
84
  }),
85
85
  },
@@ -87,11 +87,11 @@ export class XlsxTransformerColumnHelper {
87
87
  id: getId('email'),
88
88
  name: getName('E-mailadres'),
89
89
  width: 20,
90
- getValue: (member: MemberWithRegistrationsBlob) => ({
90
+ getValue: (member: PlatformMember) => ({
91
91
  value: getParent(member)?.email ?? '',
92
92
  }),
93
93
  },
94
- XlsxTransformerColumnHelper.createAddressColumns<MemberWithRegistrationsBlob>({
94
+ XlsxTransformerColumnHelper.createAddressColumns<PlatformMember>({
95
95
  matchId: getId('address'),
96
96
  getAddress: member => getParent(member)?.address,
97
97
  identifier: getName('Adres'),