@stamhoofd/models 2.147.0 → 2.149.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/factories/OrganizationFactory.d.ts.map +1 -1
- package/dist/factories/OrganizationFactory.js.map +1 -1
- package/dist/migrations/1787140000-users-language.sql +2 -0
- package/dist/migrations/1787140001-organizations-language.sql +2 -0
- package/dist/migrations/1787140002-platform-language.sql +2 -0
- package/dist/migrations/1787763657-organization-languages.sql +1 -0
- package/dist/migrations/1788194373-settlements-sync-errors.sql +1 -0
- package/dist/models/BalanceItem.d.ts +1 -2
- package/dist/models/BalanceItem.d.ts.map +1 -1
- package/dist/models/BalanceItem.js +4 -4
- package/dist/models/BalanceItem.js.map +1 -1
- package/dist/models/DocumentTemplate.d.ts.map +1 -1
- package/dist/models/DocumentTemplate.js +5 -1
- package/dist/models/DocumentTemplate.js.map +1 -1
- package/dist/models/Email.d.ts +5 -2
- package/dist/models/Email.d.ts.map +1 -1
- package/dist/models/Email.js +27 -8
- package/dist/models/Email.js.map +1 -1
- package/dist/models/Organization.d.ts +2 -0
- package/dist/models/Organization.d.ts.map +1 -1
- package/dist/models/Organization.js +7 -0
- package/dist/models/Organization.js.map +1 -1
- package/dist/models/Platform.d.ts +3 -0
- package/dist/models/Platform.d.ts.map +1 -1
- package/dist/models/Platform.js +5 -0
- package/dist/models/Platform.js.map +1 -1
- package/dist/models/Settlement.d.ts +6 -0
- package/dist/models/Settlement.d.ts.map +1 -1
- package/dist/models/Settlement.js +10 -0
- package/dist/models/Settlement.js.map +1 -1
- package/dist/models/User.d.ts +4 -0
- package/dist/models/User.d.ts.map +1 -1
- package/dist/models/User.js +9 -0
- package/dist/models/User.js.map +1 -1
- package/package.json +6 -6
- package/src/factories/OrganizationFactory.ts +1 -0
- package/src/migrations/1787140000-users-language.sql +2 -0
- package/src/migrations/1787140001-organizations-language.sql +2 -0
- package/src/migrations/1787140002-platform-language.sql +2 -0
- package/src/migrations/1787763657-organization-languages.sql +1 -0
- package/src/migrations/1788194373-settlements-sync-errors.sql +1 -0
- package/src/models/BalanceItem.ts +4 -5
- package/src/models/DocumentTemplate.ts +6 -1
- package/src/models/Email.ts +26 -9
- package/src/models/Organization.ts +6 -0
- package/src/models/Platform.ts +5 -0
- package/src/models/Settlement.ts +9 -0
- package/src/models/User.ts +10 -1
package/src/models/Platform.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { QueueHandler } from '@stamhoofd/queues';
|
|
|
4
4
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
5
5
|
import { AuditLogReplacementDependencies, PlatformConfig, PlatformPrivateConfig, PlatformServerConfig, Platform as PlatformStruct } from '@stamhoofd/structures';
|
|
6
6
|
import { uuidToName } from '@stamhoofd/structures/helpers/uuidToName.js';
|
|
7
|
+
import type { Language } from '@stamhoofd/types/Language';
|
|
7
8
|
import { deepFreeze } from '@stamhoofd/utility';
|
|
8
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
10
|
import { RegistrationPeriod } from './RegistrationPeriod.js';
|
|
@@ -48,6 +49,10 @@ export class Platform extends QueryableModel {
|
|
|
48
49
|
@column({ type: 'string', nullable: true })
|
|
49
50
|
domain: string | null = null;
|
|
50
51
|
|
|
52
|
+
/** Null for multi-language platforms. */
|
|
53
|
+
@column({ type: 'string', nullable: true })
|
|
54
|
+
language: Language | null = null;
|
|
55
|
+
|
|
51
56
|
@column({ type: 'json', decoder: PlatformConfig })
|
|
52
57
|
config: PlatformConfig = PlatformConfig.create({});
|
|
53
58
|
|
package/src/models/Settlement.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { column } from '@simonbackx/simple-database';
|
|
2
|
+
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
2
3
|
import { QueryableModel } from '@stamhoofd/sql';
|
|
3
4
|
import type { PaymentProvider } from '@stamhoofd/structures';
|
|
4
5
|
import { SettlementStatus } from '@stamhoofd/structures/settlements/SettlementStatus.js';
|
|
6
|
+
import { SettlementSyncError } from '@stamhoofd/structures/settlements/SettlementSyncError.js';
|
|
5
7
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -64,6 +66,13 @@ export class Settlement extends QueryableModel {
|
|
|
64
66
|
@column({ type: 'integer' })
|
|
65
67
|
syncFailureCount = 0;
|
|
66
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Errors of the last sync attempt; NULL when it completed without errors. The queryable error
|
|
71
|
+
* queue: `syncErrors IS NOT NULL` lists every payout that needs a look.
|
|
72
|
+
*/
|
|
73
|
+
@column({ type: 'json', decoder: new ArrayDecoder(SettlementSyncError), nullable: true })
|
|
74
|
+
syncErrors: SettlementSyncError[] | null = null;
|
|
75
|
+
|
|
67
76
|
/**
|
|
68
77
|
* amount minus the sum of all stored payment lines, charges and pending fees, cached after
|
|
69
78
|
* every sync. Expected to be 0.
|
package/src/models/User.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { QueryableModel, SQL, SQLJSONNull } from '@stamhoofd/sql';
|
|
|
4
4
|
import type { LoginProviderType, NewUser } from '@stamhoofd/structures';
|
|
5
5
|
import { Permissions, Recipient, Replacement, UserMeta, UserPermissions, User as UserStruct } from '@stamhoofd/structures';
|
|
6
6
|
import argon2 from 'argon2';
|
|
7
|
+
import { Language } from '@stamhoofd/types/Language';
|
|
7
8
|
import { v4 as uuidv4 } from 'uuid';
|
|
8
9
|
|
|
9
10
|
import { SimpleError } from '@simonbackx/simple-errors';
|
|
@@ -40,6 +41,10 @@ export class User extends QueryableModel {
|
|
|
40
41
|
@column({ type: 'string', nullable: true })
|
|
41
42
|
lastName: string | null = null;
|
|
42
43
|
|
|
44
|
+
/** Preferred language. Null falls back to the default language of the platform or tenant. */
|
|
45
|
+
@column({ type: 'string', nullable: true })
|
|
46
|
+
language: Language | null = null;
|
|
47
|
+
|
|
43
48
|
@column({ type: 'string' })
|
|
44
49
|
email: string;
|
|
45
50
|
|
|
@@ -113,6 +118,7 @@ export class User extends QueryableModel {
|
|
|
113
118
|
firstName: this.firstName,
|
|
114
119
|
lastName: this.lastName,
|
|
115
120
|
email: this.email,
|
|
121
|
+
language: this.language,
|
|
116
122
|
replacements: [
|
|
117
123
|
...replacements,
|
|
118
124
|
Replacement.create({
|
|
@@ -440,7 +446,7 @@ export class User extends QueryableModel {
|
|
|
440
446
|
|
|
441
447
|
static async createInvited(
|
|
442
448
|
organization: Organization | null,
|
|
443
|
-
data: { firstName: string | null; lastName: string | null; email: string; allowPlatform?: boolean },
|
|
449
|
+
data: { firstName: string | null; lastName: string | null; email: string; language?: Language | null; allowPlatform?: boolean },
|
|
444
450
|
): Promise<User | undefined> {
|
|
445
451
|
const {
|
|
446
452
|
email,
|
|
@@ -459,6 +465,7 @@ export class User extends QueryableModel {
|
|
|
459
465
|
user.verified = false;
|
|
460
466
|
user.firstName = firstName;
|
|
461
467
|
user.lastName = lastName;
|
|
468
|
+
user.language = data.language ?? null;
|
|
462
469
|
|
|
463
470
|
try {
|
|
464
471
|
await user.save();
|
|
@@ -507,6 +514,7 @@ export class User extends QueryableModel {
|
|
|
507
514
|
user.verified = false;
|
|
508
515
|
user.firstName = firstName;
|
|
509
516
|
user.lastName = lastName;
|
|
517
|
+
user.language = data.language;
|
|
510
518
|
|
|
511
519
|
try {
|
|
512
520
|
await user.save();
|
|
@@ -630,6 +638,7 @@ export class User extends QueryableModel {
|
|
|
630
638
|
memberId: this.memberId,
|
|
631
639
|
organizationId: this.organizationId,
|
|
632
640
|
lastActiveAt: this.lastActiveAt,
|
|
641
|
+
language: this.language,
|
|
633
642
|
});
|
|
634
643
|
}
|
|
635
644
|
|