@stamhoofd/models 2.78.2 → 2.78.4
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/factories/GroupFactory.d.ts +0 -3
- package/dist/src/factories/GroupFactory.d.ts.map +1 -1
- package/dist/src/factories/GroupFactory.js +0 -20
- package/dist/src/factories/GroupFactory.js.map +1 -1
- package/dist/src/factories/MemberFactory.js +2 -2
- package/dist/src/factories/MemberFactory.js.map +1 -1
- package/dist/src/factories/OrganizationFactory.d.ts +1 -0
- package/dist/src/factories/OrganizationFactory.d.ts.map +1 -1
- package/dist/src/factories/OrganizationFactory.js +4 -0
- package/dist/src/factories/OrganizationFactory.js.map +1 -1
- package/dist/src/factories/OrganizationTagFactory.d.ts +10 -0
- package/dist/src/factories/OrganizationTagFactory.d.ts.map +1 -0
- package/dist/src/factories/OrganizationTagFactory.js +23 -0
- package/dist/src/factories/OrganizationTagFactory.js.map +1 -0
- package/dist/src/factories/RegistrationFactory.d.ts +6 -2
- package/dist/src/factories/RegistrationFactory.d.ts.map +1 -1
- package/dist/src/factories/RegistrationFactory.js +6 -9
- package/dist/src/factories/RegistrationFactory.js.map +1 -1
- package/dist/src/factories/UserFactory.d.ts.map +1 -1
- package/dist/src/factories/UserFactory.js +7 -4
- package/dist/src/factories/UserFactory.js.map +1 -1
- package/dist/src/factories/index.d.ts +15 -0
- package/dist/src/factories/index.d.ts.map +1 -0
- package/dist/src/factories/index.js +18 -0
- package/dist/src/factories/index.js.map +1 -0
- package/dist/src/helpers/EmailBuilder.d.ts +2 -1
- package/dist/src/helpers/EmailBuilder.d.ts.map +1 -1
- package/dist/src/helpers/EmailBuilder.js +36 -4
- package/dist/src/helpers/EmailBuilder.js.map +1 -1
- package/dist/src/index.d.ts +2 -14
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -14
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/Email.d.ts.map +1 -1
- package/dist/src/models/Email.js +39 -38
- package/dist/src/models/Email.js.map +1 -1
- package/dist/src/models/Email.test.d.ts +2 -0
- package/dist/src/models/Email.test.d.ts.map +1 -0
- package/dist/src/models/Email.test.js +461 -0
- package/dist/src/models/Email.test.js.map +1 -0
- package/dist/src/models/Member.d.ts.map +1 -1
- package/dist/src/models/Member.js +14 -8
- package/dist/src/models/Member.js.map +1 -1
- package/dist/src/models/Organization.d.ts +0 -7
- package/dist/src/models/Organization.d.ts.map +1 -1
- package/dist/src/models/Organization.js +0 -11
- package/dist/src/models/Organization.js.map +1 -1
- package/dist/tests/jest.global.setup.d.ts.map +1 -1
- package/dist/tests/jest.global.setup.js +11 -1
- package/dist/tests/jest.global.setup.js.map +1 -1
- package/dist/tests/jest.setup.js +14 -0
- package/dist/tests/jest.setup.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/factories/GroupFactory.ts +0 -21
- package/src/factories/MemberFactory.ts +2 -2
- package/src/factories/OrganizationFactory.ts +5 -0
- package/src/factories/OrganizationTagFactory.ts +23 -0
- package/src/factories/RegistrationFactory.ts +15 -6
- package/src/factories/UserFactory.ts +7 -4
- package/src/factories/index.ts +14 -0
- package/src/helpers/EmailBuilder.ts +43 -6
- package/src/index.ts +4 -15
- package/src/models/Email.test.ts +533 -0
- package/src/models/Email.ts +42 -42
- package/src/models/Member.ts +17 -9
- package/src/models/Organization.ts +0 -14
package/src/models/Member.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { column, Database, ManyToManyRelation, ManyToOneRelation, OneToManyRelation } from '@simonbackx/simple-database';
|
|
2
2
|
import { QueryableModel, SQL } from '@stamhoofd/sql';
|
|
3
|
-
import { MemberDetails, RegistrationWithMember as RegistrationWithMemberStruct, TinyMember } from '@stamhoofd/structures';
|
|
3
|
+
import { MemberDetails, NationalRegisterNumberOptOut, RegistrationWithMember as RegistrationWithMemberStruct, TinyMember } from '@stamhoofd/structures';
|
|
4
4
|
import { Formatter } from '@stamhoofd/utility';
|
|
5
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
6
|
|
|
@@ -353,29 +353,37 @@ export class Member extends QueryableModel {
|
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
async isSafeToMergeDuplicateWithoutSecurityCode() {
|
|
356
|
-
|
|
357
|
-
const responsibilities = await MemberResponsibilityRecord.where({ memberId: this.id }, { limit: 1 });
|
|
358
|
-
if (responsibilities.length > 0) {
|
|
356
|
+
if (this.details.recordAnswers.size > 0) {
|
|
359
357
|
return false;
|
|
360
358
|
}
|
|
361
359
|
|
|
362
|
-
if (this.details.
|
|
360
|
+
if (this.details.parents.length > 0) {
|
|
363
361
|
return false;
|
|
364
362
|
}
|
|
365
363
|
|
|
366
|
-
if (this.details.
|
|
364
|
+
if (this.details.emergencyContacts.length > 0) {
|
|
367
365
|
return false;
|
|
368
366
|
}
|
|
369
367
|
|
|
370
|
-
if (this.details.
|
|
368
|
+
if (this.details.uitpasNumber) {
|
|
371
369
|
return false;
|
|
372
370
|
}
|
|
373
371
|
|
|
374
|
-
if (this.details.
|
|
372
|
+
if (this.details.nationalRegisterNumber !== null && this.details.nationalRegisterNumber !== NationalRegisterNumberOptOut) {
|
|
375
373
|
return false;
|
|
376
374
|
}
|
|
377
375
|
|
|
378
|
-
if (this.details.
|
|
376
|
+
if (this.details.requiresFinancialSupport !== null) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (this.details.address || this.details.phone || this.details.email || this.details.alternativeEmails.length > 0 || this.details.unverifiedAddresses.length > 0 || this.details.unverifiedPhones.length > 0 || this.details.unverifiedEmails.length > 0) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// If responsibilities: not safe
|
|
385
|
+
const responsibilities = await MemberResponsibilityRecord.where({ memberId: this.id }, { limit: 1 });
|
|
386
|
+
if (responsibilities.length > 0) {
|
|
379
387
|
return false;
|
|
380
388
|
}
|
|
381
389
|
|
|
@@ -176,20 +176,6 @@ export class Organization extends QueryableModel {
|
|
|
176
176
|
return this.fromRow(rows[0][this.table]);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
* Get an Organization by looking at the host of a request
|
|
181
|
-
* Format is 2331c59a-0cbe-4279-871c-ea9d0474cd54.api.stamhoofd.app
|
|
182
|
-
* + switch country if needed
|
|
183
|
-
*/
|
|
184
|
-
static async getFromRequest(request: DecodedRequest<any, any, any>): Promise<Organization> {
|
|
185
|
-
const organization = await Organization.fromApiHost(request.host);
|
|
186
|
-
|
|
187
|
-
const i18n = I18n.fromRequest(request);
|
|
188
|
-
i18n.switchToLocale({ country: organization.address.country });
|
|
189
|
-
|
|
190
|
-
return organization;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
179
|
/**
|
|
194
180
|
* Get an Organization by looking at the host of a request
|
|
195
181
|
* Format is 2331c59a-0cbe-4279-871c-ea9d0474cd54.api.stamhoofd.app
|