@stamhoofd/backend 2.98.0 → 2.99.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stamhoofd/backend",
3
- "version": "2.98.0",
3
+ "version": "2.99.1",
4
4
  "main": "./dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -45,14 +45,14 @@
45
45
  "@simonbackx/simple-encoding": "2.22.0",
46
46
  "@simonbackx/simple-endpoints": "1.20.1",
47
47
  "@simonbackx/simple-logging": "^1.0.1",
48
- "@stamhoofd/backend-i18n": "2.98.0",
49
- "@stamhoofd/backend-middleware": "2.98.0",
50
- "@stamhoofd/email": "2.98.0",
51
- "@stamhoofd/models": "2.98.0",
52
- "@stamhoofd/queues": "2.98.0",
53
- "@stamhoofd/sql": "2.98.0",
54
- "@stamhoofd/structures": "2.98.0",
55
- "@stamhoofd/utility": "2.98.0",
48
+ "@stamhoofd/backend-i18n": "2.99.1",
49
+ "@stamhoofd/backend-middleware": "2.99.1",
50
+ "@stamhoofd/email": "2.99.1",
51
+ "@stamhoofd/models": "2.99.1",
52
+ "@stamhoofd/queues": "2.99.1",
53
+ "@stamhoofd/sql": "2.99.1",
54
+ "@stamhoofd/structures": "2.99.1",
55
+ "@stamhoofd/utility": "2.99.1",
56
56
  "archiver": "^7.0.1",
57
57
  "axios": "^1.8.2",
58
58
  "cookie": "^0.7.0",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "d15c1756a1e10788fa2736efcc6abbc2e3f365a6"
73
+ "gitHead": "92d884776091f7182f8699725b7a7b5b8dcf41e7"
74
74
  }
@@ -21,7 +21,7 @@ async function balanceEmails() {
21
21
  return;
22
22
  }
23
23
 
24
- if ((new Date().getHours() > 18 || new Date().getHours() < 6) && STAMHOOFD.environment !== 'development') {
24
+ if ((new Date().getHours() > 10 || new Date().getHours() < 6) && STAMHOOFD.environment !== 'development') {
25
25
  return;
26
26
  }
27
27
 
@@ -1,12 +1,11 @@
1
1
  import { ConvertArrayToPatchableArray, Decoder, PatchableArrayAutoEncoder, PatchableArrayDecoder, StringDecoder, patchObject } from '@simonbackx/simple-encoding';
2
2
  import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
3
- import { AuditLogSource, RegistrationPeriod as RegistrationPeriodStruct } from '@stamhoofd/structures';
3
+ import { RegistrationPeriod as RegistrationPeriodStruct } from '@stamhoofd/structures';
4
4
 
5
5
  import { SimpleError } from '@simonbackx/simple-errors';
6
6
  import { Organization, Platform, RegistrationPeriod } from '@stamhoofd/models';
7
7
  import { Context } from '../../../helpers/Context';
8
8
  import { PeriodHelper } from '../../../helpers/PeriodHelper';
9
- import { AuditLogService } from '../../../services/AuditLogService';
10
9
 
11
10
  type Params = Record<string, never>;
12
11
  type Query = undefined;
@@ -71,8 +70,17 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
71
70
  const periods: RegistrationPeriod[] = [];
72
71
 
73
72
  for (const { put } of request.body.getPuts()) {
73
+ if (put.endDate < put.startDate) {
74
+ throw new SimpleError({
75
+ code: 'invalid_field',
76
+ message: $t('De einddatum moet na de startdatum liggen.'),
77
+ field: 'endDate',
78
+ });
79
+ }
80
+
74
81
  const period = new RegistrationPeriod();
75
82
  period.id = put.id;
83
+ period.customName = put.customName;
76
84
  period.startDate = put.startDate;
77
85
  period.endDate = put.endDate;
78
86
  period.locked = put.locked;
@@ -129,6 +137,15 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
129
137
  model.endDate = patch.endDate;
130
138
  }
131
139
 
140
+ // only check if start or end date is patched
141
+ if ((patch.startDate || patch.endDate) && model.endDate < model.startDate) {
142
+ throw new SimpleError({
143
+ code: 'invalid_field',
144
+ message: $t('De einddatum moet na de startdatum liggen.'),
145
+ field: 'endDate',
146
+ });
147
+ }
148
+
132
149
  if (patch.locked !== undefined) {
133
150
  model.locked = patch.locked;
134
151
  }
@@ -137,6 +154,10 @@ export class PatchRegistrationPeriodsEndpoint extends Endpoint<Params, Query, Bo
137
154
  model.settings = patchObject(model.settings, patch.settings);
138
155
  }
139
156
 
157
+ if (patch.customName !== undefined) {
158
+ model.customName = patch.customName;
159
+ }
160
+
140
161
  await model.updatePreviousNextPeriods();
141
162
  await model.save();
142
163
 
@@ -1,12 +1,12 @@
1
+ import { ArrayDecoder, field } from '@simonbackx/simple-encoding';
1
2
  import { XlsxTransformerSheet } from '@stamhoofd/excel-writer';
2
- import { Platform as PlatformStruct, ExcelExportType, LimitedFilteredRequest, Organization as OrganizationStruct, MemberResponsibilityRecord as MemberResponsibilityRecordStruct, PaginatedResponse, MemberWithRegistrationsBlob, Premise } from '@stamhoofd/structures';
3
- import { GetOrganizationsEndpoint } from '../endpoints/admin/organizations/GetOrganizationsEndpoint';
4
- import { ExportToExcelEndpoint } from '../endpoints/global/files/ExportToExcelEndpoint';
5
- import { XlsxTransformerColumnHelper } from '../helpers/XlsxTransformerColumnHelper';
6
3
  import { Group, Member, MemberResponsibilityRecord } from '@stamhoofd/models';
4
+ import { ExcelExportType, LimitedFilteredRequest, MemberResponsibilityRecord as MemberResponsibilityRecordStruct, MemberWithRegistrationsBlob, Organization as OrganizationStruct, PaginatedResponse, Platform as PlatformStruct, Premise } from '@stamhoofd/structures';
7
5
  import { Formatter, Sorter } from '@stamhoofd/utility';
8
- import { ArrayDecoder, field } from '@simonbackx/simple-encoding';
6
+ import { GetOrganizationsEndpoint } from '../endpoints/admin/organizations/GetOrganizationsEndpoint';
7
+ import { ExportToExcelEndpoint } from '../endpoints/global/files/ExportToExcelEndpoint';
9
8
  import { AuthenticatedStructures } from '../helpers/AuthenticatedStructures';
9
+ import { XlsxTransformerColumnHelper } from '../helpers/XlsxTransformerColumnHelper';
10
10
 
11
11
  class MemberResponsibilityRecordWithMember extends MemberResponsibilityRecordStruct {
12
12
  @field({ decoder: MemberWithRegistrationsBlob })
@@ -70,6 +70,18 @@ const sheet: XlsxTransformerSheet<Object, Object> = {
70
70
  matchId: 'address',
71
71
  getAddress: object => object.address,
72
72
  }),
73
+ // Dynamic records
74
+ XlsxTransformerColumnHelper.createRecordAnswersColumns({
75
+ matchId: 'recordAnswers',
76
+ getRecordAnswers: (object: Object) => object.getRecordAnswers(),
77
+ getRecordCategories: () => {
78
+ const platform = PlatformStruct.shared;
79
+
80
+ return [
81
+ ...platform.config.organizationLevelRecordsConfiguration.recordCategories,
82
+ ];
83
+ },
84
+ }),
73
85
  ],
74
86
  };
75
87