@stamhoofd/backend 2.42.0 → 2.42.2

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.42.0",
3
+ "version": "2.42.2",
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.42.0",
40
- "@stamhoofd/backend-middleware": "2.42.0",
41
- "@stamhoofd/email": "2.42.0",
42
- "@stamhoofd/models": "2.42.0",
43
- "@stamhoofd/queues": "2.42.0",
44
- "@stamhoofd/sql": "2.42.0",
45
- "@stamhoofd/structures": "2.42.0",
46
- "@stamhoofd/utility": "2.42.0",
39
+ "@stamhoofd/backend-i18n": "2.42.2",
40
+ "@stamhoofd/backend-middleware": "2.42.2",
41
+ "@stamhoofd/email": "2.42.2",
42
+ "@stamhoofd/models": "2.42.2",
43
+ "@stamhoofd/queues": "2.42.2",
44
+ "@stamhoofd/sql": "2.42.2",
45
+ "@stamhoofd/structures": "2.42.2",
46
+ "@stamhoofd/utility": "2.42.2",
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": "fa8a47af38cc79eecaf7934cd1b15d5b20fd3e2d"
63
+ "gitHead": "efb340b03cda94c2388d8b761b11de54aebc61eb"
64
64
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
1
  import { Decoder } from '@simonbackx/simple-encoding';
3
2
  import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
4
3
  import { SimpleError } from '@simonbackx/simple-errors';
@@ -482,6 +482,10 @@ export class AdminPermissionChecker {
482
482
  }
483
483
 
484
484
  const { balanceItems } = await Payment.loadBalanceItems(payments);
485
+
486
+ if (balanceItems.length === 0) {
487
+ return false;
488
+ }
485
489
  return await this.canAccessBalanceItems(balanceItems, permissionLevel);
486
490
  }
487
491
 
@@ -501,7 +505,7 @@ export class AdminPermissionChecker {
501
505
  }
502
506
 
503
507
  if (balanceItems.length === 0) {
504
- return false;
508
+ return true;
505
509
  }
506
510
 
507
511
  const organizationId = balanceItems[0].organizationId;
@@ -31,8 +31,8 @@ export class AuthenticatedStructures {
31
31
  // Note: permission checking is moved here for performacne to avoid loading the data multiple times
32
32
  if (!(await Context.auth.canAccessBalanceItems(balanceItems, PermissionLevel.Read, { registrations, orders }))) {
33
33
  throw new SimpleError({
34
- code: 'not_found',
35
- message: 'Payment not found',
34
+ code: 'permission_denied',
35
+ message: 'Permission denied',
36
36
  human: 'Je hebt geen toegang tot deze betaling',
37
37
  });
38
38
  }
@@ -24,7 +24,7 @@ async function randomBytes(size: number): Promise<Buffer> {
24
24
  export class FileCache {
25
25
  static async getWriteStream(extension: '.xlsx'): Promise<{
26
26
  file: string;
27
- stream: WritableStream;
27
+ stream: Writable;
28
28
  }> {
29
29
  if (!STAMHOOFD.CACHE_PATH) {
30
30
  throw new SimpleError({
@@ -51,7 +51,7 @@ export class FileCache {
51
51
 
52
52
  return {
53
53
  file: path + '/' + fileName,
54
- stream: Writable.toWeb(s),
54
+ stream: s,
55
55
  };
56
56
  }
57
57