@stamhoofd/models 2.92.0 → 2.93.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/dist/src/helpers/EmailBuilder.d.ts +1 -0
- package/dist/src/helpers/EmailBuilder.d.ts.map +1 -1
- package/dist/src/helpers/EmailBuilder.js +5 -3
- package/dist/src/helpers/EmailBuilder.js.map +1 -1
- package/dist/src/migrations/1755789797-email-counts-errors.sql +7 -0
- package/dist/src/migrations/1755789798-email-recipient-errors.sql +2 -0
- package/dist/src/migrations/1756115313-email-recipient-ids-and-errors.sql +10 -0
- package/dist/src/migrations/1756115314-email-recipient-email-optional.sql +2 -0
- package/dist/src/migrations/1756115315-email-recipients-count.sql +3 -0
- package/dist/src/migrations/1756115316-email-cached-counts.sql +4 -0
- package/dist/src/models/Email.d.ts +62 -2
- package/dist/src/models/Email.d.ts.map +1 -1
- package/dist/src/models/Email.js +555 -194
- package/dist/src/models/Email.js.map +1 -1
- package/dist/src/models/Email.test.js +151 -43
- package/dist/src/models/Email.test.js.map +1 -1
- package/dist/src/models/EmailRecipient.d.ts +31 -1
- package/dist/src/models/EmailRecipient.d.ts.map +1 -1
- package/dist/src/models/EmailRecipient.js +53 -2
- package/dist/src/models/EmailRecipient.js.map +1 -1
- package/package.json +2 -2
- package/src/helpers/EmailBuilder.ts +6 -3
- package/src/migrations/1755789797-email-counts-errors.sql +7 -0
- package/src/migrations/1755789798-email-recipient-errors.sql +2 -0
- package/src/migrations/1756115313-email-recipient-ids-and-errors.sql +10 -0
- package/src/migrations/1756115314-email-recipient-email-optional.sql +2 -0
- package/src/migrations/1756115315-email-recipients-count.sql +3 -0
- package/src/migrations/1756115316-email-cached-counts.sql +4 -0
- package/src/models/Email.test.ts +165 -44
- package/src/models/Email.ts +636 -207
- package/src/models/EmailRecipient.ts +46 -2
|
@@ -4,6 +4,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
4
4
|
|
|
5
5
|
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
6
6
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
7
|
+
import { SimpleErrors } from '@simonbackx/simple-errors';
|
|
7
8
|
|
|
8
9
|
export class EmailRecipient extends QueryableModel {
|
|
9
10
|
static table = 'email_recipients';
|
|
@@ -38,15 +39,58 @@ export class EmailRecipient extends QueryableModel {
|
|
|
38
39
|
@column({ type: 'string', nullable: true })
|
|
39
40
|
lastName: string | null = null;
|
|
40
41
|
|
|
41
|
-
@column({ type: 'string' })
|
|
42
|
-
email: string;
|
|
42
|
+
@column({ type: 'string', nullable: true })
|
|
43
|
+
email: string | null = null;
|
|
43
44
|
|
|
44
45
|
@column({ type: 'json', decoder: new ArrayDecoder(Replacement) })
|
|
45
46
|
replacements: Replacement[] = [];
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated
|
|
50
|
+
* Legacy field
|
|
51
|
+
*/
|
|
47
52
|
@column({ type: 'string', nullable: true })
|
|
48
53
|
failErrorMessage: string | null = null;
|
|
49
54
|
|
|
55
|
+
@column({ type: 'json', nullable: true, decoder: SimpleErrors })
|
|
56
|
+
failError: SimpleErrors | null = null;
|
|
57
|
+
|
|
58
|
+
@column({ type: 'string', nullable: true })
|
|
59
|
+
organizationId: string | null = null;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* When set, the member will be ablse to see this message in the member portal.
|
|
63
|
+
*/
|
|
64
|
+
@column({ type: 'string', nullable: true })
|
|
65
|
+
memberId: string | null = null;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* When set, the user will be able to see this message in the member portal.
|
|
69
|
+
*/
|
|
70
|
+
@column({ type: 'string', nullable: true })
|
|
71
|
+
userId: string | null = null;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set when the email was send, but we received a hard bounce for this specific email
|
|
75
|
+
* Contains the full output we received in the bounce
|
|
76
|
+
*/
|
|
77
|
+
@column({ type: 'string', nullable: true })
|
|
78
|
+
hardBounceError: string | null = null;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set when the email was send, but we received a soft bounce for this specific email
|
|
82
|
+
* Contains the full output we received in the bounce
|
|
83
|
+
*/
|
|
84
|
+
@column({ type: 'string', nullable: true })
|
|
85
|
+
softBounceError: string | null = null;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Set when the email was send, but was marked as spam.
|
|
89
|
+
* The error message contains any relevant info we received from our provider. E.g. type of spam (virus, fraud, abuse...)
|
|
90
|
+
*/
|
|
91
|
+
@column({ type: 'string', nullable: true })
|
|
92
|
+
spamComplaintError: string | null = null;
|
|
93
|
+
|
|
50
94
|
@column({ type: 'integer' })
|
|
51
95
|
failCount = 0;
|
|
52
96
|
|