@stamhoofd/backend 2.43.0 → 2.43.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.43.
|
|
3
|
+
"version": "2.43.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.43.
|
|
40
|
-
"@stamhoofd/backend-middleware": "2.43.
|
|
41
|
-
"@stamhoofd/email": "2.43.
|
|
42
|
-
"@stamhoofd/models": "2.43.
|
|
43
|
-
"@stamhoofd/queues": "2.43.
|
|
44
|
-
"@stamhoofd/sql": "2.43.
|
|
45
|
-
"@stamhoofd/structures": "2.43.
|
|
46
|
-
"@stamhoofd/utility": "2.43.
|
|
39
|
+
"@stamhoofd/backend-i18n": "2.43.2",
|
|
40
|
+
"@stamhoofd/backend-middleware": "2.43.2",
|
|
41
|
+
"@stamhoofd/email": "2.43.2",
|
|
42
|
+
"@stamhoofd/models": "2.43.2",
|
|
43
|
+
"@stamhoofd/queues": "2.43.2",
|
|
44
|
+
"@stamhoofd/sql": "2.43.2",
|
|
45
|
+
"@stamhoofd/structures": "2.43.2",
|
|
46
|
+
"@stamhoofd/utility": "2.43.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": "
|
|
63
|
+
"gitHead": "06abe49aaa20e7baa4ee44b48f4fae33ae30ae3e"
|
|
64
64
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AutoEncoder,
|
|
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
|
-
|
|
75
|
-
|
|
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
|
}
|