@stamhoofd/models 2.39.0 → 2.40.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/factories/AddressFactory.d.ts +3 -4
- package/dist/src/factories/AddressFactory.d.ts.map +1 -1
- package/dist/src/factories/AddressFactory.js +13 -13
- package/dist/src/factories/EmergencyContactFactory.d.ts +3 -4
- package/dist/src/factories/EmergencyContactFactory.d.ts.map +1 -1
- package/dist/src/factories/EmergencyContactFactory.js +27 -27
- package/dist/src/factories/EmergencyContactFactory.js.map +1 -1
- package/dist/src/factories/GroupFactory.d.ts +4 -4
- package/dist/src/factories/GroupFactory.d.ts.map +1 -1
- package/dist/src/factories/GroupFactory.js +8 -8
- package/dist/src/factories/GroupFactory.js.map +1 -1
- package/dist/src/factories/MemberFactory.d.ts +4 -4
- package/dist/src/factories/MemberFactory.d.ts.map +1 -1
- package/dist/src/factories/MemberFactory.js +17 -17
- package/dist/src/factories/MemberFactory.js.map +1 -1
- package/dist/src/factories/OrganizationFactory.d.ts +4 -4
- package/dist/src/factories/OrganizationFactory.js +8 -8
- package/dist/src/factories/OrganizationFactory.js.map +1 -1
- package/dist/src/factories/ParentFactory.d.ts +1 -1
- package/dist/src/factories/ParentFactory.js +19 -19
- package/dist/src/factories/ParentFactory.js.map +1 -1
- package/dist/src/factories/RecordFactory.d.ts +2 -3
- package/dist/src/factories/RecordFactory.d.ts.map +1 -1
- package/dist/src/factories/RecordFactory.js +1 -1
- package/dist/src/factories/RecordFactory.js.map +1 -1
- package/dist/src/factories/RegisterCodeFactory.d.ts +2 -2
- package/dist/src/factories/RegisterCodeFactory.d.ts.map +1 -1
- package/dist/src/factories/RegisterCodeFactory.js +2 -2
- package/dist/src/factories/RegistrationFactory.d.ts +3 -3
- package/dist/src/factories/RegistrationFactory.d.ts.map +1 -1
- package/dist/src/factories/RegistrationFactory.js.map +1 -1
- package/dist/src/factories/RegistrationPeriodFactory.d.ts +2 -2
- package/dist/src/factories/RegistrationPeriodFactory.js.map +1 -1
- package/dist/src/factories/UserFactory.d.ts +3 -3
- package/dist/src/factories/UserFactory.d.ts.map +1 -1
- package/dist/src/factories/UserFactory.js +3 -3
- package/dist/src/factories/UserFactory.js.map +1 -1
- package/dist/src/factories/WebshopFactory.d.ts +4 -4
- package/dist/src/factories/WebshopFactory.d.ts.map +1 -1
- package/dist/src/factories/WebshopFactory.js +1 -1
- package/dist/src/factories/WebshopFactory.js.map +1 -1
- package/dist/src/helpers/DNSValidator.d.ts +1 -1
- package/dist/src/helpers/DNSValidator.d.ts.map +1 -1
- package/dist/src/helpers/DNSValidator.js +33 -33
- package/dist/src/helpers/DNSValidator.js.map +1 -1
- package/dist/src/helpers/EmailBuilder.d.ts +10 -10
- package/dist/src/helpers/EmailBuilder.d.ts.map +1 -1
- package/dist/src/helpers/EmailBuilder.js +34 -34
- package/dist/src/helpers/EmailBuilder.js.map +1 -1
- package/dist/src/helpers/GroupBuilder.d.ts.map +1 -1
- package/dist/src/helpers/GroupBuilder.js +57 -57
- package/dist/src/helpers/GroupBuilder.js.map +1 -1
- package/dist/src/helpers/Handlebars.d.ts.map +1 -1
- package/dist/src/helpers/Handlebars.js +29 -29
- package/dist/src/helpers/Handlebars.js.map +1 -1
- package/dist/src/helpers/MemberMerger.d.ts +1 -1
- package/dist/src/helpers/MemberMerger.d.ts.map +1 -1
- package/dist/src/helpers/MemberMerger.js +33 -33
- package/dist/src/helpers/MemberMerger.js.map +1 -1
- package/dist/src/helpers/MemberMerger.test.js +194 -194
- package/dist/src/helpers/MemberMerger.test.js.map +1 -1
- package/dist/src/helpers/RateLimiter.d.ts.map +1 -1
- package/dist/src/helpers/RateLimiter.js +2 -2
- package/dist/src/helpers/RateLimiter.js.map +1 -1
- package/dist/src/helpers/SetupStepsUpdater.d.ts +22 -0
- package/dist/src/helpers/SetupStepsUpdater.d.ts.map +1 -0
- package/dist/src/helpers/SetupStepsUpdater.js +255 -0
- package/dist/src/helpers/SetupStepsUpdater.js.map +1 -0
- package/dist/src/helpers/WebshopCounter.d.ts +1 -1
- package/dist/src/helpers/WebshopCounter.d.ts.map +1 -1
- package/dist/src/helpers/WebshopCounter.js +1 -1
- package/dist/src/helpers/WebshopCounter.js.map +1 -1
- package/dist/src/helpers/WebshopCounter.test.js +6 -6
- package/dist/src/helpers/WebshopCounter.test.js.map +1 -1
- package/dist/src/index.d.ts +20 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/migrations/1605262045-import-postcodes.js +12 -12
- package/dist/src/migrations/1605262046-import-postcodes-nl.js +10 -10
- package/dist/src/models/BalanceItem.d.ts.map +1 -1
- package/dist/src/models/BalanceItem.js +37 -37
- package/dist/src/models/BalanceItem.js.map +1 -1
- package/dist/src/models/BalanceItemPayment.d.ts.map +1 -1
- package/dist/src/models/BalanceItemPayment.js +13 -13
- package/dist/src/models/BalanceItemPayment.js.map +1 -1
- package/dist/src/models/BuckarooPayment.d.ts +1 -1
- package/dist/src/models/BuckarooPayment.d.ts.map +1 -1
- package/dist/src/models/BuckarooPayment.js +5 -5
- package/dist/src/models/BuckarooPayment.js.map +1 -1
- package/dist/src/models/CachedOutstandingBalance.d.ts.map +1 -1
- package/dist/src/models/CachedOutstandingBalance.js +37 -37
- package/dist/src/models/CachedOutstandingBalance.js.map +1 -1
- package/dist/src/models/Document.d.ts +4 -4
- package/dist/src/models/Document.d.ts.map +1 -1
- package/dist/src/models/Document.js +27 -27
- package/dist/src/models/Document.js.map +1 -1
- package/dist/src/models/DocumentTemplate.d.ts +4 -4
- package/dist/src/models/DocumentTemplate.d.ts.map +1 -1
- package/dist/src/models/DocumentTemplate.js +72 -72
- package/dist/src/models/DocumentTemplate.js.map +1 -1
- package/dist/src/models/Email.d.ts.map +1 -1
- package/dist/src/models/Email.js +63 -64
- package/dist/src/models/Email.js.map +1 -1
- package/dist/src/models/EmailRecipient.d.ts.map +1 -1
- package/dist/src/models/EmailRecipient.js +20 -20
- package/dist/src/models/EmailRecipient.js.map +1 -1
- package/dist/src/models/EmailTemplate.d.ts +3 -3
- package/dist/src/models/EmailTemplate.d.ts.map +1 -1
- package/dist/src/models/EmailTemplate.js +16 -16
- package/dist/src/models/EmailTemplate.js.map +1 -1
- package/dist/src/models/EmailVerificationCode.d.ts +2 -2
- package/dist/src/models/EmailVerificationCode.d.ts.map +1 -1
- package/dist/src/models/EmailVerificationCode.js +57 -55
- package/dist/src/models/EmailVerificationCode.js.map +1 -1
- package/dist/src/models/Event.d.ts +2 -2
- package/dist/src/models/Event.d.ts.map +1 -1
- package/dist/src/models/Event.js +15 -15
- package/dist/src/models/Event.js.map +1 -1
- package/dist/src/models/Group.d.ts +3 -1
- package/dist/src/models/Group.d.ts.map +1 -1
- package/dist/src/models/Group.js +46 -35
- package/dist/src/models/Group.js.map +1 -1
- package/dist/src/models/Image.d.ts +1 -1
- package/dist/src/models/Image.d.ts.map +1 -1
- package/dist/src/models/Image.js +26 -26
- package/dist/src/models/Image.js.map +1 -1
- package/dist/src/models/Member.d.ts +8 -8
- package/dist/src/models/Member.d.ts.map +1 -1
- package/dist/src/models/Member.js +60 -60
- package/dist/src/models/Member.js.map +1 -1
- package/dist/src/models/MemberPlatformMembership.d.ts +3 -3
- package/dist/src/models/MemberPlatformMembership.d.ts.map +1 -1
- package/dist/src/models/MemberPlatformMembership.js +26 -26
- package/dist/src/models/MemberPlatformMembership.js.map +1 -1
- package/dist/src/models/MemberResponsibilityRecord.d.ts.map +1 -1
- package/dist/src/models/MemberResponsibilityRecord.js +13 -13
- package/dist/src/models/MemberResponsibilityRecord.js.map +1 -1
- package/dist/src/models/MergedMember.d.ts +3 -3
- package/dist/src/models/MergedMember.d.ts.map +1 -1
- package/dist/src/models/MergedMember.js +19 -19
- package/dist/src/models/MergedMember.js.map +1 -1
- package/dist/src/models/MolliePayment.d.ts +1 -1
- package/dist/src/models/MolliePayment.d.ts.map +1 -1
- package/dist/src/models/MolliePayment.js +5 -5
- package/dist/src/models/MolliePayment.js.map +1 -1
- package/dist/src/models/MollieToken.d.ts.map +1 -1
- package/dist/src/models/MollieToken.js +60 -60
- package/dist/src/models/MollieToken.js.map +1 -1
- package/dist/src/models/OneTimeToken.d.ts +2 -2
- package/dist/src/models/OneTimeToken.d.ts.map +1 -1
- package/dist/src/models/OneTimeToken.js +13 -13
- package/dist/src/models/OneTimeToken.js.map +1 -1
- package/dist/src/models/Order.d.ts +1 -1
- package/dist/src/models/Order.d.ts.map +1 -1
- package/dist/src/models/Order.js +70 -70
- package/dist/src/models/Order.js.map +1 -1
- package/dist/src/models/Organization.d.ts +5 -5
- package/dist/src/models/Organization.d.ts.map +1 -1
- package/dist/src/models/Organization.js +127 -127
- package/dist/src/models/Organization.js.map +1 -1
- package/dist/src/models/OrganizationRegistrationPeriod.d.ts.map +1 -1
- package/dist/src/models/OrganizationRegistrationPeriod.js +15 -15
- package/dist/src/models/OrganizationRegistrationPeriod.js.map +1 -1
- package/dist/src/models/PasswordToken.d.ts +3 -3
- package/dist/src/models/PasswordToken.d.ts.map +1 -1
- package/dist/src/models/PasswordToken.js +17 -17
- package/dist/src/models/PasswordToken.js.map +1 -1
- package/dist/src/models/PayconiqPayment.d.ts +1 -1
- package/dist/src/models/PayconiqPayment.d.ts.map +1 -1
- package/dist/src/models/PayconiqPayment.js +49 -49
- package/dist/src/models/PayconiqPayment.js.map +1 -1
- package/dist/src/models/Payment.d.ts +3 -3
- package/dist/src/models/Payment.d.ts.map +1 -1
- package/dist/src/models/Payment.js +36 -36
- package/dist/src/models/Payment.js.map +1 -1
- package/dist/src/models/Platform.d.ts +2 -2
- package/dist/src/models/Platform.d.ts.map +1 -1
- package/dist/src/models/Platform.js +8 -8
- package/dist/src/models/Platform.js.map +1 -1
- package/dist/src/models/RegisterCode.d.ts +1 -1
- package/dist/src/models/RegisterCode.d.ts.map +1 -1
- package/dist/src/models/RegisterCode.js +11 -11
- package/dist/src/models/RegisterCode.js.map +1 -1
- package/dist/src/models/Registration.d.ts +1 -1
- package/dist/src/models/Registration.d.ts.map +1 -1
- package/dist/src/models/Registration.js +88 -88
- package/dist/src/models/Registration.js.map +1 -1
- package/dist/src/models/RegistrationPeriod.d.ts.map +1 -1
- package/dist/src/models/RegistrationPeriod.js +12 -12
- package/dist/src/models/RegistrationPeriod.js.map +1 -1
- package/dist/src/models/STCredit.d.ts +1 -1
- package/dist/src/models/STCredit.d.ts.map +1 -1
- package/dist/src/models/STCredit.js +12 -12
- package/dist/src/models/STCredit.js.map +1 -1
- package/dist/src/models/STInvoice.d.ts +1 -1
- package/dist/src/models/STInvoice.d.ts.map +1 -1
- package/dist/src/models/STInvoice.js +16 -16
- package/dist/src/models/STInvoice.js.map +1 -1
- package/dist/src/models/STPackage.d.ts +1 -1
- package/dist/src/models/STPackage.d.ts.map +1 -1
- package/dist/src/models/STPackage.js +39 -39
- package/dist/src/models/STPackage.js.map +1 -1
- package/dist/src/models/STPendingInvoice.d.ts +1 -1
- package/dist/src/models/STPendingInvoice.d.ts.map +1 -1
- package/dist/src/models/STPendingInvoice.js +11 -11
- package/dist/src/models/STPendingInvoice.js.map +1 -1
- package/dist/src/models/StripeAccount.d.ts.map +1 -1
- package/dist/src/models/StripeAccount.js +13 -13
- package/dist/src/models/StripeAccount.js.map +1 -1
- package/dist/src/models/StripeCheckoutSession.d.ts +1 -1
- package/dist/src/models/StripeCheckoutSession.d.ts.map +1 -1
- package/dist/src/models/StripeCheckoutSession.js +7 -7
- package/dist/src/models/StripeCheckoutSession.js.map +1 -1
- package/dist/src/models/StripePaymentIntent.d.ts +1 -1
- package/dist/src/models/StripePaymentIntent.d.ts.map +1 -1
- package/dist/src/models/StripePaymentIntent.js +7 -7
- package/dist/src/models/StripePaymentIntent.js.map +1 -1
- package/dist/src/models/Ticket.d.ts +2 -2
- package/dist/src/models/Ticket.d.ts.map +1 -1
- package/dist/src/models/Ticket.js +23 -23
- package/dist/src/models/Ticket.js.map +1 -1
- package/dist/src/models/Token.d.ts +3 -3
- package/dist/src/models/Token.d.ts.map +1 -1
- package/dist/src/models/Token.js +27 -27
- package/dist/src/models/Token.js.map +1 -1
- package/dist/src/models/Token.test.js +11 -11
- package/dist/src/models/UsedRegisterCode.d.ts +1 -1
- package/dist/src/models/UsedRegisterCode.d.ts.map +1 -1
- package/dist/src/models/UsedRegisterCode.js +10 -10
- package/dist/src/models/UsedRegisterCode.js.map +1 -1
- package/dist/src/models/User.d.ts +4 -4
- package/dist/src/models/User.d.ts.map +1 -1
- package/dist/src/models/User.js +53 -51
- package/dist/src/models/User.js.map +1 -1
- package/dist/src/models/UserPermissions.d.ts +3 -3
- package/dist/src/models/UserPermissions.d.ts.map +1 -1
- package/dist/src/models/UserPermissions.js +12 -12
- package/dist/src/models/UserPermissions.js.map +1 -1
- package/dist/src/models/Webshop.d.ts +1 -1
- package/dist/src/models/Webshop.d.ts.map +1 -1
- package/dist/src/models/Webshop.js +23 -23
- package/dist/src/models/Webshop.js.map +1 -1
- package/dist/src/models/WebshopDiscountCode.d.ts +1 -1
- package/dist/src/models/WebshopDiscountCode.d.ts.map +1 -1
- package/dist/src/models/WebshopDiscountCode.js +16 -16
- package/dist/src/models/WebshopDiscountCode.js.map +1 -1
- package/dist/src/models/addresses/City.d.ts.map +1 -1
- package/dist/src/models/addresses/City.js +9 -9
- package/dist/src/models/addresses/City.js.map +1 -1
- package/dist/src/models/addresses/PostalCode.d.ts.map +1 -1
- package/dist/src/models/addresses/PostalCode.js +11 -11
- package/dist/src/models/addresses/PostalCode.js.map +1 -1
- package/dist/src/models/addresses/PostalCode.test.js +22 -22
- package/dist/src/models/addresses/PostalCode.test.js.map +1 -1
- package/dist/src/models/addresses/Province.d.ts.map +1 -1
- package/dist/src/models/addresses/Province.js +5 -5
- package/dist/src/models/addresses/Province.js.map +1 -1
- package/dist/src/models/addresses/Street.d.ts.map +1 -1
- package/dist/src/models/addresses/Street.js +6 -6
- package/dist/src/models/addresses/Street.js.map +1 -1
- package/dist/src/models/index.d.ts +46 -46
- package/dist/src/models/index.d.ts.map +1 -1
- package/dist/src/models/index.js +0 -1
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/structures/OrganizationServerMetaData.d.ts.map +1 -1
- package/dist/src/structures/OrganizationServerMetaData.js +4 -4
- package/dist/src/structures/OrganizationServerMetaData.js.map +1 -1
- package/dist/tests/jest.global.setup.d.ts.map +1 -1
- package/dist/tests/jest.global.setup.js +15 -13
- package/dist/tests/jest.global.setup.js.map +1 -1
- package/dist/tests/jest.setup.js +3 -1
- package/dist/tests/jest.setup.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +3 -3
- package/src/factories/AddressFactory.ts +17 -17
- package/src/factories/EmergencyContactFactory.ts +30 -31
- package/src/factories/GroupFactory.ts +30 -30
- package/src/factories/MemberFactory.ts +41 -38
- package/src/factories/OrganizationFactory.ts +15 -15
- package/src/factories/ParentFactory.ts +24 -24
- package/src/factories/RecordFactory.ts +5 -4
- package/src/factories/RegisterCodeFactory.ts +7 -7
- package/src/factories/RegistrationFactory.ts +16 -16
- package/src/factories/RegistrationPeriodFactory.ts +5 -5
- package/src/factories/UserFactory.ts +20 -19
- package/src/factories/WebshopFactory.ts +14 -14
- package/src/helpers/DNSValidator.ts +89 -84
- package/src/helpers/EmailBuilder.ts +141 -135
- package/src/helpers/GroupBuilder.ts +181 -181
- package/src/helpers/Handlebars.ts +57 -54
- package/src/helpers/MemberMerger.test.ts +702 -702
- package/src/helpers/MemberMerger.ts +83 -77
- package/src/helpers/RateLimiter.ts +25 -27
- package/src/helpers/SetupStepsUpdater.ts +402 -0
- package/src/helpers/WebshopCounter.test.ts +12 -12
- package/src/helpers/WebshopCounter.ts +20 -19
- package/src/index.ts +20 -19
- package/src/migrations/1605262045-import-postcodes.ts +59 -63
- package/src/migrations/1605262046-import-postcodes-nl.ts +41 -43
- package/src/models/BalanceItem.ts +173 -172
- package/src/models/BalanceItemPayment.ts +32 -33
- package/src/models/BuckarooPayment.ts +7 -7
- package/src/models/CachedOutstandingBalance.ts +98 -99
- package/src/models/Document.ts +90 -87
- package/src/models/DocumentTemplate.ts +207 -198
- package/src/models/Email.ts +198 -200
- package/src/models/EmailRecipient.ts +38 -39
- package/src/models/EmailTemplate.ts +36 -37
- package/src/models/EmailVerificationCode.ts +146 -142
- package/src/models/Event.ts +53 -53
- package/src/models/Group.ts +136 -123
- package/src/models/Image.ts +48 -48
- package/src/models/Member.ts +277 -275
- package/src/models/MemberPlatformMembership.ts +71 -71
- package/src/models/MemberResponsibilityRecord.ts +32 -32
- package/src/models/MergedMember.ts +77 -77
- package/src/models/MolliePayment.ts +7 -7
- package/src/models/MollieToken.ts +131 -126
- package/src/models/OneTimeToken.ts +40 -39
- package/src/models/Order.ts +379 -372
- package/src/models/Organization.ts +332 -325
- package/src/models/OrganizationRegistrationPeriod.ts +50 -50
- package/src/models/PasswordToken.ts +42 -42
- package/src/models/PayconiqPayment.ts +80 -76
- package/src/models/Payment.ts +86 -86
- package/src/models/Platform.ts +21 -22
- package/src/models/RegisterCode.ts +26 -26
- package/src/models/Registration.ts +167 -168
- package/src/models/RegistrationPeriod.ts +29 -29
- package/src/models/STCredit.ts +24 -25
- package/src/models/STInvoice.ts +34 -34
- package/src/models/STPackage.ts +143 -136
- package/src/models/STPendingInvoice.ts +26 -26
- package/src/models/StripeAccount.ts +27 -27
- package/src/models/StripeCheckoutSession.ts +10 -10
- package/src/models/StripePaymentIntent.ts +10 -10
- package/src/models/Ticket.ts +51 -52
- package/src/models/Token.test.ts +13 -13
- package/src/models/Token.ts +64 -63
- package/src/models/UsedRegisterCode.ts +20 -21
- package/src/models/User.ts +148 -144
- package/src/models/UserPermissions.ts +25 -28
- package/src/models/Webshop.ts +53 -53
- package/src/models/WebshopDiscountCode.ts +33 -33
- package/src/models/addresses/City.ts +12 -12
- package/src/models/addresses/PostalCode.test.ts +68 -69
- package/src/models/addresses/PostalCode.ts +57 -57
- package/src/models/addresses/Province.ts +8 -8
- package/src/models/addresses/Street.ts +10 -12
- package/src/models/index.ts +54 -55
- package/src/structures/OrganizationServerMetaData.ts +36 -36
package/src/models/Webshop.ts
CHANGED
|
@@ -1,105 +1,104 @@
|
|
|
1
|
-
import { column, Database, ManyToOneRelation, Model } from
|
|
1
|
+
import { column, Database, ManyToOneRelation, Model } from '@simonbackx/simple-database';
|
|
2
2
|
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
3
3
|
import { Category, DNSRecordStatus, Product, WebshopMetaData, WebshopPrivateMetaData, WebshopServerMetaData } from '@stamhoofd/structures';
|
|
4
|
-
import { v4 as uuidv4 } from
|
|
5
|
-
import { validateDNSRecords } from
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import { validateDNSRecords } from '../helpers/DNSValidator';
|
|
6
6
|
|
|
7
7
|
import { Organization } from './';
|
|
8
8
|
|
|
9
9
|
export class Webshop extends Model {
|
|
10
|
-
static table =
|
|
10
|
+
static table = 'webshops';
|
|
11
11
|
|
|
12
12
|
// Columns
|
|
13
13
|
@column({
|
|
14
|
-
primary: true, type:
|
|
14
|
+
primary: true, type: 'string', beforeSave(value) {
|
|
15
15
|
return value ?? uuidv4();
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
17
|
})
|
|
18
18
|
id!: string;
|
|
19
19
|
|
|
20
|
-
@column({ foreignKey: Webshop.organization, type:
|
|
20
|
+
@column({ foreignKey: Webshop.organization, type: 'string' })
|
|
21
21
|
organizationId: string;
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
// A custom domain name that is used to host the webshop application (should be unique)
|
|
24
24
|
// E.g. webshop.scoutswetteren.be
|
|
25
|
-
@column({ type:
|
|
25
|
+
@column({ type: 'string', nullable: true })
|
|
26
26
|
domain: string | null = null;
|
|
27
27
|
|
|
28
28
|
// If a domain is used, the optional suffix on that domain
|
|
29
29
|
// E.g. webshop.scoutswetteren.be/wafelbak
|
|
30
|
-
@column({ type:
|
|
30
|
+
@column({ type: 'string', nullable: true })
|
|
31
31
|
domainUri: string | null = null;
|
|
32
32
|
|
|
33
33
|
// Unique representation of this webshop from a string, that is used to provide the default domains
|
|
34
34
|
// in shop.stamhoofd.be/uri, and stamhoofd.be/shop/uri
|
|
35
|
-
@column({ type:
|
|
35
|
+
@column({ type: 'string' })
|
|
36
36
|
uri: string;
|
|
37
37
|
|
|
38
38
|
// Old uri format, which was only unique on a per-organization basis
|
|
39
39
|
// in org.stamhoofd.shop/legacyUri
|
|
40
|
-
@column({ type:
|
|
40
|
+
@column({ type: 'string', nullable: true })
|
|
41
41
|
legacyUri: string | null = null;
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Public meta data
|
|
45
45
|
*/
|
|
46
|
-
@column({ type:
|
|
47
|
-
meta: WebshopMetaData = WebshopMetaData.create({})
|
|
46
|
+
@column({ type: 'json', decoder: WebshopMetaData })
|
|
47
|
+
meta: WebshopMetaData = WebshopMetaData.create({});
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Data only accessible by the owners / users with special permissions
|
|
51
51
|
*/
|
|
52
|
-
@column({ type:
|
|
53
|
-
privateMeta: WebshopPrivateMetaData = WebshopPrivateMetaData.create({})
|
|
52
|
+
@column({ type: 'json', decoder: WebshopPrivateMetaData })
|
|
53
|
+
privateMeta: WebshopPrivateMetaData = WebshopPrivateMetaData.create({});
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Data only accessible by the server
|
|
57
57
|
*/
|
|
58
|
-
@column({ type:
|
|
59
|
-
serverMeta: WebshopServerMetaData = WebshopServerMetaData.create({})
|
|
60
|
-
|
|
58
|
+
@column({ type: 'json', decoder: WebshopServerMetaData })
|
|
59
|
+
serverMeta: WebshopServerMetaData = WebshopServerMetaData.create({});
|
|
61
60
|
|
|
62
61
|
/**
|
|
63
62
|
* Contains all the products
|
|
64
63
|
*/
|
|
65
|
-
@column({ type:
|
|
64
|
+
@column({ type: 'json', decoder: new ArrayDecoder(Product) })
|
|
66
65
|
products: Product[] = [];
|
|
67
66
|
|
|
68
67
|
/**
|
|
69
68
|
* Contains all the categories in the right order
|
|
70
69
|
*/
|
|
71
|
-
@column({ type:
|
|
70
|
+
@column({ type: 'json', decoder: new ArrayDecoder(Category) })
|
|
72
71
|
categories: Category[] = [];
|
|
73
72
|
|
|
74
73
|
@column({
|
|
75
|
-
type:
|
|
74
|
+
type: 'datetime', beforeSave(old?: any) {
|
|
76
75
|
if (old !== undefined) {
|
|
77
76
|
return old;
|
|
78
77
|
}
|
|
79
|
-
const date = new Date()
|
|
80
|
-
date.setMilliseconds(0)
|
|
81
|
-
return date
|
|
82
|
-
}
|
|
78
|
+
const date = new Date();
|
|
79
|
+
date.setMilliseconds(0);
|
|
80
|
+
return date;
|
|
81
|
+
},
|
|
83
82
|
})
|
|
84
|
-
createdAt: Date
|
|
83
|
+
createdAt: Date;
|
|
85
84
|
|
|
86
85
|
@column({
|
|
87
|
-
type:
|
|
88
|
-
const date = new Date()
|
|
89
|
-
date.setMilliseconds(0)
|
|
90
|
-
return date
|
|
86
|
+
type: 'datetime', beforeSave() {
|
|
87
|
+
const date = new Date();
|
|
88
|
+
date.setMilliseconds(0);
|
|
89
|
+
return date;
|
|
91
90
|
},
|
|
92
|
-
skipUpdate: true
|
|
91
|
+
skipUpdate: true,
|
|
93
92
|
})
|
|
94
|
-
updatedAt: Date
|
|
93
|
+
updatedAt: Date;
|
|
95
94
|
|
|
96
|
-
static organization = new ManyToOneRelation(Organization,
|
|
95
|
+
static organization = new ManyToOneRelation(Organization, 'organization');
|
|
97
96
|
|
|
98
97
|
// Methods
|
|
99
98
|
static async getByLegacyURI(organizationId: string, uri: string): Promise<Webshop | undefined> {
|
|
100
99
|
const [rows] = await Database.select(
|
|
101
100
|
`SELECT ${this.getDefaultSelect()} FROM ${this.table} WHERE \`organizationId\` = ? AND \`legacyUri\` = ? LIMIT 1`,
|
|
102
|
-
[organizationId, uri]
|
|
101
|
+
[organizationId, uri],
|
|
103
102
|
);
|
|
104
103
|
|
|
105
104
|
if (rows.length == 0) {
|
|
@@ -114,7 +113,7 @@ export class Webshop extends Model {
|
|
|
114
113
|
static async getByURI(uri: string): Promise<Webshop | undefined> {
|
|
115
114
|
const [rows] = await Database.select(
|
|
116
115
|
`SELECT ${this.getDefaultSelect()} FROM ${this.table} WHERE \`uri\` = ? LIMIT 1`,
|
|
117
|
-
[uri]
|
|
116
|
+
[uri],
|
|
118
117
|
);
|
|
119
118
|
|
|
120
119
|
if (rows.length == 0) {
|
|
@@ -129,7 +128,7 @@ export class Webshop extends Model {
|
|
|
129
128
|
static async getByDomainOnly(host: string): Promise<Webshop[]> {
|
|
130
129
|
const [rows] = await Database.select(
|
|
131
130
|
`SELECT ${this.getDefaultSelect()} FROM ${this.table} WHERE \`domain\` = ? LIMIT 200`,
|
|
132
|
-
[host]
|
|
131
|
+
[host],
|
|
133
132
|
);
|
|
134
133
|
|
|
135
134
|
// Read member + address from first row
|
|
@@ -141,7 +140,7 @@ export class Webshop extends Model {
|
|
|
141
140
|
if (uri === null || uri.length == 0) {
|
|
142
141
|
const [rows] = await Database.select(
|
|
143
142
|
`SELECT ${this.getDefaultSelect()} FROM ${this.table} WHERE \`domain\` = ? AND (\`domainUri\` is null OR \`domainUri\` = "") LIMIT 1`,
|
|
144
|
-
[host]
|
|
143
|
+
[host],
|
|
145
144
|
);
|
|
146
145
|
|
|
147
146
|
if (rows.length == 0) {
|
|
@@ -153,7 +152,7 @@ export class Webshop extends Model {
|
|
|
153
152
|
}
|
|
154
153
|
const [rows] = await Database.select(
|
|
155
154
|
`SELECT ${this.getDefaultSelect()} FROM ${this.table} WHERE \`domain\` = ? AND \`domainUri\` = ? LIMIT 1`,
|
|
156
|
-
[host, uri]
|
|
155
|
+
[host, uri],
|
|
157
156
|
);
|
|
158
157
|
|
|
159
158
|
if (rows.length == 0) {
|
|
@@ -168,28 +167,28 @@ export class Webshop extends Model {
|
|
|
168
167
|
getHost(this: Webshop & { organization: Organization }) {
|
|
169
168
|
if (this.domain && this.meta.domainActive) {
|
|
170
169
|
if (this.domainUri) {
|
|
171
|
-
return this.domain+
|
|
170
|
+
return this.domain + '/' + this.domainUri;
|
|
172
171
|
}
|
|
173
|
-
return this.domain
|
|
172
|
+
return this.domain;
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
const domain = STAMHOOFD.domains.webshop[this.organization.address.country] ?? STAMHOOFD.domains.webshop[
|
|
177
|
-
return domain+
|
|
175
|
+
const domain = STAMHOOFD.domains.webshop[this.organization.address.country] ?? STAMHOOFD.domains.webshop[''];
|
|
176
|
+
return domain + '/' + this.uri;
|
|
178
177
|
}
|
|
179
178
|
|
|
180
179
|
async updateDNSRecords(background = false) {
|
|
181
180
|
// Check initial status
|
|
182
|
-
let isValidRecords = true
|
|
181
|
+
let isValidRecords = true;
|
|
183
182
|
for (const record of this.privateMeta.dnsRecords) {
|
|
184
|
-
if (record.status
|
|
185
|
-
isValidRecords = false
|
|
183
|
+
if (record.status !== DNSRecordStatus.Valid) {
|
|
184
|
+
isValidRecords = false;
|
|
186
185
|
}
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
let { allValid } = await validateDNSRecords(this.privateMeta.dnsRecords)
|
|
188
|
+
let { allValid } = await validateDNSRecords(this.privateMeta.dnsRecords);
|
|
190
189
|
|
|
191
|
-
if (STAMHOOFD.environment ===
|
|
192
|
-
allValid = true
|
|
190
|
+
if (STAMHOOFD.environment === 'development' || STAMHOOFD.environment === 'staging') {
|
|
191
|
+
allValid = true;
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
if (allValid) {
|
|
@@ -197,10 +196,11 @@ export class Webshop extends Model {
|
|
|
197
196
|
// TODO: send an email
|
|
198
197
|
// + prevent ping pong emails when the dns is not workign properly
|
|
199
198
|
}
|
|
200
|
-
this.meta.domainActive = true
|
|
201
|
-
}
|
|
202
|
-
|
|
199
|
+
this.meta.domainActive = true;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.meta.domainActive = false;
|
|
203
203
|
}
|
|
204
|
-
await this.save()
|
|
204
|
+
await this.save();
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { column, Model } from
|
|
1
|
+
import { column, Model } from '@simonbackx/simple-database';
|
|
2
2
|
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
3
3
|
import { Discount, DiscountCode } from '@stamhoofd/structures';
|
|
4
|
-
import { v4 as uuidv4 } from
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
5
|
|
|
6
6
|
export class WebshopDiscountCode extends Model {
|
|
7
|
-
static table =
|
|
7
|
+
static table = 'webshop_discount_codes';
|
|
8
8
|
|
|
9
9
|
// Columns
|
|
10
10
|
@column({
|
|
11
|
-
primary: true, type:
|
|
11
|
+
primary: true, type: 'string', beforeSave(value) {
|
|
12
12
|
return value ?? uuidv4();
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
14
|
})
|
|
15
15
|
id!: string;
|
|
16
16
|
|
|
17
|
-
@column({ type:
|
|
17
|
+
@column({ type: 'string' })
|
|
18
18
|
organizationId: string;
|
|
19
19
|
|
|
20
|
-
@column({ type:
|
|
20
|
+
@column({ type: 'string' })
|
|
21
21
|
webshopId: string;
|
|
22
22
|
|
|
23
|
-
@column({ type:
|
|
23
|
+
@column({ type: 'string' })
|
|
24
24
|
code: string;
|
|
25
25
|
|
|
26
|
-
@column({ type:
|
|
27
|
-
description = ''
|
|
28
|
-
|
|
29
|
-
@column({ type:
|
|
30
|
-
discounts: Discount[] = []
|
|
26
|
+
@column({ type: 'string' })
|
|
27
|
+
description = '';
|
|
28
|
+
|
|
29
|
+
@column({ type: 'json', decoder: new ArrayDecoder(Discount) })
|
|
30
|
+
discounts: Discount[] = [];
|
|
31
31
|
|
|
32
|
-
@column({ type:
|
|
33
|
-
usageCount = 0
|
|
32
|
+
@column({ type: 'integer' })
|
|
33
|
+
usageCount = 0;
|
|
34
34
|
|
|
35
|
-
@column({ type:
|
|
36
|
-
maximumUsage: number|null = null
|
|
35
|
+
@column({ type: 'integer', nullable: true })
|
|
36
|
+
maximumUsage: number | null = null;
|
|
37
37
|
|
|
38
38
|
@column({
|
|
39
|
-
type:
|
|
39
|
+
type: 'datetime', beforeSave(old?: any) {
|
|
40
40
|
if (old !== undefined) {
|
|
41
41
|
return old;
|
|
42
42
|
}
|
|
43
|
-
const date = new Date()
|
|
44
|
-
date.setMilliseconds(0)
|
|
45
|
-
return date
|
|
46
|
-
}
|
|
43
|
+
const date = new Date();
|
|
44
|
+
date.setMilliseconds(0);
|
|
45
|
+
return date;
|
|
46
|
+
},
|
|
47
47
|
})
|
|
48
|
-
createdAt: Date
|
|
48
|
+
createdAt: Date;
|
|
49
49
|
|
|
50
50
|
@column({
|
|
51
|
-
type:
|
|
52
|
-
const date = new Date()
|
|
53
|
-
date.setMilliseconds(0)
|
|
54
|
-
return date
|
|
51
|
+
type: 'datetime', beforeSave() {
|
|
52
|
+
const date = new Date();
|
|
53
|
+
date.setMilliseconds(0);
|
|
54
|
+
return date;
|
|
55
55
|
},
|
|
56
|
-
skipUpdate: true
|
|
56
|
+
skipUpdate: true,
|
|
57
57
|
})
|
|
58
|
-
updatedAt: Date
|
|
58
|
+
updatedAt: Date;
|
|
59
59
|
|
|
60
60
|
getStructure(): DiscountCode {
|
|
61
|
-
return DiscountCode.create(this)
|
|
61
|
+
return DiscountCode.create(this);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
static async getActiveCodes(webshopId: string, codes: string[]) {
|
|
@@ -70,12 +70,12 @@ export class WebshopDiscountCode extends Model {
|
|
|
70
70
|
webshopId,
|
|
71
71
|
code: {
|
|
72
72
|
sign: 'IN',
|
|
73
|
-
value: codes
|
|
74
|
-
}
|
|
73
|
+
value: codes,
|
|
74
|
+
},
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
// Remove used discount codes
|
|
78
|
-
models = models.filter(c => c.maximumUsage === null || c.maximumUsage > c.usageCount)
|
|
78
|
+
models = models.filter(c => c.maximumUsage === null || c.maximumUsage > c.usageCount);
|
|
79
79
|
return models;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { column,ManyToOneRelation,Model } from '@simonbackx/simple-database';
|
|
1
|
+
import { column, ManyToOneRelation, Model } from '@simonbackx/simple-database';
|
|
2
2
|
import { Country } from '@stamhoofd/structures';
|
|
3
|
-
import { v4 as uuidv4 } from
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
|
|
5
5
|
import { Province } from './Province';
|
|
6
6
|
|
|
7
7
|
export class City extends Model {
|
|
8
|
-
static table =
|
|
8
|
+
static table = 'cities';
|
|
9
9
|
|
|
10
10
|
@column({
|
|
11
|
-
primary: true, type:
|
|
11
|
+
primary: true, type: 'string', beforeSave(value) {
|
|
12
12
|
return value ?? uuidv4();
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
14
|
})
|
|
15
15
|
id!: string;
|
|
16
16
|
|
|
17
|
-
@column({ type:
|
|
17
|
+
@column({ type: 'string' })
|
|
18
18
|
name: string;
|
|
19
19
|
|
|
20
|
-
@column({ type:
|
|
20
|
+
@column({ type: 'string', foreignKey: City.province })
|
|
21
21
|
provinceId: string;
|
|
22
22
|
|
|
23
|
-
@column({ type:
|
|
23
|
+
@column({ type: 'string', foreignKey: City.parentCity, nullable: true })
|
|
24
24
|
parentCityId: string | null = null;
|
|
25
25
|
|
|
26
|
-
@column({ type:
|
|
26
|
+
@column({ type: 'string' })
|
|
27
27
|
country: Country;
|
|
28
28
|
|
|
29
|
-
static parentCity = new ManyToOneRelation(City,
|
|
30
|
-
static province = new ManyToOneRelation(Province,
|
|
31
|
-
}
|
|
29
|
+
static parentCity = new ManyToOneRelation(City, 'parentCity');
|
|
30
|
+
static province = new ManyToOneRelation(Province, 'province');
|
|
31
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Country } from
|
|
1
|
+
import { Country } from '@stamhoofd/structures';
|
|
2
2
|
|
|
3
|
-
import { City } from
|
|
3
|
+
import { City } from './City';
|
|
4
4
|
import { PostalCode } from './PostalCode';
|
|
5
5
|
import { Province } from './Province';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
describe("Model.PostalCode", () => {
|
|
7
|
+
describe('Model.PostalCode', () => {
|
|
9
8
|
let oostVlaanderen!: Province;
|
|
10
9
|
let gent!: City;
|
|
11
10
|
let mariakerke!: City;
|
|
@@ -20,98 +19,98 @@ describe("Model.PostalCode", () => {
|
|
|
20
19
|
let massemenZip!: PostalCode;
|
|
21
20
|
|
|
22
21
|
beforeAll(async () => {
|
|
23
|
-
oostVlaanderen = new Province()
|
|
24
|
-
oostVlaanderen.name =
|
|
25
|
-
oostVlaanderen.country = Country.Belgium
|
|
26
|
-
await oostVlaanderen.save()
|
|
22
|
+
oostVlaanderen = new Province();
|
|
23
|
+
oostVlaanderen.name = 'Oost-Vlaanderen';
|
|
24
|
+
oostVlaanderen.country = Country.Belgium;
|
|
25
|
+
await oostVlaanderen.save();
|
|
27
26
|
|
|
28
27
|
// Create some cities
|
|
29
|
-
gent = new City()
|
|
30
|
-
gent.name =
|
|
31
|
-
gent.provinceId = oostVlaanderen.id
|
|
32
|
-
gent.country = Country.Belgium
|
|
33
|
-
await gent.save()
|
|
28
|
+
gent = new City();
|
|
29
|
+
gent.name = 'Gent';
|
|
30
|
+
gent.provinceId = oostVlaanderen.id;
|
|
31
|
+
gent.country = Country.Belgium;
|
|
32
|
+
await gent.save();
|
|
34
33
|
|
|
35
34
|
// Create some cities
|
|
36
|
-
mariakerke = new City()
|
|
37
|
-
mariakerke.name =
|
|
38
|
-
mariakerke.provinceId = oostVlaanderen.id
|
|
39
|
-
mariakerke.parentCityId = gent.id
|
|
40
|
-
mariakerke.country = Country.Belgium
|
|
41
|
-
await mariakerke.save()
|
|
35
|
+
mariakerke = new City();
|
|
36
|
+
mariakerke.name = 'Mariakerke';
|
|
37
|
+
mariakerke.provinceId = oostVlaanderen.id;
|
|
38
|
+
mariakerke.parentCityId = gent.id;
|
|
39
|
+
mariakerke.country = Country.Belgium;
|
|
40
|
+
await mariakerke.save();
|
|
42
41
|
|
|
43
42
|
// Create some cities
|
|
44
|
-
wetteren = new City()
|
|
45
|
-
wetteren.name =
|
|
46
|
-
wetteren.provinceId = oostVlaanderen.id
|
|
47
|
-
wetteren.country = Country.Belgium
|
|
48
|
-
await wetteren.save()
|
|
43
|
+
wetteren = new City();
|
|
44
|
+
wetteren.name = 'Wetteren';
|
|
45
|
+
wetteren.provinceId = oostVlaanderen.id;
|
|
46
|
+
wetteren.country = Country.Belgium;
|
|
47
|
+
await wetteren.save();
|
|
49
48
|
|
|
50
49
|
// Create some cities
|
|
51
|
-
massemen = new City()
|
|
52
|
-
massemen.name =
|
|
53
|
-
massemen.provinceId = oostVlaanderen.id
|
|
54
|
-
massemen.parentCityId = wetteren.id
|
|
55
|
-
massemen.country = Country.Belgium
|
|
56
|
-
await massemen.save()
|
|
50
|
+
massemen = new City();
|
|
51
|
+
massemen.name = 'Massemen';
|
|
52
|
+
massemen.provinceId = oostVlaanderen.id;
|
|
53
|
+
massemen.parentCityId = wetteren.id;
|
|
54
|
+
massemen.country = Country.Belgium;
|
|
55
|
+
await massemen.save();
|
|
57
56
|
|
|
58
57
|
// Create postal codes
|
|
59
|
-
gentZip = new PostalCode()
|
|
60
|
-
gentZip.postalCode =
|
|
61
|
-
gentZip.cityId = gent.id
|
|
62
|
-
gentZip.country = Country.Belgium
|
|
63
|
-
await gentZip.save()
|
|
58
|
+
gentZip = new PostalCode();
|
|
59
|
+
gentZip.postalCode = '9000';
|
|
60
|
+
gentZip.cityId = gent.id;
|
|
61
|
+
gentZip.country = Country.Belgium;
|
|
62
|
+
await gentZip.save();
|
|
64
63
|
|
|
65
64
|
// Create postal codes
|
|
66
|
-
mariakerkeZip = new PostalCode()
|
|
67
|
-
mariakerkeZip.postalCode =
|
|
68
|
-
mariakerkeZip.cityId = mariakerke.id
|
|
69
|
-
mariakerkeZip.country = Country.Belgium
|
|
70
|
-
await mariakerkeZip.save()
|
|
65
|
+
mariakerkeZip = new PostalCode();
|
|
66
|
+
mariakerkeZip.postalCode = '9030';
|
|
67
|
+
mariakerkeZip.cityId = mariakerke.id;
|
|
68
|
+
mariakerkeZip.country = Country.Belgium;
|
|
69
|
+
await mariakerkeZip.save();
|
|
71
70
|
|
|
72
71
|
// Create postal codes
|
|
73
|
-
wetterenZip = new PostalCode()
|
|
74
|
-
wetterenZip.postalCode =
|
|
75
|
-
wetterenZip.cityId = wetteren.id
|
|
76
|
-
wetterenZip.country = Country.Belgium
|
|
77
|
-
await wetterenZip.save()
|
|
72
|
+
wetterenZip = new PostalCode();
|
|
73
|
+
wetterenZip.postalCode = '9230';
|
|
74
|
+
wetterenZip.cityId = wetteren.id;
|
|
75
|
+
wetterenZip.country = Country.Belgium;
|
|
76
|
+
await wetterenZip.save();
|
|
78
77
|
|
|
79
78
|
// Create postal codes
|
|
80
|
-
massemenZip = new PostalCode()
|
|
81
|
-
massemenZip.postalCode =
|
|
82
|
-
massemenZip.cityId = massemen.id
|
|
83
|
-
massemenZip.country = Country.Belgium
|
|
84
|
-
await massemenZip.save()
|
|
79
|
+
massemenZip = new PostalCode();
|
|
80
|
+
massemenZip.postalCode = '9230';
|
|
81
|
+
massemenZip.cityId = massemen.id;
|
|
82
|
+
massemenZip.country = Country.Belgium;
|
|
83
|
+
await massemenZip.save();
|
|
85
84
|
});
|
|
86
85
|
|
|
87
|
-
test(
|
|
88
|
-
const test = await PostalCode.getCity(
|
|
89
|
-
expect(test).toMatchObject(gent)
|
|
86
|
+
test('Normal flow', async () => {
|
|
87
|
+
const test = await PostalCode.getCity('9000', 'Gent', Country.Belgium);
|
|
88
|
+
expect(test).toMatchObject(gent);
|
|
90
89
|
});
|
|
91
90
|
|
|
92
|
-
test(
|
|
93
|
-
const test = await PostalCode.getCity(
|
|
94
|
-
expect(test).toMatchObject(gent)
|
|
91
|
+
test('Entering the postal code of the parent city works', async () => {
|
|
92
|
+
const test = await PostalCode.getCity('9000', 'Mariakerke', Country.Belgium);
|
|
93
|
+
expect(test).toMatchObject(gent);
|
|
95
94
|
});
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
const test = await PostalCode.getCity(
|
|
99
|
-
expect(test).toMatchObject(mariakerke)
|
|
96
|
+
test('Entering the postal code of a child city works', async () => {
|
|
97
|
+
const test = await PostalCode.getCity('9030', 'Gent', Country.Belgium);
|
|
98
|
+
expect(test).toMatchObject(mariakerke);
|
|
100
99
|
});
|
|
101
100
|
|
|
102
|
-
test(
|
|
103
|
-
const test = await PostalCode.getCity(
|
|
104
|
-
expect(test).toMatchObject(wetteren)
|
|
101
|
+
test('Search normal', async () => {
|
|
102
|
+
const test = await PostalCode.getCity('9230', 'Wetteren', Country.Belgium);
|
|
103
|
+
expect(test).toMatchObject(wetteren);
|
|
105
104
|
|
|
106
|
-
const test2 = await PostalCode.getCity(
|
|
107
|
-
expect(test2).toMatchObject(massemen)
|
|
105
|
+
const test2 = await PostalCode.getCity('9230', 'Massemen', Country.Belgium);
|
|
106
|
+
expect(test2).toMatchObject(massemen);
|
|
108
107
|
});
|
|
109
108
|
|
|
110
|
-
test(
|
|
111
|
-
const test = await PostalCode.getCity(
|
|
112
|
-
expect(test).toMatchObject(wetteren)
|
|
109
|
+
test('Allow typo', async () => {
|
|
110
|
+
const test = await PostalCode.getCity('9230', 'Wettern', Country.Belgium);
|
|
111
|
+
expect(test).toMatchObject(wetteren);
|
|
113
112
|
|
|
114
|
-
const test2 = await PostalCode.getCity(
|
|
115
|
-
expect(test2).toMatchObject(massemen)
|
|
113
|
+
const test2 = await PostalCode.getCity('9230', 'Masemen', Country.Belgium);
|
|
114
|
+
expect(test2).toMatchObject(massemen);
|
|
116
115
|
});
|
|
117
116
|
});
|