@stamhoofd/backend 2.78.3 → 2.79.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/.env.ci.json +19 -8
- package/index.ts +8 -1
- package/package.json +13 -12
- package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +1 -1
- package/src/endpoints/auth/CreateAdminEndpoint.ts +1 -1
- package/src/endpoints/auth/CreateTokenEndpoint.ts +1 -1
- package/src/endpoints/auth/ForgotPasswordEndpoint.ts +1 -1
- package/src/endpoints/auth/PatchUserEndpoint.ts +1 -1
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +2686 -0
- package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +206 -20
- package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +9 -21
- package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +1 -1
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +2 -2
- package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +15 -14
- package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +3 -23
- package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +12 -0
- package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +2 -3
- package/src/endpoints/organization/dashboard/payments/PatchBalanceItemsEndpoint.ts +2 -2
- package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +164 -0
- package/src/helpers/AdminPermissionChecker.ts +41 -2
- package/src/helpers/AuthenticatedStructures.ts +77 -20
- package/src/helpers/ForwardHandler.test.ts +16 -5
- package/src/helpers/ForwardHandler.ts +21 -9
- package/src/helpers/MemberUserSyncer.test.ts +822 -0
- package/src/helpers/MemberUserSyncer.ts +137 -108
- package/src/helpers/TagHelper.ts +3 -3
- package/src/seeds/1734596144-fill-previous-period-id.ts +1 -1
- package/src/seeds/1741008870-fix-auditlog-description.ts +50 -0
- package/src/seeds/1741011468-fix-auditlog-description-uft16.ts +88 -0
- package/src/services/FileSignService.ts +1 -1
- package/src/services/PlatformMembershipService.ts +7 -2
- package/src/services/SSOService.ts +1 -1
- package/tests/e2e/register.test.ts +2 -2
package/.env.ci.json
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"environment": "test",
|
|
3
3
|
"domains": {
|
|
4
|
-
"dashboard": "dashboard.stamhoofd
|
|
5
|
-
"
|
|
6
|
-
"": "stamhoofd
|
|
7
|
-
"BE": "
|
|
8
|
-
"NL": "
|
|
4
|
+
"dashboard": "dashboard.stamhoofd",
|
|
5
|
+
"marketing": {
|
|
6
|
+
"": "www.be.stamhoofd",
|
|
7
|
+
"BE": "www.be.stamhoofd",
|
|
8
|
+
"NL": "www.nl.stamhoofd"
|
|
9
9
|
},
|
|
10
|
-
"webshop":
|
|
11
|
-
|
|
10
|
+
"webshop": {
|
|
11
|
+
"": "shop.be.stamhoofd",
|
|
12
|
+
"BE": "shop.be.stamhoofd",
|
|
13
|
+
"NL": "shop.nl.stamhoofd"
|
|
14
|
+
},
|
|
15
|
+
"api": "api.stamhoofd",
|
|
16
|
+
"rendererApi": "renderer.stamhoofd",
|
|
17
|
+
|
|
18
|
+
"defaultTransactionalEmail": {
|
|
19
|
+
"": "stamhoofd.be"
|
|
20
|
+
},
|
|
21
|
+
|
|
12
22
|
"defaultBroadcastEmail": {
|
|
13
23
|
"": "stamhoofd.email"
|
|
14
|
-
}
|
|
24
|
+
},
|
|
25
|
+
"webshopCname": "shop.stamhoofd"
|
|
15
26
|
},
|
|
16
27
|
|
|
17
28
|
"PORT": 9091,
|
package/index.ts
CHANGED
|
@@ -60,10 +60,13 @@ const start = async () => {
|
|
|
60
60
|
await UniqueUserService.check();
|
|
61
61
|
|
|
62
62
|
// Init platform shared struct: otherwise permissions won't work with missing responsibilities
|
|
63
|
-
|
|
63
|
+
console.log('Loading platform...');
|
|
64
|
+
await Platform.loadCaches();
|
|
64
65
|
|
|
65
66
|
const router = new Router();
|
|
66
67
|
|
|
68
|
+
console.log('Loading endpoints...');
|
|
69
|
+
|
|
67
70
|
// Note: we should load endpoints one by once to have a reliable order of url matching
|
|
68
71
|
await router.loadAllEndpoints(__dirname + '/src/endpoints/global/*');
|
|
69
72
|
await router.loadAllEndpoints(__dirname + '/src/endpoints/admin/*');
|
|
@@ -76,6 +79,7 @@ const start = async () => {
|
|
|
76
79
|
|
|
77
80
|
router.endpoints.push(new CORSPreflightEndpoint());
|
|
78
81
|
|
|
82
|
+
console.log('Creating router...');
|
|
79
83
|
const routerServer = new RouterServer(router);
|
|
80
84
|
routerServer.verbose = false;
|
|
81
85
|
|
|
@@ -104,6 +108,8 @@ const start = async () => {
|
|
|
104
108
|
// Add CORS headers
|
|
105
109
|
routerServer.addResponseMiddleware(CORSMiddleware);
|
|
106
110
|
|
|
111
|
+
console.log('Loading loaders...');
|
|
112
|
+
|
|
107
113
|
// Register Excel loaders
|
|
108
114
|
await import('./src/excel-loaders/members');
|
|
109
115
|
await import('./src/excel-loaders/payments');
|
|
@@ -115,6 +121,7 @@ const start = async () => {
|
|
|
115
121
|
await import('./src/email-recipient-loaders/orders');
|
|
116
122
|
await import('./src/email-recipient-loaders/receivable-balances');
|
|
117
123
|
|
|
124
|
+
console.log('Opening port...');
|
|
118
125
|
routerServer.listen(STAMHOOFD.PORT ?? 9090);
|
|
119
126
|
|
|
120
127
|
const hrend = process.hrtime(bootTime);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stamhoofd/backend",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.79.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"clear": "rm -rf ./dist",
|
|
17
17
|
"start": "yarn build && node --enable-source-maps ./dist/index.js",
|
|
18
18
|
"test": "jest --runInBand",
|
|
19
|
+
"test:build": "yarn -s build:full && yarn -s test",
|
|
19
20
|
"test:reset": "yarn build:full && jest --runInBand",
|
|
20
21
|
"migrations": "yarn build:full && node ./dist/migrations.js",
|
|
21
22
|
"lint": "eslint"
|
|
@@ -33,18 +34,18 @@
|
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@bwip-js/node": "^4.5.1",
|
|
35
36
|
"@mollie/api-client": "3.7.0",
|
|
36
|
-
"@simonbackx/simple-database": "1.29.
|
|
37
|
-
"@simonbackx/simple-encoding": "2.
|
|
37
|
+
"@simonbackx/simple-database": "1.29.1",
|
|
38
|
+
"@simonbackx/simple-encoding": "2.21.0",
|
|
38
39
|
"@simonbackx/simple-endpoints": "1.19.1",
|
|
39
40
|
"@simonbackx/simple-logging": "^1.0.1",
|
|
40
|
-
"@stamhoofd/backend-i18n": "2.
|
|
41
|
-
"@stamhoofd/backend-middleware": "2.
|
|
42
|
-
"@stamhoofd/email": "2.
|
|
43
|
-
"@stamhoofd/models": "2.
|
|
44
|
-
"@stamhoofd/queues": "2.
|
|
45
|
-
"@stamhoofd/sql": "2.
|
|
46
|
-
"@stamhoofd/structures": "2.
|
|
47
|
-
"@stamhoofd/utility": "2.
|
|
41
|
+
"@stamhoofd/backend-i18n": "2.79.0",
|
|
42
|
+
"@stamhoofd/backend-middleware": "2.79.0",
|
|
43
|
+
"@stamhoofd/email": "2.79.0",
|
|
44
|
+
"@stamhoofd/models": "2.79.0",
|
|
45
|
+
"@stamhoofd/queues": "2.79.0",
|
|
46
|
+
"@stamhoofd/sql": "2.79.0",
|
|
47
|
+
"@stamhoofd/structures": "2.79.0",
|
|
48
|
+
"@stamhoofd/utility": "2.79.0",
|
|
48
49
|
"archiver": "^7.0.1",
|
|
49
50
|
"aws-sdk": "^2.885.0",
|
|
50
51
|
"axios": "1.6.8",
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"publishConfig": {
|
|
65
66
|
"access": "public"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "1ba7d80ded3676ecdc63741f3e8972bd378b5ea6"
|
|
68
69
|
}
|
|
@@ -51,7 +51,7 @@ export class PatchOrganizationsEndpoint extends Endpoint<Params, Query, Body, Re
|
|
|
51
51
|
throw new SimpleError({ code: 'not_found', message: 'Organization not found', statusCode: 404 });
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if (organization.id === (await Platform.
|
|
54
|
+
if (organization.id === (await Platform.getSharedPrivateStruct()).membershipOrganizationId) {
|
|
55
55
|
throw new SimpleError({
|
|
56
56
|
code: 'cannot_delete_membership_organization',
|
|
57
57
|
message: 'Cannot delete membership organization',
|
|
@@ -101,7 +101,7 @@ export class CreateAdminEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
101
101
|
const platformName = ((await Platform.getSharedStruct()).config.name);
|
|
102
102
|
|
|
103
103
|
const name = organization?.name ?? platformName;
|
|
104
|
-
const what = organization ?
|
|
104
|
+
const what = organization ? $t('de vereniging {name} op {platform}', { name, platform: platformName }) : platformName;
|
|
105
105
|
|
|
106
106
|
const emailTo = admin.getEmailTo();
|
|
107
107
|
const email: string = typeof emailTo === 'string' ? emailTo : emailTo[0]?.email;
|
|
@@ -85,7 +85,7 @@ export class CreateTokenEndpoint extends Endpoint<Params, Query, Body, ResponseB
|
|
|
85
85
|
request.request.request?.setTimeout(30 * 1000);
|
|
86
86
|
|
|
87
87
|
if (STAMHOOFD.userMode === 'platform') {
|
|
88
|
-
const platform = await Platform.
|
|
88
|
+
const platform = await Platform.getSharedPrivateStruct();
|
|
89
89
|
const config = platform.config.loginMethods.get(LoginMethod.Password);
|
|
90
90
|
if (!config) {
|
|
91
91
|
throw new SimpleError({
|
|
@@ -31,7 +31,7 @@ export class ForgotPasswordEndpoint extends Endpoint<Params, Query, Body, Respon
|
|
|
31
31
|
const organization = await Context.setOptionalOrganizationScope();
|
|
32
32
|
|
|
33
33
|
if (STAMHOOFD.userMode === 'platform') {
|
|
34
|
-
const platform = await Platform.
|
|
34
|
+
const platform = await Platform.getSharedPrivateStruct();
|
|
35
35
|
const config = platform.config.loginMethods.get(LoginMethod.Password);
|
|
36
36
|
if (!config) {
|
|
37
37
|
throw new SimpleError({
|
|
@@ -136,7 +136,7 @@ export class PatchUserEndpoint extends Endpoint<Params, Query, Body, ResponseBod
|
|
|
136
136
|
|
|
137
137
|
if (editUser.id === user.id && request.body.password) {
|
|
138
138
|
if (STAMHOOFD.userMode === 'platform') {
|
|
139
|
-
const platform = await Platform.
|
|
139
|
+
const platform = await Platform.getSharedPrivateStruct();
|
|
140
140
|
const config = platform.config.loginMethods.get(LoginMethod.Password);
|
|
141
141
|
if (!config) {
|
|
142
142
|
throw new SimpleError({
|