@stamhoofd/backend 2.32.3 → 2.32.4
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 +10 -10
- package/src/endpoints/auth/VerifyEmailEndpoint.ts +1 -1
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +15 -17
- package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +0 -1
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +26 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamhoofd/backend",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.4",
|
|
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.32.
|
|
40
|
-
"@stamhoofd/backend-middleware": "2.32.
|
|
41
|
-
"@stamhoofd/email": "2.32.
|
|
42
|
-
"@stamhoofd/models": "2.32.
|
|
43
|
-
"@stamhoofd/queues": "2.32.
|
|
44
|
-
"@stamhoofd/sql": "2.32.
|
|
45
|
-
"@stamhoofd/structures": "2.32.
|
|
46
|
-
"@stamhoofd/utility": "2.32.
|
|
39
|
+
"@stamhoofd/backend-i18n": "2.32.4",
|
|
40
|
+
"@stamhoofd/backend-middleware": "2.32.4",
|
|
41
|
+
"@stamhoofd/email": "2.32.4",
|
|
42
|
+
"@stamhoofd/models": "2.32.4",
|
|
43
|
+
"@stamhoofd/queues": "2.32.4",
|
|
44
|
+
"@stamhoofd/sql": "2.32.4",
|
|
45
|
+
"@stamhoofd/structures": "2.32.4",
|
|
46
|
+
"@stamhoofd/utility": "2.32.4",
|
|
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.2",
|
|
61
61
|
"stripe": "^16.6.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "b3fb87740644d823bff02163b856477c3e7c45db"
|
|
64
64
|
}
|
|
@@ -76,7 +76,7 @@ export class VerifyEmailEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
76
76
|
throw new SimpleError({
|
|
77
77
|
code: "email_in_use",
|
|
78
78
|
message: "This e-mail is already in use, we cannot set it",
|
|
79
|
-
human: "We kunnen het e-mailadres van deze gebruiker niet instellen naar "+code.email+", omdat die al in gebruik is. Waarschijnlijk heb je meerdere accounts. Probeer met dat e-mailadres in te loggen of contacteer ons ("+request.$t("
|
|
79
|
+
human: "We kunnen het e-mailadres van deze gebruiker niet instellen naar "+code.email+", omdat die al in gebruik is. Waarschijnlijk heb je meerdere accounts. Probeer met dat e-mailadres in te loggen of contacteer ons ("+request.$t("59b85264-c4c3-4cf6-8923-9b43282b2787")+") als we de gebruikers moeten combineren tot één gebruiker."
|
|
80
80
|
})
|
|
81
81
|
}
|
|
82
82
|
throw e;
|
|
@@ -499,23 +499,21 @@ export class PatchOrganizationMembersEndpoint extends Endpoint<Params, Query, Bo
|
|
|
499
499
|
throw Context.auth.error("Je hebt niet voldoende rechten om dit lid te verwijderen")
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
//
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
// }
|
|
518
|
-
//}
|
|
502
|
+
await MemberUserSyncer.onDeleteMember(member)
|
|
503
|
+
await User.deleteForDeletedMember(member.id)
|
|
504
|
+
await BalanceItem.deleteForDeletedMember(member.id)
|
|
505
|
+
await member.delete()
|
|
506
|
+
shouldUpdateSetupSteps = true
|
|
507
|
+
|
|
508
|
+
// Update occupancy of this member because we removed registrations
|
|
509
|
+
const groupIds = member.registrations.flatMap(r => r.groupId)
|
|
510
|
+
for (const id of groupIds) {
|
|
511
|
+
const group = await getGroup(id)
|
|
512
|
+
if (group) {
|
|
513
|
+
// We need to update this group occupancy because we moved one member away from it
|
|
514
|
+
updateGroups.set(group.id, group)
|
|
515
|
+
}
|
|
516
|
+
}
|
|
519
517
|
}
|
|
520
518
|
|
|
521
519
|
await Member.updateOutstandingBalance(Formatter.uniqueArray(balanceItemMemberIds))
|
|
@@ -6,7 +6,6 @@ import { Organization, StripeAccount, StripeCheckoutSession, StripePaymentIntent
|
|
|
6
6
|
|
|
7
7
|
import { StripeHelper } from '../../../helpers/StripeHelper';
|
|
8
8
|
import { ExchangePaymentEndpoint } from '../../organization/shared/ExchangePaymentEndpoint';
|
|
9
|
-
import { QueueHandler } from '@stamhoofd/queues';
|
|
10
9
|
|
|
11
10
|
type Params = Record<string, never>;
|
|
12
11
|
class Body extends AutoEncoder {
|
|
@@ -2,13 +2,13 @@ import { AutoEncoderPatchType, Decoder, PatchableArrayAutoEncoder, PatchableArra
|
|
|
2
2
|
import { DecodedRequest, Endpoint, Request, Response } from "@simonbackx/simple-endpoints";
|
|
3
3
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
4
4
|
import { Document, Member, mergeTwoMembers, RateLimiter } from '@stamhoofd/models';
|
|
5
|
-
import {
|
|
5
|
+
import { MemberDetails, MembersBlob, MemberWithRegistrationsBlob } from "@stamhoofd/structures";
|
|
6
6
|
|
|
7
|
+
import { Email } from '@stamhoofd/email';
|
|
7
8
|
import { AuthenticatedStructures } from '../../../helpers/AuthenticatedStructures';
|
|
8
9
|
import { Context } from '../../../helpers/Context';
|
|
9
10
|
import { MemberUserSyncer } from '../../../helpers/MemberUserSyncer';
|
|
10
11
|
import { PatchOrganizationMembersEndpoint } from '../../global/members/PatchOrganizationMembersEndpoint';
|
|
11
|
-
import { Email } from '@stamhoofd/email';
|
|
12
12
|
type Params = Record<string, never>;
|
|
13
13
|
type Query = undefined;
|
|
14
14
|
type Body = PatchableArrayAutoEncoder<MemberWithRegistrationsBlob>
|
|
@@ -60,6 +60,8 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
60
60
|
struct.details.cleanData()
|
|
61
61
|
member.details = struct.details
|
|
62
62
|
|
|
63
|
+
this.throwIfInvalidDetails(member.details);
|
|
64
|
+
|
|
63
65
|
const duplicate = await this.checkDuplicate(member, struct.details.securityCode)
|
|
64
66
|
if (duplicate) {
|
|
65
67
|
addedMembers.push(duplicate)
|
|
@@ -95,8 +97,10 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
95
97
|
field: "details"
|
|
96
98
|
})
|
|
97
99
|
}
|
|
100
|
+
|
|
98
101
|
member.details.patchOrPut(struct.details)
|
|
99
|
-
member.details.cleanData()
|
|
102
|
+
member.details.cleanData();
|
|
103
|
+
this.throwIfInvalidDetails(member.details);
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
if (!member.details) {
|
|
@@ -184,7 +188,7 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
184
188
|
code: "invalid_field",
|
|
185
189
|
field: 'details.securityCode',
|
|
186
190
|
message: "Invalid security code",
|
|
187
|
-
human: Context.i18n.$t(
|
|
191
|
+
human: Context.i18n.$t('49753d6a-7ca4-4145-8024-0be05a9ab063'),
|
|
188
192
|
statusCode: 400
|
|
189
193
|
})
|
|
190
194
|
}
|
|
@@ -206,4 +210,22 @@ export class PatchUserMembersEndpoint extends Endpoint<Params, Query, Body, Resp
|
|
|
206
210
|
return duplicate
|
|
207
211
|
}
|
|
208
212
|
}
|
|
213
|
+
|
|
214
|
+
private throwIfInvalidDetails(details: MemberDetails) {
|
|
215
|
+
if(details.firstName.length < 2) {
|
|
216
|
+
throw new SimpleError({
|
|
217
|
+
code: "invalid_field",
|
|
218
|
+
message: "Voornaam is te kort",
|
|
219
|
+
field: "firstName"
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if(details.lastName.length < 2) {
|
|
224
|
+
throw new SimpleError({
|
|
225
|
+
code: "invalid_field",
|
|
226
|
+
message: "Achternaam is te kort",
|
|
227
|
+
field: "lastName"
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
209
231
|
}
|