@stamhoofd/backend 2.43.0 → 2.43.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.43.0",
3
+ "version": "2.43.1",
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.43.0",
40
- "@stamhoofd/backend-middleware": "2.43.0",
41
- "@stamhoofd/email": "2.43.0",
42
- "@stamhoofd/models": "2.43.0",
43
- "@stamhoofd/queues": "2.43.0",
44
- "@stamhoofd/sql": "2.43.0",
45
- "@stamhoofd/structures": "2.43.0",
46
- "@stamhoofd/utility": "2.43.0",
39
+ "@stamhoofd/backend-i18n": "2.43.1",
40
+ "@stamhoofd/backend-middleware": "2.43.1",
41
+ "@stamhoofd/email": "2.43.1",
42
+ "@stamhoofd/models": "2.43.1",
43
+ "@stamhoofd/queues": "2.43.1",
44
+ "@stamhoofd/sql": "2.43.1",
45
+ "@stamhoofd/structures": "2.43.1",
46
+ "@stamhoofd/utility": "2.43.1",
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": "d5d4b4bedec089c5c6f945577695a410f0bd8a3d"
63
+ "gitHead": "49f9a42eb52688f4f4d417871da7448969623013"
64
64
  }
@@ -1,11 +1,11 @@
1
- import { AutoEncoder, Data, Decoder, EnumDecoder, field, StringDecoder } from '@simonbackx/simple-encoding';
1
+ import { AutoEncoder, Decoder, EnumDecoder, field, StringDecoder } from '@simonbackx/simple-encoding';
2
2
  import { DecodedRequest, Endpoint, Request, Response } from '@simonbackx/simple-endpoints';
3
3
  import { EmailTemplate } from '@stamhoofd/models';
4
4
  import { EmailTemplate as EmailTemplateStruct, EmailTemplateType } from '@stamhoofd/structures';
5
5
 
6
- import { Context } from '../../../../helpers/Context';
7
- import { StringNullableDecoder } from '../../../../decoders/StringNullableDecoder';
8
6
  import { StringArrayDecoder } from '../../../../decoders/StringArrayDecoder';
7
+ import { StringNullableDecoder } from '../../../../decoders/StringNullableDecoder';
8
+ import { Context } from '../../../../helpers/Context';
9
9
 
10
10
  type Params = Record<string, never>;
11
11
  type Body = undefined;
@@ -71,7 +71,16 @@ export class GetEmailTemplatesEndpoint extends Endpoint<Params, Query, Body, Res
71
71
  ? await EmailTemplate.where({ webshopId: request.query.webshopId ?? null, groupId: request.query.groupIds ? { sign: 'IN', value: request.query.groupIds } : null, type: { sign: 'IN', value: types } })
72
72
  : []
73
73
  );
74
- const defaultTemplates = await EmailTemplate.where({ organizationId: null, type: { sign: 'IN', value: types } });
75
- return new Response([...templates, ...defaultTemplates].map(template => EmailTemplateStruct.create(template)));
74
+
75
+ const defaultTemplateTypes = organization ? types.filter(type => type !== EmailTemplateType.SavedMembersEmail) : types;
76
+ const defaultTemplates = await EmailTemplate.where({
77
+ organizationId: null,
78
+ type: {
79
+ sign: 'IN',
80
+ value: defaultTemplateTypes,
81
+ },
82
+ });
83
+
84
+ return new Response(templates.concat(defaultTemplates).map(template => EmailTemplateStruct.create(template)));
76
85
  }
77
86
  }