@stamhoofd/models 2.1.1
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/assets/Metropolis-Black.woff2 +0 -0
- package/dist/src/assets/Metropolis-BlackItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-Bold.woff2 +0 -0
- package/dist/src/assets/Metropolis-BoldItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-ExtraBold.woff2 +0 -0
- package/dist/src/assets/Metropolis-ExtraBoldItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-ExtraLight.woff2 +0 -0
- package/dist/src/assets/Metropolis-ExtraLightItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-Light.woff2 +0 -0
- package/dist/src/assets/Metropolis-LightItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-Medium.woff2 +0 -0
- package/dist/src/assets/Metropolis-MediumItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-Regular.woff2 +0 -0
- package/dist/src/assets/Metropolis-RegularItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-SemiBold.woff2 +0 -0
- package/dist/src/assets/Metropolis-SemiBoldItalic.woff2 +0 -0
- package/dist/src/assets/Metropolis-Thin.woff2 +0 -0
- package/dist/src/assets/Metropolis-ThinItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-Black.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-BlackItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-Bold.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-BoldItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-ExtraBold.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-ExtraBoldItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-ExtraLight.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-ExtraLightItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-Light.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-LightItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-Medium.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-MediumItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-Regular.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-RegularItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-SemiBold.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-SemiBoldItalic.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-Thin.woff2 +0 -0
- package/dist/src/assets/assets/Metropolis-ThinItalic.woff2 +0 -0
- package/dist/src/assets/assets/logo.png +0 -0
- package/dist/src/assets/logo.png +0 -0
- package/dist/src/factories/AddressFactory.d.ts +10 -0
- package/dist/src/factories/AddressFactory.d.ts.map +1 -0
- package/dist/src/factories/AddressFactory.js +42 -0
- package/dist/src/factories/AddressFactory.js.map +1 -0
- package/dist/src/factories/EmergencyContactFactory.d.ts +9 -0
- package/dist/src/factories/EmergencyContactFactory.d.ts.map +1 -0
- package/dist/src/factories/EmergencyContactFactory.js +42 -0
- package/dist/src/factories/EmergencyContactFactory.js.map +1 -0
- package/dist/src/factories/GroupFactory.d.ts +19 -0
- package/dist/src/factories/GroupFactory.d.ts.map +1 -0
- package/dist/src/factories/GroupFactory.js +52 -0
- package/dist/src/factories/GroupFactory.js.map +1 -0
- package/dist/src/factories/MemberFactory.d.ts +16 -0
- package/dist/src/factories/MemberFactory.d.ts.map +1 -0
- package/dist/src/factories/MemberFactory.js +98 -0
- package/dist/src/factories/MemberFactory.js.map +1 -0
- package/dist/src/factories/OrganizationFactory.d.ts +16 -0
- package/dist/src/factories/OrganizationFactory.d.ts.map +1 -0
- package/dist/src/factories/OrganizationFactory.js +40 -0
- package/dist/src/factories/OrganizationFactory.js.map +1 -0
- package/dist/src/factories/ParentFactory.d.ts +10 -0
- package/dist/src/factories/ParentFactory.d.ts.map +1 -0
- package/dist/src/factories/ParentFactory.js +44 -0
- package/dist/src/factories/ParentFactory.js.map +1 -0
- package/dist/src/factories/RecordFactory.d.ts +10 -0
- package/dist/src/factories/RecordFactory.d.ts.map +1 -0
- package/dist/src/factories/RecordFactory.js +14 -0
- package/dist/src/factories/RecordFactory.js.map +1 -0
- package/dist/src/factories/RegisterCodeFactory.d.ts +18 -0
- package/dist/src/factories/RegisterCodeFactory.d.ts.map +1 -0
- package/dist/src/factories/RegisterCodeFactory.js +19 -0
- package/dist/src/factories/RegisterCodeFactory.js.map +1 -0
- package/dist/src/factories/RegistrationFactory.d.ts +14 -0
- package/dist/src/factories/RegistrationFactory.d.ts.map +1 -0
- package/dist/src/factories/RegistrationFactory.js +26 -0
- package/dist/src/factories/RegistrationFactory.js.map +1 -0
- package/dist/src/factories/UserFactory.d.ts +21 -0
- package/dist/src/factories/UserFactory.d.ts.map +1 -0
- package/dist/src/factories/UserFactory.js +41 -0
- package/dist/src/factories/UserFactory.js.map +1 -0
- package/dist/src/factories/WebshopFactory.d.ts +16 -0
- package/dist/src/factories/WebshopFactory.d.ts.map +1 -0
- package/dist/src/factories/WebshopFactory.js +35 -0
- package/dist/src/factories/WebshopFactory.js.map +1 -0
- package/dist/src/helpers/DNSValidator.d.ts +6 -0
- package/dist/src/helpers/DNSValidator.d.ts.map +1 -0
- package/dist/src/helpers/DNSValidator.js +144 -0
- package/dist/src/helpers/DNSValidator.js.map +1 -0
- package/dist/src/helpers/EmailBuilder.d.ts +22 -0
- package/dist/src/helpers/EmailBuilder.d.ts.map +1 -0
- package/dist/src/helpers/EmailBuilder.js +100 -0
- package/dist/src/helpers/EmailBuilder.js.map +1 -0
- package/dist/src/helpers/GroupBuilder.d.ts +9 -0
- package/dist/src/helpers/GroupBuilder.d.ts.map +1 -0
- package/dist/src/helpers/GroupBuilder.js +382 -0
- package/dist/src/helpers/GroupBuilder.js.map +1 -0
- package/dist/src/helpers/Handlebars.d.ts +2 -0
- package/dist/src/helpers/Handlebars.d.ts.map +1 -0
- package/dist/src/helpers/Handlebars.js +192 -0
- package/dist/src/helpers/Handlebars.js.map +1 -0
- package/dist/src/helpers/InvoiceBuilder.d.ts +29 -0
- package/dist/src/helpers/InvoiceBuilder.d.ts.map +1 -0
- package/dist/src/helpers/InvoiceBuilder.js +406 -0
- package/dist/src/helpers/InvoiceBuilder.js.map +1 -0
- package/dist/src/helpers/InvoiceBuilder.test.d.ts +2 -0
- package/dist/src/helpers/InvoiceBuilder.test.d.ts.map +1 -0
- package/dist/src/helpers/InvoiceBuilder.test.js +52 -0
- package/dist/src/helpers/InvoiceBuilder.test.js.map +1 -0
- package/dist/src/helpers/RateLimiter.d.ts +27 -0
- package/dist/src/helpers/RateLimiter.d.ts.map +1 -0
- package/dist/src/helpers/RateLimiter.js +57 -0
- package/dist/src/helpers/RateLimiter.js.map +1 -0
- package/dist/src/helpers/WebshopCounter.d.ts +6 -0
- package/dist/src/helpers/WebshopCounter.d.ts.map +1 -0
- package/dist/src/helpers/WebshopCounter.js +36 -0
- package/dist/src/helpers/WebshopCounter.js.map +1 -0
- package/dist/src/helpers/WebshopCounter.test.d.ts +2 -0
- package/dist/src/helpers/WebshopCounter.test.d.ts.map +1 -0
- package/dist/src/helpers/WebshopCounter.test.js +17 -0
- package/dist/src/helpers/WebshopCounter.test.js.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +23 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/migrations/1593773929-create-initial-tables.sql +634 -0
- package/dist/src/migrations/1605261999-gemeenten-tmp.sql +2820 -0
- package/dist/src/migrations/1605262045-import-postcodes.d.ts +16 -0
- package/dist/src/migrations/1605262045-import-postcodes.d.ts.map +1 -0
- package/dist/src/migrations/1605262045-import-postcodes.js +116 -0
- package/dist/src/migrations/1605262045-import-postcodes.js.map +1 -0
- package/dist/src/migrations/1605262046-import-postcodes-nl.d.ts +4 -0
- package/dist/src/migrations/1605262046-import-postcodes-nl.d.ts.map +1 -0
- package/dist/src/migrations/1605262046-import-postcodes-nl.js +83 -0
- package/dist/src/migrations/1605262046-import-postcodes-nl.js.map +1 -0
- package/dist/src/migrations/1605279038-drop-gemeenten-tmp.sql +1 -0
- package/dist/src/migrations/1648392491-default-templates.sql +9 -0
- package/dist/src/migrations/1651245707-default-templates-reminders.sql +6 -0
- package/dist/src/migrations/1708607340-tickets-deleted-at.sql +1 -0
- package/dist/src/migrations/1710459176-register-code-invoices.sql +3 -0
- package/dist/src/migrations/1712158247-discount-codes.sql +17 -0
- package/dist/src/migrations/1713178665-drop-invites.sql +1 -0
- package/dist/src/migrations/1713178666-drop-keychain.sql +1 -0
- package/dist/src/migrations/1713178667-drop-challenges.sql +1 -0
- package/dist/src/migrations/1713178668-drop-user-keys.sql +7 -0
- package/dist/src/migrations/1713178669-drop-organization-key.sql +2 -0
- package/dist/src/migrations/data/postcodes/nl/Drenthe +291 -0
- package/dist/src/migrations/data/postcodes/nl/Flevoland +107 -0
- package/dist/src/migrations/data/postcodes/nl/Friesland +518 -0
- package/dist/src/migrations/data/postcodes/nl/Gelderland +601 -0
- package/dist/src/migrations/data/postcodes/nl/Groningen +279 -0
- package/dist/src/migrations/data/postcodes/nl/Limburg +324 -0
- package/dist/src/migrations/data/postcodes/nl/Noord-Brabant +620 -0
- package/dist/src/migrations/data/postcodes/nl/Noord-Holland +566 -0
- package/dist/src/migrations/data/postcodes/nl/Overrijsel +344 -0
- package/dist/src/migrations/data/postcodes/nl/Utrecht +278 -0
- package/dist/src/migrations/data/postcodes/nl/Zeeland +179 -0
- package/dist/src/migrations/data/postcodes/nl/Zuid-Holland +662 -0
- package/dist/src/models/BalanceItem.d.ts +57 -0
- package/dist/src/models/BalanceItem.d.ts.map +1 -0
- package/dist/src/models/BalanceItem.js +346 -0
- package/dist/src/models/BalanceItem.js.map +1 -0
- package/dist/src/models/BalanceItemPayment.d.ts +31 -0
- package/dist/src/models/BalanceItemPayment.d.ts.map +1 -0
- package/dist/src/models/BalanceItemPayment.js +101 -0
- package/dist/src/models/BalanceItemPayment.js.map +1 -0
- package/dist/src/models/BuckarooPayment.d.ts +8 -0
- package/dist/src/models/BuckarooPayment.d.ts.map +1 -0
- package/dist/src/models/BuckarooPayment.js +24 -0
- package/dist/src/models/BuckarooPayment.js.map +1 -0
- package/dist/src/models/Document.d.ts +44 -0
- package/dist/src/models/Document.d.ts.map +1 -0
- package/dist/src/models/Document.js +194 -0
- package/dist/src/models/Document.js.map +1 -0
- package/dist/src/models/DocumentTemplate.d.ts +45 -0
- package/dist/src/models/DocumentTemplate.d.ts.map +1 -0
- package/dist/src/models/DocumentTemplate.js +533 -0
- package/dist/src/models/DocumentTemplate.js.map +1 -0
- package/dist/src/models/EmailTemplate.d.ts +22 -0
- package/dist/src/models/EmailTemplate.d.ts.map +1 -0
- package/dist/src/models/EmailTemplate.js +70 -0
- package/dist/src/models/EmailTemplate.js.map +1 -0
- package/dist/src/models/EmailVerificationCode.d.ts +60 -0
- package/dist/src/models/EmailVerificationCode.d.ts.map +1 -0
- package/dist/src/models/EmailVerificationCode.js +307 -0
- package/dist/src/models/EmailVerificationCode.js.map +1 -0
- package/dist/src/models/Group.d.ts +36 -0
- package/dist/src/models/Group.d.ts.map +1 -0
- package/dist/src/models/Group.js +231 -0
- package/dist/src/models/Group.js.map +1 -0
- package/dist/src/models/Image.d.ts +12 -0
- package/dist/src/models/Image.d.ts.map +1 -0
- package/dist/src/models/Image.js +137 -0
- package/dist/src/models/Image.js.map +1 -0
- package/dist/src/models/Member.d.ts +66 -0
- package/dist/src/models/Member.d.ts.map +1 -0
- package/dist/src/models/Member.js +309 -0
- package/dist/src/models/Member.js.map +1 -0
- package/dist/src/models/MemberResponsibilityRecord.d.ts +11 -0
- package/dist/src/models/MemberResponsibilityRecord.d.ts.map +1 -0
- package/dist/src/models/MemberResponsibilityRecord.js +47 -0
- package/dist/src/models/MemberResponsibilityRecord.js.map +1 -0
- package/dist/src/models/MolliePayment.d.ts +8 -0
- package/dist/src/models/MolliePayment.d.ts.map +1 -0
- package/dist/src/models/MolliePayment.js +24 -0
- package/dist/src/models/MolliePayment.js.map +1 -0
- package/dist/src/models/MollieToken.d.ts +45 -0
- package/dist/src/models/MollieToken.d.ts.map +1 -0
- package/dist/src/models/MollieToken.js +333 -0
- package/dist/src/models/MollieToken.js.map +1 -0
- package/dist/src/models/OneTimeToken.d.ts +38 -0
- package/dist/src/models/OneTimeToken.d.ts.map +1 -0
- package/dist/src/models/OneTimeToken.js +126 -0
- package/dist/src/models/OneTimeToken.js.map +1 -0
- package/dist/src/models/Order.d.ts +99 -0
- package/dist/src/models/Order.d.ts.map +1 -0
- package/dist/src/models/Order.js +912 -0
- package/dist/src/models/Order.js.map +1 -0
- package/dist/src/models/Organization.d.ts +119 -0
- package/dist/src/models/Organization.d.ts.map +1 -0
- package/dist/src/models/Organization.js +900 -0
- package/dist/src/models/Organization.js.map +1 -0
- package/dist/src/models/OrganizationRegistrationPeriod.d.ts +14 -0
- package/dist/src/models/OrganizationRegistrationPeriod.d.ts.map +1 -0
- package/dist/src/models/OrganizationRegistrationPeriod.js +62 -0
- package/dist/src/models/OrganizationRegistrationPeriod.js.map +1 -0
- package/dist/src/models/PasswordToken.d.ts +29 -0
- package/dist/src/models/PasswordToken.d.ts.map +1 -0
- package/dist/src/models/PasswordToken.js +118 -0
- package/dist/src/models/PasswordToken.js.map +1 -0
- package/dist/src/models/PayconiqPayment.d.ts +18 -0
- package/dist/src/models/PayconiqPayment.d.ts.map +1 -0
- package/dist/src/models/PayconiqPayment.js +216 -0
- package/dist/src/models/PayconiqPayment.js.map +1 -0
- package/dist/src/models/Payment.d.ts +62 -0
- package/dist/src/models/Payment.d.ts.map +1 -0
- package/dist/src/models/Payment.js +199 -0
- package/dist/src/models/Payment.js.map +1 -0
- package/dist/src/models/Platform.d.ts +15 -0
- package/dist/src/models/Platform.d.ts.map +1 -0
- package/dist/src/models/Platform.js +77 -0
- package/dist/src/models/Platform.js.map +1 -0
- package/dist/src/models/RegisterCode.d.ts +27 -0
- package/dist/src/models/RegisterCode.d.ts.map +1 -0
- package/dist/src/models/RegisterCode.js +162 -0
- package/dist/src/models/RegisterCode.js.map +1 -0
- package/dist/src/models/Registration.d.ts +47 -0
- package/dist/src/models/Registration.d.ts.map +1 -0
- package/dist/src/models/Registration.js +369 -0
- package/dist/src/models/Registration.js.map +1 -0
- package/dist/src/models/RegistrationPeriod.d.ts +15 -0
- package/dist/src/models/RegistrationPeriod.d.ts.map +1 -0
- package/dist/src/models/RegistrationPeriod.js +64 -0
- package/dist/src/models/RegistrationPeriod.js.map +1 -0
- package/dist/src/models/STCredit.d.ts +20 -0
- package/dist/src/models/STCredit.d.ts.map +1 -0
- package/dist/src/models/STCredit.js +129 -0
- package/dist/src/models/STCredit.js.map +1 -0
- package/dist/src/models/STInvoice.d.ts +51 -0
- package/dist/src/models/STInvoice.d.ts.map +1 -0
- package/dist/src/models/STInvoice.js +453 -0
- package/dist/src/models/STInvoice.js.map +1 -0
- package/dist/src/models/STPackage.d.ts +36 -0
- package/dist/src/models/STPackage.d.ts.map +1 -0
- package/dist/src/models/STPackage.js +300 -0
- package/dist/src/models/STPackage.js.map +1 -0
- package/dist/src/models/STPendingInvoice.d.ts +45 -0
- package/dist/src/models/STPendingInvoice.d.ts.map +1 -0
- package/dist/src/models/STPendingInvoice.js +284 -0
- package/dist/src/models/STPendingInvoice.js.map +1 -0
- package/dist/src/models/StripeAccount.d.ts +17 -0
- package/dist/src/models/StripeAccount.d.ts.map +1 -0
- package/dist/src/models/StripeAccount.js +81 -0
- package/dist/src/models/StripeAccount.js.map +1 -0
- package/dist/src/models/StripeCheckoutSession.d.ts +9 -0
- package/dist/src/models/StripeCheckoutSession.d.ts.map +1 -0
- package/dist/src/models/StripeCheckoutSession.js +31 -0
- package/dist/src/models/StripeCheckoutSession.js.map +1 -0
- package/dist/src/models/StripePaymentIntent.d.ts +9 -0
- package/dist/src/models/StripePaymentIntent.d.ts.map +1 -0
- package/dist/src/models/StripePaymentIntent.js +31 -0
- package/dist/src/models/StripePaymentIntent.js.map +1 -0
- package/dist/src/models/Ticket.d.ts +61 -0
- package/dist/src/models/Ticket.d.ts.map +1 -0
- package/dist/src/models/Ticket.js +143 -0
- package/dist/src/models/Ticket.js.map +1 -0
- package/dist/src/models/Token.d.ts +49 -0
- package/dist/src/models/Token.d.ts.map +1 -0
- package/dist/src/models/Token.js +218 -0
- package/dist/src/models/Token.js.map +1 -0
- package/dist/src/models/Token.test.d.ts +2 -0
- package/dist/src/models/Token.test.d.ts.map +1 -0
- package/dist/src/models/Token.test.js +60 -0
- package/dist/src/models/Token.test.js.map +1 -0
- package/dist/src/models/UsedRegisterCode.d.ts +22 -0
- package/dist/src/models/UsedRegisterCode.d.ts.map +1 -0
- package/dist/src/models/UsedRegisterCode.js +158 -0
- package/dist/src/models/UsedRegisterCode.js.map +1 -0
- package/dist/src/models/User.d.ts +55 -0
- package/dist/src/models/User.d.ts.map +1 -0
- package/dist/src/models/User.js +314 -0
- package/dist/src/models/User.js.map +1 -0
- package/dist/src/models/UserPermissions.d.ts +15 -0
- package/dist/src/models/UserPermissions.d.ts.map +1 -0
- package/dist/src/models/UserPermissions.js +57 -0
- package/dist/src/models/UserPermissions.js.map +1 -0
- package/dist/src/models/Webshop.d.ts +44 -0
- package/dist/src/models/Webshop.d.ts.map +1 -0
- package/dist/src/models/Webshop.js +184 -0
- package/dist/src/models/Webshop.js.map +1 -0
- package/dist/src/models/WebshopDiscountCode.d.ts +18 -0
- package/dist/src/models/WebshopDiscountCode.d.ts.map +1 -0
- package/dist/src/models/WebshopDiscountCode.js +88 -0
- package/dist/src/models/WebshopDiscountCode.js.map +1 -0
- package/dist/src/models/addresses/City.d.ts +14 -0
- package/dist/src/models/addresses/City.d.ts.map +1 -0
- package/dist/src/models/addresses/City.js +37 -0
- package/dist/src/models/addresses/City.js.map +1 -0
- package/dist/src/models/addresses/PostalCode.d.ts +20 -0
- package/dist/src/models/addresses/PostalCode.d.ts.map +1 -0
- package/dist/src/models/addresses/PostalCode.js +138 -0
- package/dist/src/models/addresses/PostalCode.js.map +1 -0
- package/dist/src/models/addresses/PostalCode.test.d.ts +2 -0
- package/dist/src/models/addresses/PostalCode.test.d.ts.map +1 -0
- package/dist/src/models/addresses/PostalCode.test.js +98 -0
- package/dist/src/models/addresses/PostalCode.test.js.map +1 -0
- package/dist/src/models/addresses/Province.d.ts +9 -0
- package/dist/src/models/addresses/Province.d.ts.map +1 -0
- package/dist/src/models/addresses/Province.js +24 -0
- package/dist/src/models/addresses/Province.js.map +1 -0
- package/dist/src/models/addresses/Street.d.ts +10 -0
- package/dist/src/models/addresses/Street.d.ts.map +1 -0
- package/dist/src/models/addresses/Street.js +26 -0
- package/dist/src/models/addresses/Street.js.map +1 -0
- package/dist/src/models/index.d.ts +37 -0
- package/dist/src/models/index.d.ts.map +1 -0
- package/dist/src/models/index.js +53 -0
- package/dist/src/models/index.js.map +1 -0
- package/dist/src/structures/OrganizationServerMetaData.d.ts +43 -0
- package/dist/src/structures/OrganizationServerMetaData.d.ts.map +1 -0
- package/dist/src/structures/OrganizationServerMetaData.js +128 -0
- package/dist/src/structures/OrganizationServerMetaData.js.map +1 -0
- package/dist/tests/jest.global.setup.d.ts +3 -0
- package/dist/tests/jest.global.setup.d.ts.map +1 -0
- package/dist/tests/jest.global.setup.js +20 -0
- package/dist/tests/jest.global.setup.js.map +1 -0
- package/dist/tests/jest.setup.d.ts +2 -0
- package/dist/tests/jest.setup.d.ts.map +1 -0
- package/dist/tests/jest.setup.js +15 -0
- package/dist/tests/jest.setup.js.map +1 -0
- package/package.json +30 -0
- package/src/assets/Metropolis-Black.woff2 +0 -0
- package/src/assets/Metropolis-BlackItalic.woff2 +0 -0
- package/src/assets/Metropolis-Bold.woff2 +0 -0
- package/src/assets/Metropolis-BoldItalic.woff2 +0 -0
- package/src/assets/Metropolis-ExtraBold.woff2 +0 -0
- package/src/assets/Metropolis-ExtraBoldItalic.woff2 +0 -0
- package/src/assets/Metropolis-ExtraLight.woff2 +0 -0
- package/src/assets/Metropolis-ExtraLightItalic.woff2 +0 -0
- package/src/assets/Metropolis-Light.woff2 +0 -0
- package/src/assets/Metropolis-LightItalic.woff2 +0 -0
- package/src/assets/Metropolis-Medium.woff2 +0 -0
- package/src/assets/Metropolis-MediumItalic.woff2 +0 -0
- package/src/assets/Metropolis-Regular.woff2 +0 -0
- package/src/assets/Metropolis-RegularItalic.woff2 +0 -0
- package/src/assets/Metropolis-SemiBold.woff2 +0 -0
- package/src/assets/Metropolis-SemiBoldItalic.woff2 +0 -0
- package/src/assets/Metropolis-Thin.woff2 +0 -0
- package/src/assets/Metropolis-ThinItalic.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/factories/AddressFactory.ts +42 -0
- package/src/factories/EmergencyContactFactory.ts +43 -0
- package/src/factories/GroupFactory.ts +66 -0
- package/src/factories/MemberFactory.ts +122 -0
- package/src/factories/OrganizationFactory.ts +45 -0
- package/src/factories/ParentFactory.ts +49 -0
- package/src/factories/RecordFactory.ts +12 -0
- package/src/factories/RegisterCodeFactory.ts +25 -0
- package/src/factories/RegistrationFactory.ts +32 -0
- package/src/factories/UserFactory.ts +66 -0
- package/src/factories/WebshopFactory.ts +43 -0
- package/src/helpers/DNSValidator.ts +153 -0
- package/src/helpers/EmailBuilder.ts +127 -0
- package/src/helpers/GroupBuilder.ts +438 -0
- package/src/helpers/Handlebars.ts +203 -0
- package/src/helpers/InvoiceBuilder.test.ts +57 -0
- package/src/helpers/InvoiceBuilder.ts +501 -0
- package/src/helpers/RateLimiter.ts +75 -0
- package/src/helpers/WebshopCounter.test.ts +16 -0
- package/src/helpers/WebshopCounter.ts +36 -0
- package/src/index.ts +21 -0
- package/src/migrations/1593773929-create-initial-tables.sql +634 -0
- package/src/migrations/1605261999-gemeenten-tmp.sql +2820 -0
- package/src/migrations/1605262045-import-postcodes.ts +132 -0
- package/src/migrations/1605262046-import-postcodes-nl.ts +97 -0
- package/src/migrations/1605279038-drop-gemeenten-tmp.sql +1 -0
- package/src/migrations/1648392491-default-templates.sql +9 -0
- package/src/migrations/1651245707-default-templates-reminders.sql +6 -0
- package/src/migrations/1708607340-tickets-deleted-at.sql +1 -0
- package/src/migrations/1710459176-register-code-invoices.sql +3 -0
- package/src/migrations/1712158247-discount-codes.sql +17 -0
- package/src/migrations/1713178665-drop-invites.sql +1 -0
- package/src/migrations/1713178666-drop-keychain.sql +1 -0
- package/src/migrations/1713178667-drop-challenges.sql +1 -0
- package/src/migrations/1713178668-drop-user-keys.sql +7 -0
- package/src/migrations/1713178669-drop-organization-key.sql +2 -0
- package/src/migrations/1714985451-user-nullable-organization-id.sql +2 -0
- package/src/migrations/1714985452-email-verification-code-nullable-organization-id.sql +2 -0
- package/src/migrations/1714985453-user-organization-permissions.sql +2 -0
- package/src/migrations/1714985454-user-organization-permissions.sql +2 -0
- package/src/migrations/1715079362-platform.sql +6 -0
- package/src/migrations/1715181649-registrations-organization-id.sql +2 -0
- package/src/migrations/1715181650-registrations-organization-id-fill.sql +1 -0
- package/src/migrations/1715181651-registrations-organization-id-drop-null.sql +2 -0
- package/src/migrations/1716117067-members-nullable-organization-id.sql +2 -0
- package/src/migrations/1719567581-registration-periods.sql +13 -0
- package/src/migrations/1719567582-organization-registration-periods.sql +13 -0
- package/src/migrations/1719567881-organization-periodId.sql +2 -0
- package/src/migrations/1719567882-groups-periodId.sql +2 -0
- package/src/migrations/1719567883-platform-periodId.sql +2 -0
- package/src/migrations/1719568079-default-period.sql +2 -0
- package/src/migrations/1719568080-set-default-period-platform.sql +1 -0
- package/src/migrations/1719568081-set-default-period-organizations.sql +1 -0
- package/src/migrations/1719568082-set-default-period-groups.sql +1 -0
- package/src/migrations/1719580828-registrations-periodId.sql +2 -0
- package/src/migrations/1719580829-set-default-period-registrations.sql +1 -0
- package/src/migrations/data/postcodes/nl/Drenthe +291 -0
- package/src/migrations/data/postcodes/nl/Flevoland +107 -0
- package/src/migrations/data/postcodes/nl/Friesland +518 -0
- package/src/migrations/data/postcodes/nl/Gelderland +601 -0
- package/src/migrations/data/postcodes/nl/Groningen +279 -0
- package/src/migrations/data/postcodes/nl/Limburg +324 -0
- package/src/migrations/data/postcodes/nl/Noord-Brabant +620 -0
- package/src/migrations/data/postcodes/nl/Noord-Holland +566 -0
- package/src/migrations/data/postcodes/nl/Overrijsel +344 -0
- package/src/migrations/data/postcodes/nl/Utrecht +278 -0
- package/src/migrations/data/postcodes/nl/Zeeland +179 -0
- package/src/migrations/data/postcodes/nl/Zuid-Holland +662 -0
- package/src/models/BalanceItem.ts +392 -0
- package/src/models/BalanceItemPayment.ts +106 -0
- package/src/models/BuckarooPayment.ts +19 -0
- package/src/models/Document.ts +203 -0
- package/src/models/DocumentTemplate.ts +583 -0
- package/src/models/EmailTemplate.ts +64 -0
- package/src/models/EmailVerificationCode.ts +352 -0
- package/src/models/Group.ts +293 -0
- package/src/models/Image.ts +147 -0
- package/src/models/Member.ts +386 -0
- package/src/models/MemberResponsibilityRecord.ts +39 -0
- package/src/models/MolliePayment.ts +19 -0
- package/src/models/MollieToken.ts +369 -0
- package/src/models/OneTimeToken.ts +131 -0
- package/src/models/Order.ts +1030 -0
- package/src/models/Organization.ts +1085 -0
- package/src/models/OrganizationRegistrationPeriod.ts +54 -0
- package/src/models/PasswordToken.ts +139 -0
- package/src/models/PayconiqPayment.ts +241 -0
- package/src/models/Payment.ts +216 -0
- package/src/models/Platform.ts +76 -0
- package/src/models/RegisterCode.ts +164 -0
- package/src/models/Registration.ts +405 -0
- package/src/models/RegistrationPeriod.ts +55 -0
- package/src/models/STCredit.ts +134 -0
- package/src/models/STInvoice.ts +507 -0
- package/src/models/STPackage.ts +324 -0
- package/src/models/STPendingInvoice.ts +308 -0
- package/src/models/StripeAccount.ts +71 -0
- package/src/models/StripeCheckoutSession.ts +22 -0
- package/src/models/StripePaymentIntent.ts +22 -0
- package/src/models/Ticket.ts +145 -0
- package/src/models/Token.test.ts +69 -0
- package/src/models/Token.ts +269 -0
- package/src/models/UsedRegisterCode.ts +166 -0
- package/src/models/User.ts +445 -0
- package/src/models/UserPermissions.ts +54 -0
- package/src/models/Webshop.ts +206 -0
- package/src/models/WebshopDiscountCode.ts +81 -0
- package/src/models/addresses/City.ts +31 -0
- package/src/models/addresses/PostalCode.test.ts +117 -0
- package/src/models/addresses/PostalCode.ts +164 -0
- package/src/models/addresses/Province.ts +20 -0
- package/src/models/addresses/Street.ts +25 -0
- package/src/models/index.ts +49 -0
- package/src/structures/OrganizationServerMetaData.ts +117 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
|
|
2
|
+
import { Group as GroupStruct, GroupCategory, GroupCategorySettings, GroupGenderType, GroupSettings, OrganizationGenderType, OrganizationType, OrganizationTypeHelper, UmbrellaOrganization } from '@stamhoofd/structures';
|
|
3
|
+
import { Group, Organization } from '../models';
|
|
4
|
+
|
|
5
|
+
export class GroupBuilder {
|
|
6
|
+
organization: Organization
|
|
7
|
+
|
|
8
|
+
constructor(organization: Organization) {
|
|
9
|
+
this.organization = organization
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async build() {
|
|
13
|
+
const oldGroups = await Group.getAll(this.organization.id, this.organization.periodId)
|
|
14
|
+
|
|
15
|
+
if (oldGroups.length === 0) {
|
|
16
|
+
// Setup default groups if possible
|
|
17
|
+
if (this.organization.meta.type == OrganizationType.Youth && this.organization.meta.umbrellaOrganization == UmbrellaOrganization.ScoutsEnGidsenVlaanderen) {
|
|
18
|
+
await this.createSGVGroups()
|
|
19
|
+
} else if (this.organization.meta.type == OrganizationType.Youth && this.organization.meta.umbrellaOrganization == UmbrellaOrganization.ChiroNationaal) {
|
|
20
|
+
await this.createChiroGroups()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Reload
|
|
25
|
+
const groups = await Group.getAll(this.organization.id, this.organization.periodId)
|
|
26
|
+
|
|
27
|
+
// Setup default root groups
|
|
28
|
+
if (this.organization.meta.categories.length <= 2) {
|
|
29
|
+
const sortedGroupIds = groups.map(g => GroupStruct.create(Object.assign({}, g, { privateSettings: null }))).sort(GroupStruct.defaultSort).map(g => g.id)
|
|
30
|
+
|
|
31
|
+
const defaults = this.organization.meta.packages.useActivities ? OrganizationTypeHelper.getDefaultGroupCategories(this.organization.meta.type, this.organization.meta.umbrellaOrganization ?? undefined) : OrganizationTypeHelper.getDefaultGroupCategoriesWithoutActivities(this.organization.meta.type, this.organization.meta.umbrellaOrganization ?? undefined)
|
|
32
|
+
|
|
33
|
+
if (sortedGroupIds.length > 0 && defaults.length == 0) {
|
|
34
|
+
defaults.push(GroupCategory.create({
|
|
35
|
+
settings: GroupCategorySettings.create({
|
|
36
|
+
name: "Leeftijdsgroepen",
|
|
37
|
+
maximumRegistrations: 1
|
|
38
|
+
})
|
|
39
|
+
}))
|
|
40
|
+
}
|
|
41
|
+
this.organization.meta.categories = [GroupCategory.create({ id: "root" }), ...defaults]
|
|
42
|
+
this.organization.meta.rootCategoryId = "root"
|
|
43
|
+
|
|
44
|
+
// Set category ID of the root category
|
|
45
|
+
const filter = defaults.flatMap(d => d.categoryIds)
|
|
46
|
+
this.organization.meta.rootCategory!.categoryIds = defaults.map(d => d.id).filter(id => !filter.includes(id))
|
|
47
|
+
|
|
48
|
+
if (defaults.length > 0) {
|
|
49
|
+
defaults[0].groupIds.push(...sortedGroupIds)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
await this.organization.save()
|
|
53
|
+
} else {
|
|
54
|
+
const newGroups = groups.filter(g => !oldGroups.find(gg => gg.id === g.id))
|
|
55
|
+
const sortedGroupIds = newGroups.map(g => GroupStruct.create(Object.assign({}, g, { privateSettings: null }))).sort(GroupStruct.defaultSort).map(g => g.id)
|
|
56
|
+
let root = this.organization.meta.rootCategory!
|
|
57
|
+
if (root.categoryIds.length > 0) {
|
|
58
|
+
for (const id of root.categoryIds) {
|
|
59
|
+
const f = this.organization.meta.categories.find(c => c.id === id)
|
|
60
|
+
if (f) {
|
|
61
|
+
root = f
|
|
62
|
+
break
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (newGroups.length > 0) {
|
|
68
|
+
root.groupIds.push(...sortedGroupIds)
|
|
69
|
+
await this.organization.save()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async createSGVGroups() {
|
|
75
|
+
const createdGroups: Group[] = []
|
|
76
|
+
const mixedType = this.organization.meta.genderType == OrganizationGenderType.OnlyMale ?
|
|
77
|
+
GroupGenderType.OnlyMale :
|
|
78
|
+
(this.organization.meta.genderType == OrganizationGenderType.OnlyFemale ?
|
|
79
|
+
GroupGenderType.OnlyFemale :
|
|
80
|
+
GroupGenderType.Mixed)
|
|
81
|
+
|
|
82
|
+
const kapoenen = new Group()
|
|
83
|
+
kapoenen.organizationId = this.organization.id
|
|
84
|
+
kapoenen.periodId = this.organization.periodId
|
|
85
|
+
kapoenen.settings = GroupSettings.create({
|
|
86
|
+
name: "Kapoenen",
|
|
87
|
+
genderType: mixedType,
|
|
88
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
89
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
90
|
+
prices: this.organization.meta.defaultPrices,
|
|
91
|
+
minAge: 6,
|
|
92
|
+
maxAge: 7
|
|
93
|
+
})
|
|
94
|
+
await kapoenen.save();
|
|
95
|
+
createdGroups.push(kapoenen);
|
|
96
|
+
|
|
97
|
+
const jin = new Group()
|
|
98
|
+
jin.organizationId = this.organization.id
|
|
99
|
+
jin.periodId = this.organization.periodId
|
|
100
|
+
jin.settings = GroupSettings.create({
|
|
101
|
+
name: "Jin",
|
|
102
|
+
genderType: mixedType,
|
|
103
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
104
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
105
|
+
prices: this.organization.meta.defaultPrices,
|
|
106
|
+
minAge: 17,
|
|
107
|
+
maxAge: 17
|
|
108
|
+
})
|
|
109
|
+
await jin.save();
|
|
110
|
+
createdGroups.push(jin);
|
|
111
|
+
|
|
112
|
+
if (this.organization.meta.genderType == OrganizationGenderType.Mixed) {
|
|
113
|
+
const wouters = new Group()
|
|
114
|
+
wouters.organizationId = this.organization.id
|
|
115
|
+
wouters.periodId = this.organization.periodId
|
|
116
|
+
wouters.settings = GroupSettings.create({
|
|
117
|
+
name: "Wouters",
|
|
118
|
+
genderType: GroupGenderType.Mixed,
|
|
119
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
120
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
121
|
+
prices: this.organization.meta.defaultPrices,
|
|
122
|
+
minAge: 8,
|
|
123
|
+
maxAge: 10
|
|
124
|
+
})
|
|
125
|
+
await wouters.save();
|
|
126
|
+
createdGroups.push(wouters);
|
|
127
|
+
|
|
128
|
+
const jonggivers = new Group()
|
|
129
|
+
jonggivers.organizationId = this.organization.id
|
|
130
|
+
jonggivers.periodId = this.organization.periodId
|
|
131
|
+
jonggivers.settings = GroupSettings.create({
|
|
132
|
+
name: "Jonggivers",
|
|
133
|
+
genderType: GroupGenderType.Mixed,
|
|
134
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
135
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
136
|
+
prices: this.organization.meta.defaultPrices,
|
|
137
|
+
minAge: 11,
|
|
138
|
+
maxAge: 13
|
|
139
|
+
})
|
|
140
|
+
await jonggivers.save();
|
|
141
|
+
createdGroups.push(jonggivers);
|
|
142
|
+
|
|
143
|
+
const givers = new Group()
|
|
144
|
+
givers.organizationId = this.organization.id
|
|
145
|
+
givers.periodId = this.organization.periodId
|
|
146
|
+
givers.settings = GroupSettings.create({
|
|
147
|
+
name: "Givers",
|
|
148
|
+
genderType: GroupGenderType.Mixed,
|
|
149
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
150
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
151
|
+
prices: this.organization.meta.defaultPrices,
|
|
152
|
+
minAge: 14,
|
|
153
|
+
maxAge: 16
|
|
154
|
+
})
|
|
155
|
+
await givers.save();
|
|
156
|
+
createdGroups.push(givers);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (this.organization.meta.genderType == OrganizationGenderType.OnlyFemale || this.organization.meta.genderType == OrganizationGenderType.Separated) {
|
|
160
|
+
const wouters = new Group()
|
|
161
|
+
wouters.organizationId = this.organization.id
|
|
162
|
+
wouters.periodId = this.organization.periodId
|
|
163
|
+
wouters.settings = GroupSettings.create({
|
|
164
|
+
name: "Kabouters",
|
|
165
|
+
genderType: GroupGenderType.OnlyFemale,
|
|
166
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
167
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
168
|
+
prices: this.organization.meta.defaultPrices,
|
|
169
|
+
minAge: 8,
|
|
170
|
+
maxAge: 10
|
|
171
|
+
})
|
|
172
|
+
await wouters.save();
|
|
173
|
+
createdGroups.push(wouters);
|
|
174
|
+
|
|
175
|
+
const jonggivers = new Group()
|
|
176
|
+
jonggivers.organizationId = this.organization.id
|
|
177
|
+
jonggivers.periodId = this.organization.periodId
|
|
178
|
+
jonggivers.settings = GroupSettings.create({
|
|
179
|
+
name: "Jonggidsen",
|
|
180
|
+
genderType: GroupGenderType.OnlyFemale,
|
|
181
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
182
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
183
|
+
prices: this.organization.meta.defaultPrices,
|
|
184
|
+
minAge: 11,
|
|
185
|
+
maxAge: 13
|
|
186
|
+
})
|
|
187
|
+
await jonggivers.save();
|
|
188
|
+
createdGroups.push(jonggivers);
|
|
189
|
+
|
|
190
|
+
const givers = new Group()
|
|
191
|
+
givers.organizationId = this.organization.id
|
|
192
|
+
givers.periodId = this.organization.periodId
|
|
193
|
+
givers.settings = GroupSettings.create({
|
|
194
|
+
name: "Gidsen",
|
|
195
|
+
genderType: GroupGenderType.OnlyFemale,
|
|
196
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
197
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
198
|
+
prices: this.organization.meta.defaultPrices,
|
|
199
|
+
minAge: 14,
|
|
200
|
+
maxAge: 16
|
|
201
|
+
})
|
|
202
|
+
await givers.save();
|
|
203
|
+
createdGroups.push(givers);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (this.organization.meta.genderType == OrganizationGenderType.OnlyMale || this.organization.meta.genderType == OrganizationGenderType.Separated) {
|
|
207
|
+
const wouters = new Group()
|
|
208
|
+
wouters.organizationId = this.organization.id
|
|
209
|
+
wouters.periodId = this.organization.periodId
|
|
210
|
+
wouters.settings = GroupSettings.create({
|
|
211
|
+
name: "Welpen",
|
|
212
|
+
genderType: GroupGenderType.OnlyMale,
|
|
213
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
214
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
215
|
+
prices: this.organization.meta.defaultPrices,
|
|
216
|
+
minAge: 8,
|
|
217
|
+
maxAge: 10
|
|
218
|
+
})
|
|
219
|
+
await wouters.save();
|
|
220
|
+
createdGroups.push(wouters);
|
|
221
|
+
|
|
222
|
+
const jonggivers = new Group()
|
|
223
|
+
jonggivers.organizationId = this.organization.id
|
|
224
|
+
jonggivers.periodId = this.organization.periodId
|
|
225
|
+
jonggivers.settings = GroupSettings.create({
|
|
226
|
+
name: "Jongverkenners",
|
|
227
|
+
genderType: GroupGenderType.OnlyMale,
|
|
228
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
229
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
230
|
+
prices: this.organization.meta.defaultPrices,
|
|
231
|
+
minAge: 11,
|
|
232
|
+
maxAge: 13
|
|
233
|
+
})
|
|
234
|
+
await jonggivers.save();
|
|
235
|
+
createdGroups.push(jonggivers);
|
|
236
|
+
|
|
237
|
+
const givers = new Group()
|
|
238
|
+
givers.organizationId = this.organization.id
|
|
239
|
+
givers.periodId = this.organization.periodId
|
|
240
|
+
givers.settings = GroupSettings.create({
|
|
241
|
+
name: "Verkenners",
|
|
242
|
+
genderType: GroupGenderType.OnlyMale,
|
|
243
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
244
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
245
|
+
prices: this.organization.meta.defaultPrices,
|
|
246
|
+
minAge: 14,
|
|
247
|
+
maxAge: 16
|
|
248
|
+
})
|
|
249
|
+
await givers.save();
|
|
250
|
+
createdGroups.push(givers);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return createdGroups
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async createChiroGroups() {
|
|
257
|
+
const mixedType = this.organization.meta.genderType == OrganizationGenderType.OnlyMale ?
|
|
258
|
+
GroupGenderType.OnlyMale :
|
|
259
|
+
(this.organization.meta.genderType == OrganizationGenderType.OnlyFemale ?
|
|
260
|
+
GroupGenderType.OnlyFemale :
|
|
261
|
+
GroupGenderType.Mixed)
|
|
262
|
+
|
|
263
|
+
const ribbels = new Group()
|
|
264
|
+
ribbels.organizationId = this.organization.id
|
|
265
|
+
ribbels.periodId = this.organization.periodId
|
|
266
|
+
ribbels.settings = GroupSettings.create({
|
|
267
|
+
name: "Ribbels",
|
|
268
|
+
genderType: mixedType,
|
|
269
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
270
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
271
|
+
prices: this.organization.meta.defaultPrices,
|
|
272
|
+
minAge: 6,
|
|
273
|
+
maxAge: 7
|
|
274
|
+
})
|
|
275
|
+
await ribbels.save();
|
|
276
|
+
|
|
277
|
+
const speelclub = new Group()
|
|
278
|
+
speelclub.organizationId = this.organization.id
|
|
279
|
+
speelclub.periodId = this.organization.periodId
|
|
280
|
+
speelclub.settings = GroupSettings.create({
|
|
281
|
+
name: "Speelclub",
|
|
282
|
+
genderType: mixedType,
|
|
283
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
284
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
285
|
+
prices: this.organization.meta.defaultPrices,
|
|
286
|
+
minAge: 8,
|
|
287
|
+
maxAge: 9
|
|
288
|
+
})
|
|
289
|
+
await speelclub.save();
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
const aspis = new Group()
|
|
293
|
+
aspis.organizationId = this.organization.id
|
|
294
|
+
aspis.periodId = this.organization.periodId
|
|
295
|
+
aspis.settings = GroupSettings.create({
|
|
296
|
+
name: "Aspi's",
|
|
297
|
+
genderType: mixedType,
|
|
298
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
299
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
300
|
+
prices: this.organization.meta.defaultPrices,
|
|
301
|
+
minAge: 16,
|
|
302
|
+
maxAge: 17
|
|
303
|
+
})
|
|
304
|
+
await aspis.save();
|
|
305
|
+
|
|
306
|
+
if (this.organization.meta.genderType == OrganizationGenderType.Mixed) {
|
|
307
|
+
const rakwis = new Group()
|
|
308
|
+
rakwis.organizationId = this.organization.id
|
|
309
|
+
rakwis.periodId = this.organization.periodId
|
|
310
|
+
rakwis.settings = GroupSettings.create({
|
|
311
|
+
name: "Rakwi's",
|
|
312
|
+
genderType: GroupGenderType.Mixed,
|
|
313
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
314
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
315
|
+
prices: this.organization.meta.defaultPrices,
|
|
316
|
+
minAge: 10,
|
|
317
|
+
maxAge: 11
|
|
318
|
+
})
|
|
319
|
+
await rakwis.save();
|
|
320
|
+
|
|
321
|
+
const titos = new Group()
|
|
322
|
+
titos.organizationId = this.organization.id
|
|
323
|
+
titos.periodId = this.organization.periodId
|
|
324
|
+
titos.settings = GroupSettings.create({
|
|
325
|
+
name: "Tito's",
|
|
326
|
+
genderType: GroupGenderType.Mixed,
|
|
327
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
328
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
329
|
+
prices: this.organization.meta.defaultPrices,
|
|
330
|
+
minAge: 12,
|
|
331
|
+
maxAge: 13
|
|
332
|
+
})
|
|
333
|
+
await titos.save();
|
|
334
|
+
|
|
335
|
+
const ketis = new Group()
|
|
336
|
+
ketis.organizationId = this.organization.id
|
|
337
|
+
ketis.periodId = this.organization.periodId
|
|
338
|
+
ketis.settings = GroupSettings.create({
|
|
339
|
+
name: "Keti's",
|
|
340
|
+
genderType: GroupGenderType.Mixed,
|
|
341
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
342
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
343
|
+
prices: this.organization.meta.defaultPrices,
|
|
344
|
+
minAge: 14,
|
|
345
|
+
maxAge: 15
|
|
346
|
+
})
|
|
347
|
+
await ketis.save();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (this.organization.meta.genderType == OrganizationGenderType.OnlyFemale || this.organization.meta.genderType == OrganizationGenderType.Separated) {
|
|
351
|
+
const rakwis = new Group()
|
|
352
|
+
rakwis.organizationId = this.organization.id
|
|
353
|
+
rakwis.periodId = this.organization.periodId
|
|
354
|
+
rakwis.settings = GroupSettings.create({
|
|
355
|
+
name: "Kwiks",
|
|
356
|
+
genderType: GroupGenderType.OnlyFemale,
|
|
357
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
358
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
359
|
+
prices: this.organization.meta.defaultPrices,
|
|
360
|
+
minAge: 10,
|
|
361
|
+
maxAge: 11
|
|
362
|
+
})
|
|
363
|
+
await rakwis.save();
|
|
364
|
+
|
|
365
|
+
const titos = new Group()
|
|
366
|
+
titos.organizationId = this.organization.id
|
|
367
|
+
titos.periodId = this.organization.periodId
|
|
368
|
+
titos.settings = GroupSettings.create({
|
|
369
|
+
name: "Toppers",
|
|
370
|
+
genderType: GroupGenderType.OnlyFemale,
|
|
371
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
372
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
373
|
+
prices: this.organization.meta.defaultPrices,
|
|
374
|
+
minAge: 12,
|
|
375
|
+
maxAge: 13
|
|
376
|
+
})
|
|
377
|
+
await titos.save();
|
|
378
|
+
|
|
379
|
+
const ketis = new Group()
|
|
380
|
+
ketis.organizationId = this.organization.id
|
|
381
|
+
ketis.periodId = this.organization.periodId
|
|
382
|
+
ketis.settings = GroupSettings.create({
|
|
383
|
+
name: "Tiptiens",
|
|
384
|
+
genderType: GroupGenderType.OnlyFemale,
|
|
385
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
386
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
387
|
+
prices: this.organization.meta.defaultPrices,
|
|
388
|
+
minAge: 14,
|
|
389
|
+
maxAge: 15
|
|
390
|
+
})
|
|
391
|
+
await ketis.save();
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (this.organization.meta.genderType == OrganizationGenderType.OnlyMale || this.organization.meta.genderType == OrganizationGenderType.Separated) {
|
|
395
|
+
const rakwis = new Group()
|
|
396
|
+
rakwis.organizationId = this.organization.id
|
|
397
|
+
rakwis.periodId = this.organization.periodId
|
|
398
|
+
rakwis.settings = GroupSettings.create({
|
|
399
|
+
name: "Rakkers",
|
|
400
|
+
genderType: GroupGenderType.OnlyMale,
|
|
401
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
402
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
403
|
+
prices: this.organization.meta.defaultPrices,
|
|
404
|
+
minAge: 10,
|
|
405
|
+
maxAge: 11
|
|
406
|
+
})
|
|
407
|
+
await rakwis.save();
|
|
408
|
+
|
|
409
|
+
const titos = new Group()
|
|
410
|
+
titos.organizationId = this.organization.id
|
|
411
|
+
titos.periodId = this.organization.periodId
|
|
412
|
+
titos.settings = GroupSettings.create({
|
|
413
|
+
name: "Tippers",
|
|
414
|
+
genderType: GroupGenderType.OnlyMale,
|
|
415
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
416
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
417
|
+
prices: this.organization.meta.defaultPrices,
|
|
418
|
+
minAge: 12,
|
|
419
|
+
maxAge: 13
|
|
420
|
+
})
|
|
421
|
+
await titos.save();
|
|
422
|
+
|
|
423
|
+
const ketis = new Group()
|
|
424
|
+
ketis.organizationId = this.organization.id
|
|
425
|
+
ketis.periodId = this.organization.periodId
|
|
426
|
+
ketis.settings = GroupSettings.create({
|
|
427
|
+
name: "Kerels",
|
|
428
|
+
genderType: GroupGenderType.OnlyMale,
|
|
429
|
+
startDate: this.organization.meta.defaultStartDate,
|
|
430
|
+
endDate: this.organization.meta.defaultEndDate,
|
|
431
|
+
prices: this.organization.meta.defaultPrices,
|
|
432
|
+
minAge: 14,
|
|
433
|
+
maxAge: 15
|
|
434
|
+
})
|
|
435
|
+
await ketis.save();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
|
|
2
|
+
import { ObjectData } from "@simonbackx/simple-encoding";
|
|
3
|
+
import { Image } from '@stamhoofd/structures';
|
|
4
|
+
import { Formatter } from "@stamhoofd/utility";
|
|
5
|
+
import Handlebars from "handlebars";
|
|
6
|
+
import { Interval } from "luxon";
|
|
7
|
+
|
|
8
|
+
Handlebars.registerHelper('eq', (a, b) => a == b);
|
|
9
|
+
Handlebars.registerHelper('neq', (a, b) => a != b);
|
|
10
|
+
Handlebars.registerHelper('formatPrice', (a) => typeof a === 'number' ? Formatter.price(a) : a);
|
|
11
|
+
Handlebars.registerHelper('formatDate', (a, options) => {
|
|
12
|
+
if (!(a instanceof Date)) {
|
|
13
|
+
return ""
|
|
14
|
+
}
|
|
15
|
+
if (options.hash.format === 'DD-MM-YYYY') {
|
|
16
|
+
return Formatter.dateNumber(a, true).replaceAll("/", "-");
|
|
17
|
+
}
|
|
18
|
+
return Formatter.dateNumber(a, true)
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
Handlebars.registerHelper('or', (...args) => {
|
|
22
|
+
args.pop();
|
|
23
|
+
return !!args.find(a => !!a)
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
Handlebars.registerHelper('and', (...args) => {
|
|
27
|
+
args.pop();
|
|
28
|
+
return args.every(a => !!a)
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Filter string for a given type
|
|
33
|
+
*/
|
|
34
|
+
Handlebars.registerHelper('filterString', (a, options) => {
|
|
35
|
+
if (typeof a !== "string") {
|
|
36
|
+
return ""
|
|
37
|
+
}
|
|
38
|
+
if (options.hash.type === "phone") {
|
|
39
|
+
return Formatter.removeAccents(a).replace(/[^A-Za-z0-9+]+/g, "")
|
|
40
|
+
}
|
|
41
|
+
// Default: alphanumeric
|
|
42
|
+
return Formatter.removeAccents(a).replace(/[^A-Za-z0-9]+/g, "")
|
|
43
|
+
});
|
|
44
|
+
Handlebars.registerHelper('year', (a) => {
|
|
45
|
+
if (!(a instanceof Date)) {
|
|
46
|
+
return ""
|
|
47
|
+
}
|
|
48
|
+
return Formatter.year(a)
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
Handlebars.registerHelper('now', () => {
|
|
52
|
+
return new Date();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
Handlebars.registerHelper('coalesce', (...args) => {
|
|
56
|
+
return args.find(a => a !== null && a !== undefined) ?? null
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
Handlebars.registerHelper('days', (a, b) => {
|
|
60
|
+
if (!(a instanceof Date) || !(b instanceof Date)) {
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
// Calculate absolute amount of days between a and b
|
|
64
|
+
const start = Formatter.luxon(a).set({ hour: 0, minute: 0, second: 0, millisecond: 0 });
|
|
65
|
+
const end = Formatter.luxon(b).set({ hour: 0, minute: 0, second: 0, millisecond: 0 });
|
|
66
|
+
const diff = Interval.fromDateTimes(start, end);
|
|
67
|
+
const days = diff.length('days');
|
|
68
|
+
if (isNaN(days)) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
return days + 1;
|
|
72
|
+
});
|
|
73
|
+
Handlebars.registerHelper('div', (a, b, options) => {
|
|
74
|
+
if (typeof a !== "number" || typeof b !== "number") {
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
if (b == 0) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
if (options.hash.round) {
|
|
81
|
+
return Math.round(a / b);
|
|
82
|
+
}
|
|
83
|
+
return a / b;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
Handlebars.registerHelper('sum', (...args) => {
|
|
87
|
+
args.pop();
|
|
88
|
+
return args.reduce((a, b) => a + b, 0);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
function getNumberValue(obj: any, keys: string[]): number {
|
|
92
|
+
if (typeof obj === "number" && keys.length == 0) {
|
|
93
|
+
return obj;
|
|
94
|
+
}
|
|
95
|
+
if (typeof obj !== "object" || obj === null) {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
if (keys.length == 0) {
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
const key = keys[0]
|
|
102
|
+
if (key === undefined) {
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
105
|
+
return getNumberValue(obj[key], keys.slice(1));
|
|
106
|
+
}
|
|
107
|
+
Handlebars.registerHelper('arraySum', (objects: any[], property) => {
|
|
108
|
+
if (typeof property !== "string") {
|
|
109
|
+
console.warn('arraySum helper: property is not a string')
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
const keys = (property ?? "").split(".");
|
|
113
|
+
return objects.reduce((c, obj) => getNumberValue(obj, keys) + c, 0);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
Handlebars.registerHelper('mul', (a, b) => {
|
|
117
|
+
if (typeof a !== "number" || typeof b !== "number") {
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
return a * b;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
Handlebars.registerHelper('src', (a, options) => {
|
|
124
|
+
const width = options.hash.width || undefined;
|
|
125
|
+
const height = options.hash.height || undefined;
|
|
126
|
+
|
|
127
|
+
if (width !== undefined && typeof width !== "number") {
|
|
128
|
+
console.error('src helper: width is not a number');
|
|
129
|
+
return "";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (height !== undefined && typeof height !== "number") {
|
|
133
|
+
console.error('src helper: height is not a number');
|
|
134
|
+
return "";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
const image = Image.decode(new ObjectData(a, {version: 0}));
|
|
139
|
+
const resolution = image.getResolutionForSize(width as number|undefined, height as number|undefined);
|
|
140
|
+
return resolution.file.getPublicPath()
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.error('src helper:', e);
|
|
143
|
+
return "";
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
Handlebars.registerHelper('src-width', (a, options) => {
|
|
147
|
+
const width = options.hash.width || undefined;
|
|
148
|
+
const height = options.hash.height || undefined;
|
|
149
|
+
|
|
150
|
+
if (width !== undefined && typeof width !== "number") {
|
|
151
|
+
console.error('src-width helper: width is not a number');
|
|
152
|
+
return "";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (height !== undefined && typeof height !== "number") {
|
|
156
|
+
console.error('src-width helper: height is not a number');
|
|
157
|
+
return "";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
const image = Image.decode(new ObjectData(a, {version: 0}));
|
|
162
|
+
const resolution = image.getResolutionForSize(width as number|undefined, height as number|undefined);
|
|
163
|
+
return resolution.width;
|
|
164
|
+
} catch (e) {
|
|
165
|
+
console.error('src-width helper:', e);
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
Handlebars.registerHelper('src-height', (a, options) => {
|
|
170
|
+
const width = options.hash.width || undefined;
|
|
171
|
+
const height = options.hash.height || undefined;
|
|
172
|
+
|
|
173
|
+
if (width !== undefined && typeof width !== "number") {
|
|
174
|
+
console.error('src-height helper: width is not a number');
|
|
175
|
+
return "";
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (height !== undefined && typeof height !== "number") {
|
|
179
|
+
console.error('src-height helper: height is not a number');
|
|
180
|
+
return "";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
const image = Image.decode(new ObjectData(a, {version: 0}));
|
|
185
|
+
const resolution = image.getResolutionForSize(width as number|undefined, height as number|undefined);
|
|
186
|
+
return resolution.height;
|
|
187
|
+
} catch (e) {
|
|
188
|
+
console.error('src-height helper:', e);
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Rander handlebars template
|
|
194
|
+
export function render(htmlTemplate: string, context: any): string | null {
|
|
195
|
+
try {
|
|
196
|
+
const template = Handlebars.compile(htmlTemplate);
|
|
197
|
+
const renderedHtml = template(context);
|
|
198
|
+
return renderedHtml;
|
|
199
|
+
} catch (e) {
|
|
200
|
+
console.error('Failed to render document html', e)
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Address, PaymentMethod, PaymentStatus, STInvoiceItem, STInvoiceMeta } from "@stamhoofd/structures";
|
|
2
|
+
import { AddressFactory } from "../factories/AddressFactory";
|
|
3
|
+
import { Payment } from "../models/Payment";
|
|
4
|
+
import { STInvoice } from "../models/STInvoice";
|
|
5
|
+
import { InvoiceBuilder } from "./InvoiceBuilder";
|
|
6
|
+
|
|
7
|
+
describe("InvoiceBuilder", () => {
|
|
8
|
+
test("Generate a PDF", async () => {
|
|
9
|
+
const invoice = new STInvoice()
|
|
10
|
+
invoice.number = 124
|
|
11
|
+
invoice.meta = STInvoiceMeta.create({
|
|
12
|
+
date: new Date(),
|
|
13
|
+
companyName: "De Testers VZW",
|
|
14
|
+
companyContact: "Jane Doe",
|
|
15
|
+
companyAddress: await new AddressFactory({}).create(),
|
|
16
|
+
companyVATNumber: "BE123412341234"
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const payment = new Payment()
|
|
20
|
+
payment.method = PaymentMethod.Bancontact
|
|
21
|
+
payment.status = PaymentStatus.Succeeded
|
|
22
|
+
payment.price = 123
|
|
23
|
+
await payment.save()
|
|
24
|
+
invoice.paymentId = payment.id
|
|
25
|
+
|
|
26
|
+
for (let index = 0; index < 100; index++) {
|
|
27
|
+
const amount = Math.floor(Math.random()*999) + 1
|
|
28
|
+
const unitPrice = Math.floor(Math.random()*999) + 1
|
|
29
|
+
invoice.meta.items.push(STInvoiceItem.create({
|
|
30
|
+
name: "Dit is een voorbeeld",
|
|
31
|
+
description: "Met wat extra tekst eronder",
|
|
32
|
+
amount,
|
|
33
|
+
unitPrice
|
|
34
|
+
}))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
invoice.meta.items.push(STInvoiceItem.create({
|
|
38
|
+
name: "Iets zonder beschrijving",
|
|
39
|
+
amount: 1,
|
|
40
|
+
unitPrice: 5900
|
|
41
|
+
}))
|
|
42
|
+
|
|
43
|
+
invoice.meta.items.push(STInvoiceItem.create({
|
|
44
|
+
name: "Iets lang met meerdere lijnen. Zowel in de titel als in de beschrijving, dat zou ook altijd moeten werken...",
|
|
45
|
+
description: "Iets lang met meerdere lijnen. Zowel in de titel als in de beschrijving, dat zou ook altijd moeten werken...",
|
|
46
|
+
amount: 1,
|
|
47
|
+
unitPrice: 5900
|
|
48
|
+
}))
|
|
49
|
+
|
|
50
|
+
const builder = new InvoiceBuilder(invoice)
|
|
51
|
+
|
|
52
|
+
const file = await builder.build()
|
|
53
|
+
console.warn(file.getPublicPath())
|
|
54
|
+
|
|
55
|
+
expect(file).toBeDefined()
|
|
56
|
+
});
|
|
57
|
+
});
|