@stamhoofd/models 2.118.1 → 2.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factories/AddressFactory.d.ts.map +1 -0
- package/dist/factories/AddressFactory.js +38 -0
- package/dist/factories/AddressFactory.js.map +1 -0
- package/dist/factories/BalanceItemFactory.d.ts +29 -0
- package/dist/factories/BalanceItemFactory.d.ts.map +1 -0
- package/dist/factories/BalanceItemFactory.js +56 -0
- package/dist/factories/BalanceItemFactory.js.map +1 -0
- package/dist/factories/DocumentTemplateFactory.d.ts +22 -0
- package/dist/factories/DocumentTemplateFactory.d.ts.map +1 -0
- package/dist/factories/DocumentTemplateFactory.js +145 -0
- package/dist/factories/DocumentTemplateFactory.js.map +1 -0
- package/dist/factories/EmailTemplateFactory.d.ts +18 -0
- package/dist/factories/EmailTemplateFactory.d.ts.map +1 -0
- package/dist/factories/EmailTemplateFactory.js +39 -0
- package/dist/factories/EmailTemplateFactory.js.map +1 -0
- package/dist/factories/EmergencyContactFactory.d.ts.map +1 -0
- package/dist/factories/EmergencyContactFactory.js +38 -0
- package/dist/factories/EmergencyContactFactory.js.map +1 -0
- package/dist/factories/EventFactory.d.ts +19 -0
- package/dist/factories/EventFactory.d.ts.map +1 -0
- package/dist/factories/EventFactory.js +31 -0
- package/dist/factories/EventFactory.js.map +1 -0
- package/dist/factories/EventNotificationFactory.d.ts +23 -0
- package/dist/factories/EventNotificationFactory.d.ts.map +1 -0
- package/dist/factories/EventNotificationFactory.js +40 -0
- package/dist/factories/EventNotificationFactory.js.map +1 -0
- package/dist/factories/EventNotificationTypeFactory.d.ts +12 -0
- package/dist/factories/EventNotificationTypeFactory.d.ts.map +1 -0
- package/dist/factories/EventNotificationTypeFactory.js +21 -0
- package/dist/factories/EventNotificationTypeFactory.js.map +1 -0
- package/dist/factories/GroupFactory.d.ts +27 -0
- package/dist/factories/GroupFactory.d.ts.map +1 -0
- package/dist/factories/GroupFactory.js +88 -0
- package/dist/factories/GroupFactory.js.map +1 -0
- package/dist/factories/MemberFactory.d.ts +26 -0
- package/dist/factories/MemberFactory.d.ts.map +1 -0
- package/dist/factories/MemberFactory.js +131 -0
- package/dist/factories/MemberFactory.js.map +1 -0
- package/dist/factories/MemberResponsibilityRecordFactory.d.ts +15 -0
- package/dist/factories/MemberResponsibilityRecordFactory.d.ts.map +1 -0
- package/dist/factories/MemberResponsibilityRecordFactory.js +30 -0
- package/dist/factories/MemberResponsibilityRecordFactory.js.map +1 -0
- package/dist/factories/OrganizationFactory.d.ts +20 -0
- package/dist/factories/OrganizationFactory.d.ts.map +1 -0
- package/dist/factories/OrganizationFactory.js +61 -0
- package/dist/factories/OrganizationFactory.js.map +1 -0
- package/dist/factories/OrganizationRegistrationPeriodFactory.d.ts +13 -0
- package/dist/factories/OrganizationRegistrationPeriodFactory.d.ts.map +1 -0
- package/dist/factories/OrganizationRegistrationPeriodFactory.js +16 -0
- package/dist/factories/OrganizationRegistrationPeriodFactory.js.map +1 -0
- package/dist/factories/OrganizationTagFactory.d.ts.map +1 -0
- package/dist/factories/OrganizationTagFactory.js +19 -0
- package/dist/factories/OrganizationTagFactory.js.map +1 -0
- package/dist/factories/ParentFactory.d.ts.map +1 -0
- package/dist/factories/ParentFactory.js +39 -0
- package/dist/factories/ParentFactory.js.map +1 -0
- package/dist/factories/PlatformEventTypeFactory.d.ts.map +1 -0
- package/dist/factories/PlatformEventTypeFactory.js +23 -0
- package/dist/factories/PlatformEventTypeFactory.js.map +1 -0
- package/dist/factories/PlatformResponsibilityFactory.d.ts.map +1 -0
- package/dist/factories/PlatformResponsibilityFactory.js +21 -0
- package/dist/factories/PlatformResponsibilityFactory.js.map +1 -0
- package/dist/factories/RecordAnswerFactory.d.ts +18 -0
- package/dist/factories/RecordAnswerFactory.d.ts.map +1 -0
- package/dist/factories/RecordAnswerFactory.js +91 -0
- package/dist/factories/RecordAnswerFactory.js.map +1 -0
- package/dist/factories/RecordCategoryFactory.d.ts +11 -0
- package/dist/factories/RecordCategoryFactory.d.ts.map +1 -0
- package/dist/factories/RecordCategoryFactory.js +19 -0
- package/dist/factories/RecordCategoryFactory.js.map +1 -0
- package/dist/factories/RecordFactory.d.ts.map +1 -0
- package/dist/factories/RecordFactory.js +16 -0
- package/dist/factories/RecordFactory.js.map +1 -0
- package/dist/factories/RegisterCodeFactory.d.ts.map +1 -0
- package/dist/factories/RegisterCodeFactory.js +14 -0
- package/dist/factories/RegisterCodeFactory.js.map +1 -0
- package/dist/factories/RegistrationFactory.d.ts +21 -0
- package/dist/factories/RegistrationFactory.d.ts.map +1 -0
- package/dist/factories/RegistrationFactory.js +21 -0
- package/dist/factories/RegistrationFactory.js.map +1 -0
- package/dist/factories/RegistrationPeriodFactory.d.ts +16 -0
- package/dist/factories/RegistrationPeriodFactory.d.ts.map +1 -0
- package/dist/factories/RegistrationPeriodFactory.js +30 -0
- package/dist/factories/RegistrationPeriodFactory.js.map +1 -0
- package/dist/factories/STPackageFactory.d.ts +15 -0
- package/dist/factories/STPackageFactory.d.ts.map +1 -0
- package/dist/factories/STPackageFactory.js +34 -0
- package/dist/factories/STPackageFactory.js.map +1 -0
- package/dist/factories/UserFactory.d.ts +22 -0
- package/dist/factories/UserFactory.d.ts.map +1 -0
- package/dist/factories/UserFactory.js +63 -0
- package/dist/factories/UserFactory.js.map +1 -0
- package/dist/factories/WebshopFactory.d.ts +17 -0
- package/dist/factories/WebshopFactory.d.ts.map +1 -0
- package/dist/factories/WebshopFactory.js +35 -0
- package/dist/factories/WebshopFactory.js.map +1 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +27 -0
- package/dist/factories/index.js.map +1 -0
- package/dist/helpers/DNSValidator.d.ts +6 -0
- package/dist/helpers/DNSValidator.d.ts.map +1 -0
- package/dist/helpers/DNSValidator.js +142 -0
- package/dist/helpers/DNSValidator.js.map +1 -0
- package/dist/helpers/EmailBuilder.d.ts +88 -0
- package/dist/helpers/EmailBuilder.d.ts.map +1 -0
- package/dist/helpers/EmailBuilder.js +603 -0
- package/dist/helpers/EmailBuilder.js.map +1 -0
- package/dist/helpers/Handlebars.d.ts.map +1 -0
- package/dist/helpers/Handlebars.js +244 -0
- package/dist/helpers/Handlebars.js.map +1 -0
- package/dist/helpers/MemberMerger.d.ts.map +1 -0
- package/dist/helpers/MemberMerger.js +364 -0
- package/dist/helpers/MemberMerger.js.map +1 -0
- package/dist/helpers/RateLimiter.d.ts.map +1 -0
- package/dist/helpers/RateLimiter.js +64 -0
- package/dist/helpers/RateLimiter.js.map +1 -0
- package/dist/helpers/WebshopCounter.d.ts +8 -0
- package/dist/helpers/WebshopCounter.d.ts.map +1 -0
- package/dist/helpers/WebshopCounter.js +46 -0
- package/dist/helpers/WebshopCounter.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/1605262045-import-postcodes.d.ts.map +1 -0
- package/dist/migrations/1605262045-import-postcodes.js +117 -0
- package/dist/migrations/1605262045-import-postcodes.js.map +1 -0
- package/dist/migrations/1605262046-import-postcodes-nl.d.ts.map +1 -0
- package/dist/migrations/1605262046-import-postcodes-nl.js +80 -0
- package/dist/migrations/1605262046-import-postcodes-nl.js.map +1 -0
- package/dist/migrations/1720080976-convert-charset-leads.d.ts +10 -0
- package/dist/migrations/1720080976-convert-charset-leads.d.ts.map +1 -0
- package/dist/migrations/1720080976-convert-charset-leads.js +41 -0
- package/dist/migrations/1720080976-convert-charset-leads.js.map +1 -0
- package/dist/models/AuditLog.d.ts.map +1 -0
- package/dist/models/AuditLog.js +94 -0
- package/dist/models/AuditLog.js.map +1 -0
- package/dist/models/BalanceItem.d.ts +218 -0
- package/dist/models/BalanceItem.d.ts.map +1 -0
- package/dist/models/BalanceItem.js +626 -0
- package/dist/models/BalanceItem.js.map +1 -0
- package/dist/models/BalanceItemPayment.d.ts +24 -0
- package/dist/models/BalanceItemPayment.d.ts.map +1 -0
- package/dist/models/BalanceItemPayment.js +65 -0
- package/dist/models/BalanceItemPayment.js.map +1 -0
- package/dist/models/BuckarooPayment.d.ts.map +1 -0
- package/dist/models/BuckarooPayment.js +24 -0
- package/dist/models/BuckarooPayment.js.map +1 -0
- package/dist/models/CachedBalance.d.ts +51 -0
- package/dist/models/CachedBalance.d.ts.map +1 -0
- package/dist/models/CachedBalance.js +390 -0
- package/dist/models/CachedBalance.js.map +1 -0
- package/dist/models/Document.d.ts +41 -0
- package/dist/models/Document.d.ts.map +1 -0
- package/dist/models/Document.js +251 -0
- package/dist/models/Document.js.map +1 -0
- package/dist/models/DocumentTemplate.d.ts +56 -0
- package/dist/models/DocumentTemplate.d.ts.map +1 -0
- package/dist/models/DocumentTemplate.js +719 -0
- package/dist/models/DocumentTemplate.js.map +1 -0
- package/dist/models/Email.d.ts +141 -0
- package/dist/models/Email.d.ts.map +1 -0
- package/dist/models/Email.js +1341 -0
- package/dist/models/Email.js.map +1 -0
- package/dist/models/EmailRecipient.d.ts.map +1 -0
- package/dist/models/EmailRecipient.js +194 -0
- package/dist/models/EmailRecipient.js.map +1 -0
- package/dist/models/EmailTemplate.d.ts +24 -0
- package/dist/models/EmailTemplate.d.ts.map +1 -0
- package/dist/models/EmailTemplate.js +79 -0
- package/dist/models/EmailTemplate.js.map +1 -0
- package/dist/models/EmailVerificationCode.d.ts +61 -0
- package/dist/models/EmailVerificationCode.d.ts.map +1 -0
- package/dist/models/EmailVerificationCode.js +339 -0
- package/dist/models/EmailVerificationCode.js.map +1 -0
- package/dist/models/Event.d.ts.map +1 -0
- package/dist/models/Event.js +132 -0
- package/dist/models/Event.js.map +1 -0
- package/dist/models/EventNotification.d.ts +32 -0
- package/dist/models/EventNotification.d.ts.map +1 -0
- package/dist/models/EventNotification.js +98 -0
- package/dist/models/EventNotification.js.map +1 -0
- package/dist/models/Group.d.ts +46 -0
- package/dist/models/Group.d.ts.map +1 -0
- package/dist/models/Group.js +213 -0
- package/dist/models/Group.js.map +1 -0
- package/dist/models/Image.d.ts +17 -0
- package/dist/models/Image.d.ts.map +1 -0
- package/dist/models/Image.js +169 -0
- package/dist/models/Image.js.map +1 -0
- package/dist/models/Invoice.d.ts.map +1 -0
- package/dist/models/Invoice.js +186 -0
- package/dist/models/Invoice.js.map +1 -0
- package/dist/models/InvoicedBalanceItem.d.ts +66 -0
- package/dist/models/InvoicedBalanceItem.d.ts.map +1 -0
- package/dist/models/InvoicedBalanceItem.js +130 -0
- package/dist/models/InvoicedBalanceItem.js.map +1 -0
- package/dist/models/Member.d.ts +114 -0
- package/dist/models/Member.d.ts.map +1 -0
- package/dist/models/Member.js +415 -0
- package/dist/models/Member.js.map +1 -0
- package/dist/models/MemberPlatformMembership.d.ts +48 -0
- package/dist/models/MemberPlatformMembership.d.ts.map +1 -0
- package/dist/models/MemberPlatformMembership.js +377 -0
- package/dist/models/MemberPlatformMembership.js.map +1 -0
- package/dist/models/MemberResponsibilityRecord.d.ts +17 -0
- package/dist/models/MemberResponsibilityRecord.d.ts.map +1 -0
- package/dist/models/MemberResponsibilityRecord.js +65 -0
- package/dist/models/MemberResponsibilityRecord.js.map +1 -0
- package/dist/models/MemberUser.d.ts.map +1 -0
- package/dist/models/MemberUser.js +22 -0
- package/dist/models/MemberUser.js.map +1 -0
- package/dist/models/MergedMember.d.ts +23 -0
- package/dist/models/MergedMember.d.ts.map +1 -0
- package/dist/models/MergedMember.js +123 -0
- package/dist/models/MergedMember.js.map +1 -0
- package/dist/models/MolliePayment.d.ts.map +1 -0
- package/dist/models/MolliePayment.js +24 -0
- package/dist/models/MolliePayment.js.map +1 -0
- package/dist/models/MollieToken.d.ts +45 -0
- package/dist/models/MollieToken.d.ts.map +1 -0
- package/dist/models/MollieToken.js +330 -0
- package/dist/models/MollieToken.js.map +1 -0
- package/dist/models/OneTimeToken.d.ts +38 -0
- package/dist/models/OneTimeToken.d.ts.map +1 -0
- package/dist/models/OneTimeToken.js +125 -0
- package/dist/models/OneTimeToken.js.map +1 -0
- package/dist/models/Order.d.ts +115 -0
- package/dist/models/Order.d.ts.map +1 -0
- package/dist/models/Order.js +908 -0
- package/dist/models/Order.js.map +1 -0
- package/dist/models/Organization.d.ts +128 -0
- package/dist/models/Organization.d.ts.map +1 -0
- package/dist/models/Organization.js +846 -0
- package/dist/models/Organization.js.map +1 -0
- package/dist/models/OrganizationRegistrationPeriod.d.ts +22 -0
- package/dist/models/OrganizationRegistrationPeriod.d.ts.map +1 -0
- package/dist/models/OrganizationRegistrationPeriod.js +129 -0
- package/dist/models/OrganizationRegistrationPeriod.js.map +1 -0
- package/dist/models/PasswordToken.d.ts +31 -0
- package/dist/models/PasswordToken.d.ts.map +1 -0
- package/dist/models/PasswordToken.js +129 -0
- package/dist/models/PasswordToken.js.map +1 -0
- package/dist/models/PayconiqPayment.d.ts +24 -0
- package/dist/models/PayconiqPayment.d.ts.map +1 -0
- package/dist/models/PayconiqPayment.js +272 -0
- package/dist/models/PayconiqPayment.js.map +1 -0
- package/dist/models/Payment.d.ts +120 -0
- package/dist/models/Payment.d.ts.map +1 -0
- package/dist/models/Payment.js +289 -0
- package/dist/models/Payment.js.map +1 -0
- package/dist/models/Platform.d.ts.map +1 -0
- package/dist/models/Platform.js +178 -0
- package/dist/models/Platform.js.map +1 -0
- package/dist/models/RegisterCode.d.ts.map +1 -0
- package/dist/models/RegisterCode.js +76 -0
- package/dist/models/RegisterCode.js.map +1 -0
- package/dist/models/Registration.d.ts +85 -0
- package/dist/models/Registration.d.ts.map +1 -0
- package/dist/models/Registration.js +190 -0
- package/dist/models/Registration.js.map +1 -0
- package/dist/models/RegistrationPeriod.d.ts.map +1 -0
- package/dist/models/RegistrationPeriod.js +140 -0
- package/dist/models/RegistrationPeriod.js.map +1 -0
- package/dist/models/STCredit.d.ts.map +1 -0
- package/dist/models/STCredit.js +61 -0
- package/dist/models/STCredit.js.map +1 -0
- package/dist/models/STInvoice.d.ts +37 -0
- package/dist/models/STInvoice.d.ts.map +1 -0
- package/dist/models/STInvoice.js +139 -0
- package/dist/models/STInvoice.js.map +1 -0
- package/dist/models/STPackage.d.ts.map +1 -0
- package/dist/models/STPackage.js +276 -0
- package/dist/models/STPackage.js.map +1 -0
- package/dist/models/STPendingInvoice.d.ts +26 -0
- package/dist/models/STPendingInvoice.d.ts.map +1 -0
- package/dist/models/STPendingInvoice.js +68 -0
- package/dist/models/STPendingInvoice.js.map +1 -0
- package/dist/models/StripeAccount.d.ts.map +1 -0
- package/dist/models/StripeAccount.js +81 -0
- package/dist/models/StripeAccount.js.map +1 -0
- package/dist/models/StripeCheckoutSession.d.ts.map +1 -0
- package/dist/models/StripeCheckoutSession.js +35 -0
- package/dist/models/StripeCheckoutSession.js.map +1 -0
- package/dist/models/StripePaymentIntent.d.ts.map +1 -0
- package/dist/models/StripePaymentIntent.js +35 -0
- package/dist/models/StripePaymentIntent.js.map +1 -0
- package/dist/models/Ticket.d.ts +65 -0
- package/dist/models/Ticket.d.ts.map +1 -0
- package/dist/models/Ticket.js +157 -0
- package/dist/models/Ticket.js.map +1 -0
- package/dist/models/Token.d.ts +48 -0
- package/dist/models/Token.d.ts.map +1 -0
- package/dist/models/Token.js +208 -0
- package/dist/models/Token.js.map +1 -0
- package/dist/models/UitpasClientCredential.d.ts.map +1 -0
- package/dist/models/UitpasClientCredential.js +62 -0
- package/dist/models/UitpasClientCredential.js.map +1 -0
- package/dist/models/UsedRegisterCode.d.ts.map +1 -0
- package/dist/models/UsedRegisterCode.js +58 -0
- package/dist/models/UsedRegisterCode.js.map +1 -0
- package/dist/models/User.d.ts +76 -0
- package/dist/models/User.d.ts.map +1 -0
- package/dist/models/User.js +484 -0
- package/dist/models/User.js.map +1 -0
- package/dist/models/UserPermissions.d.ts +16 -0
- package/dist/models/UserPermissions.d.ts.map +1 -0
- package/dist/models/UserPermissions.js +56 -0
- package/dist/models/UserPermissions.js.map +1 -0
- package/dist/models/Webshop.d.ts +45 -0
- package/dist/models/Webshop.d.ts.map +1 -0
- package/dist/models/Webshop.js +187 -0
- package/dist/models/Webshop.js.map +1 -0
- package/dist/models/WebshopDiscountCode.d.ts.map +1 -0
- package/dist/models/WebshopDiscountCode.js +89 -0
- package/dist/models/WebshopDiscountCode.js.map +1 -0
- package/dist/models/WebshopUitpasNumber.d.ts.map +1 -0
- package/dist/models/WebshopUitpasNumber.js +91 -0
- package/dist/models/WebshopUitpasNumber.js.map +1 -0
- package/dist/models/_relations.d.ts +8 -0
- package/dist/models/_relations.d.ts.map +1 -0
- package/dist/models/_relations.js +110 -0
- package/dist/models/_relations.js.map +1 -0
- package/dist/models/addresses/City.d.ts +15 -0
- package/dist/models/addresses/City.d.ts.map +1 -0
- package/dist/models/addresses/City.js +35 -0
- package/dist/models/addresses/City.js.map +1 -0
- package/dist/models/addresses/PostalCode.d.ts +21 -0
- package/dist/models/addresses/PostalCode.d.ts.map +1 -0
- package/dist/models/addresses/PostalCode.js +139 -0
- package/dist/models/addresses/PostalCode.js.map +1 -0
- package/dist/models/addresses/Province.d.ts +9 -0
- package/dist/models/addresses/Province.d.ts.map +1 -0
- package/dist/models/addresses/Province.js +24 -0
- package/dist/models/addresses/Province.js.map +1 -0
- package/dist/models/addresses/Street.d.ts.map +1 -0
- package/dist/models/addresses/Street.js +26 -0
- package/dist/models/addresses/Street.js.map +1 -0
- package/dist/models/index.d.ts +55 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +55 -0
- package/dist/models/index.js.map +1 -0
- package/dist/structures/OrganizationServerMetaData.d.ts.map +1 -0
- package/dist/structures/OrganizationServerMetaData.js +130 -0
- package/dist/structures/OrganizationServerMetaData.js.map +1 -0
- package/package.json +13 -10
- package/src/factories/AddressFactory.ts +3 -2
- package/src/factories/BalanceItemFactory.ts +2 -1
- package/src/factories/DocumentTemplateFactory.ts +2 -1
- package/src/factories/EmailTemplateFactory.ts +3 -2
- package/src/factories/EmergencyContactFactory.ts +1 -1
- package/src/factories/EventFactory.ts +2 -2
- package/src/factories/EventNotificationFactory.ts +6 -4
- package/src/factories/EventNotificationTypeFactory.ts +3 -2
- package/src/factories/GroupFactory.ts +4 -3
- package/src/factories/MemberFactory.ts +6 -5
- package/src/factories/MemberResponsibilityRecordFactory.ts +3 -2
- package/src/factories/OrganizationFactory.ts +4 -2
- package/src/factories/OrganizationRegistrationPeriodFactory.ts +2 -2
- package/src/factories/ParentFactory.ts +1 -1
- package/src/factories/RecordAnswerFactory.ts +2 -1
- package/src/factories/RecordCategoryFactory.ts +4 -2
- package/src/factories/RegistrationFactory.ts +5 -4
- package/src/factories/RegistrationPeriodFactory.ts +2 -1
- package/src/factories/STPackageFactory.ts +1 -1
- package/src/factories/UserFactory.ts +3 -2
- package/src/factories/WebshopFactory.ts +3 -2
- package/src/helpers/DNSValidator.ts +10 -9
- package/src/helpers/EmailBuilder.ts +21 -12
- package/src/helpers/Handlebars.ts +3 -3
- package/src/helpers/MemberMerger.test.ts +1 -1
- package/src/helpers/MemberMerger.ts +5 -4
- package/src/helpers/WebshopCounter.ts +1 -1
- package/src/migrations/1605262045-import-postcodes.ts +1 -1
- package/src/migrations/1605262046-import-postcodes-nl.ts +2 -2
- package/src/migrations/1720080976-convert-charset-leads.ts +53 -0
- package/src/models/AuditLog.ts +2 -1
- package/src/models/BalanceItem.ts +4 -3
- package/src/models/BalanceItemPayment.ts +9 -6
- package/src/models/CachedBalance.test.ts +331 -0
- package/src/models/CachedBalance.ts +3 -2
- package/src/models/Document.ts +2 -2
- package/src/models/DocumentTemplate.ts +5 -3
- package/src/models/Email.test.ts +40 -39
- package/src/models/Email.ts +27 -24
- package/src/models/EmailTemplate.ts +2 -1
- package/src/models/EmailVerificationCode.ts +9 -7
- package/src/models/EventNotification.ts +3 -2
- package/src/models/Group.ts +5 -15
- package/src/models/Image.ts +3 -2
- package/src/models/InvoicedBalanceItem.ts +9 -8
- package/src/models/Member.ts +8 -4
- package/src/models/MemberPlatformMembership.ts +6 -6
- package/src/models/MemberResponsibilityRecord.ts +2 -1
- package/src/models/MergedMember.ts +1 -1
- package/src/models/MollieToken.ts +4 -4
- package/src/models/OneTimeToken.ts +1 -1
- package/src/models/Order.ts +20 -12
- package/src/models/Organization.ts +45 -17
- package/src/models/OrganizationRegistrationPeriod.ts +2 -2
- package/src/models/PasswordToken.ts +7 -5
- package/src/models/PayconiqPayment.ts +8 -5
- package/src/models/Payment.ts +8 -5
- package/src/models/Platform.ts +1 -1
- package/src/models/Registration.ts +9 -97
- package/src/models/STInvoice.ts +1 -4
- package/src/models/STPackage.ts +2 -2
- package/src/models/STPendingInvoice.ts +5 -4
- package/src/models/Ticket.ts +11 -9
- package/src/models/Token.test.ts +2 -2
- package/src/models/Token.ts +6 -6
- package/src/models/User.ts +9 -10
- package/src/models/UserPermissions.ts +7 -6
- package/src/models/Webshop.ts +5 -5
- package/src/models/_relations.ts +133 -0
- package/src/models/addresses/City.ts +1 -1
- package/src/models/addresses/PostalCode.test.ts +1 -1
- package/src/models/addresses/PostalCode.ts +2 -2
- package/src/models/addresses/Province.ts +1 -1
- package/src/models/index.ts +22 -20
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/dist/src/factories/AddressFactory.d.ts.map +0 -1
- package/dist/src/factories/AddressFactory.js +0 -42
- package/dist/src/factories/AddressFactory.js.map +0 -1
- package/dist/src/factories/BalanceItemFactory.d.ts +0 -28
- package/dist/src/factories/BalanceItemFactory.d.ts.map +0 -1
- package/dist/src/factories/BalanceItemFactory.js +0 -60
- package/dist/src/factories/BalanceItemFactory.js.map +0 -1
- package/dist/src/factories/DocumentTemplateFactory.d.ts +0 -21
- package/dist/src/factories/DocumentTemplateFactory.d.ts.map +0 -1
- package/dist/src/factories/DocumentTemplateFactory.js +0 -149
- package/dist/src/factories/DocumentTemplateFactory.js.map +0 -1
- package/dist/src/factories/EmailTemplateFactory.d.ts +0 -18
- package/dist/src/factories/EmailTemplateFactory.d.ts.map +0 -1
- package/dist/src/factories/EmailTemplateFactory.js +0 -43
- package/dist/src/factories/EmailTemplateFactory.js.map +0 -1
- package/dist/src/factories/EmergencyContactFactory.d.ts.map +0 -1
- package/dist/src/factories/EmergencyContactFactory.js +0 -42
- package/dist/src/factories/EmergencyContactFactory.js.map +0 -1
- package/dist/src/factories/EventFactory.d.ts +0 -19
- package/dist/src/factories/EventFactory.d.ts.map +0 -1
- package/dist/src/factories/EventFactory.js +0 -35
- package/dist/src/factories/EventFactory.js.map +0 -1
- package/dist/src/factories/EventNotificationFactory.d.ts +0 -21
- package/dist/src/factories/EventNotificationFactory.d.ts.map +0 -1
- package/dist/src/factories/EventNotificationFactory.js +0 -44
- package/dist/src/factories/EventNotificationFactory.js.map +0 -1
- package/dist/src/factories/EventNotificationTypeFactory.d.ts +0 -11
- package/dist/src/factories/EventNotificationTypeFactory.d.ts.map +0 -1
- package/dist/src/factories/EventNotificationTypeFactory.js +0 -25
- package/dist/src/factories/EventNotificationTypeFactory.js.map +0 -1
- package/dist/src/factories/GroupFactory.d.ts +0 -26
- package/dist/src/factories/GroupFactory.d.ts.map +0 -1
- package/dist/src/factories/GroupFactory.js +0 -92
- package/dist/src/factories/GroupFactory.js.map +0 -1
- package/dist/src/factories/MemberFactory.d.ts +0 -26
- package/dist/src/factories/MemberFactory.d.ts.map +0 -1
- package/dist/src/factories/MemberFactory.js +0 -135
- package/dist/src/factories/MemberFactory.js.map +0 -1
- package/dist/src/factories/MemberResponsibilityRecordFactory.d.ts +0 -14
- package/dist/src/factories/MemberResponsibilityRecordFactory.d.ts.map +0 -1
- package/dist/src/factories/MemberResponsibilityRecordFactory.js +0 -34
- package/dist/src/factories/MemberResponsibilityRecordFactory.js.map +0 -1
- package/dist/src/factories/OrganizationFactory.d.ts +0 -19
- package/dist/src/factories/OrganizationFactory.d.ts.map +0 -1
- package/dist/src/factories/OrganizationFactory.js +0 -64
- package/dist/src/factories/OrganizationFactory.js.map +0 -1
- package/dist/src/factories/OrganizationRegistrationPeriodFactory.d.ts +0 -13
- package/dist/src/factories/OrganizationRegistrationPeriodFactory.d.ts.map +0 -1
- package/dist/src/factories/OrganizationRegistrationPeriodFactory.js +0 -20
- package/dist/src/factories/OrganizationRegistrationPeriodFactory.js.map +0 -1
- package/dist/src/factories/OrganizationTagFactory.d.ts.map +0 -1
- package/dist/src/factories/OrganizationTagFactory.js +0 -23
- package/dist/src/factories/OrganizationTagFactory.js.map +0 -1
- package/dist/src/factories/ParentFactory.d.ts.map +0 -1
- package/dist/src/factories/ParentFactory.js +0 -43
- package/dist/src/factories/ParentFactory.js.map +0 -1
- package/dist/src/factories/PlatformEventTypeFactory.d.ts.map +0 -1
- package/dist/src/factories/PlatformEventTypeFactory.js +0 -27
- package/dist/src/factories/PlatformEventTypeFactory.js.map +0 -1
- package/dist/src/factories/PlatformResponsibilityFactory.d.ts.map +0 -1
- package/dist/src/factories/PlatformResponsibilityFactory.js +0 -25
- package/dist/src/factories/PlatformResponsibilityFactory.js.map +0 -1
- package/dist/src/factories/RecordAnswerFactory.d.ts +0 -17
- package/dist/src/factories/RecordAnswerFactory.d.ts.map +0 -1
- package/dist/src/factories/RecordAnswerFactory.js +0 -95
- package/dist/src/factories/RecordAnswerFactory.js.map +0 -1
- package/dist/src/factories/RecordCategoryFactory.d.ts +0 -11
- package/dist/src/factories/RecordCategoryFactory.d.ts.map +0 -1
- package/dist/src/factories/RecordCategoryFactory.js +0 -23
- package/dist/src/factories/RecordCategoryFactory.js.map +0 -1
- package/dist/src/factories/RecordFactory.d.ts.map +0 -1
- package/dist/src/factories/RecordFactory.js +0 -21
- package/dist/src/factories/RecordFactory.js.map +0 -1
- package/dist/src/factories/RegisterCodeFactory.d.ts.map +0 -1
- package/dist/src/factories/RegisterCodeFactory.js +0 -18
- package/dist/src/factories/RegisterCodeFactory.js.map +0 -1
- package/dist/src/factories/RegistrationFactory.d.ts +0 -21
- package/dist/src/factories/RegistrationFactory.d.ts.map +0 -1
- package/dist/src/factories/RegistrationFactory.js +0 -25
- package/dist/src/factories/RegistrationFactory.js.map +0 -1
- package/dist/src/factories/RegistrationPeriodFactory.d.ts +0 -15
- package/dist/src/factories/RegistrationPeriodFactory.d.ts.map +0 -1
- package/dist/src/factories/RegistrationPeriodFactory.js +0 -34
- package/dist/src/factories/RegistrationPeriodFactory.js.map +0 -1
- package/dist/src/factories/STPackageFactory.d.ts +0 -15
- package/dist/src/factories/STPackageFactory.d.ts.map +0 -1
- package/dist/src/factories/STPackageFactory.js +0 -38
- package/dist/src/factories/STPackageFactory.js.map +0 -1
- package/dist/src/factories/UserFactory.d.ts +0 -22
- package/dist/src/factories/UserFactory.d.ts.map +0 -1
- package/dist/src/factories/UserFactory.js +0 -67
- package/dist/src/factories/UserFactory.js.map +0 -1
- package/dist/src/factories/WebshopFactory.d.ts +0 -16
- package/dist/src/factories/WebshopFactory.d.ts.map +0 -1
- package/dist/src/factories/WebshopFactory.js +0 -39
- package/dist/src/factories/WebshopFactory.js.map +0 -1
- package/dist/src/factories/index.d.ts.map +0 -1
- package/dist/src/factories/index.js +0 -30
- package/dist/src/factories/index.js.map +0 -1
- package/dist/src/helpers/DNSValidator.d.ts +0 -6
- package/dist/src/helpers/DNSValidator.d.ts.map +0 -1
- package/dist/src/helpers/DNSValidator.js +0 -145
- package/dist/src/helpers/DNSValidator.js.map +0 -1
- package/dist/src/helpers/EmailBuilder.d.ts +0 -83
- package/dist/src/helpers/EmailBuilder.d.ts.map +0 -1
- package/dist/src/helpers/EmailBuilder.js +0 -646
- package/dist/src/helpers/EmailBuilder.js.map +0 -1
- package/dist/src/helpers/Handlebars.d.ts.map +0 -1
- package/dist/src/helpers/Handlebars.js +0 -248
- package/dist/src/helpers/Handlebars.js.map +0 -1
- package/dist/src/helpers/MemberMerger.d.ts.map +0 -1
- package/dist/src/helpers/MemberMerger.js +0 -371
- package/dist/src/helpers/MemberMerger.js.map +0 -1
- package/dist/src/helpers/MemberMerger.test.d.ts +0 -2
- package/dist/src/helpers/MemberMerger.test.d.ts.map +0 -1
- package/dist/src/helpers/MemberMerger.test.js +0 -644
- package/dist/src/helpers/MemberMerger.test.js.map +0 -1
- package/dist/src/helpers/RateLimiter.d.ts.map +0 -1
- package/dist/src/helpers/RateLimiter.js +0 -69
- package/dist/src/helpers/RateLimiter.js.map +0 -1
- package/dist/src/helpers/WebshopCounter.d.ts +0 -8
- package/dist/src/helpers/WebshopCounter.d.ts.map +0 -1
- package/dist/src/helpers/WebshopCounter.js +0 -50
- package/dist/src/helpers/WebshopCounter.js.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -14
- package/dist/src/index.js.map +0 -1
- package/dist/src/migrations/1605262045-import-postcodes.js +0 -121
- package/dist/src/migrations/1605262046-import-postcodes-nl.js +0 -83
- package/dist/src/models/AuditLog.d.ts.map +0 -1
- package/dist/src/models/AuditLog.js +0 -98
- package/dist/src/models/AuditLog.js.map +0 -1
- package/dist/src/models/BalanceItem.d.ts +0 -217
- package/dist/src/models/BalanceItem.d.ts.map +0 -1
- package/dist/src/models/BalanceItem.js +0 -630
- package/dist/src/models/BalanceItem.js.map +0 -1
- package/dist/src/models/BalanceItemPayment.d.ts +0 -23
- package/dist/src/models/BalanceItemPayment.d.ts.map +0 -1
- package/dist/src/models/BalanceItemPayment.js +0 -70
- package/dist/src/models/BalanceItemPayment.js.map +0 -1
- package/dist/src/models/BuckarooPayment.d.ts.map +0 -1
- package/dist/src/models/BuckarooPayment.js +0 -28
- package/dist/src/models/BuckarooPayment.js.map +0 -1
- package/dist/src/models/CachedBalance.d.ts +0 -50
- package/dist/src/models/CachedBalance.d.ts.map +0 -1
- package/dist/src/models/CachedBalance.js +0 -394
- package/dist/src/models/CachedBalance.js.map +0 -1
- package/dist/src/models/Document.d.ts +0 -41
- package/dist/src/models/Document.d.ts.map +0 -1
- package/dist/src/models/Document.js +0 -255
- package/dist/src/models/Document.js.map +0 -1
- package/dist/src/models/DocumentTemplate.d.ts +0 -55
- package/dist/src/models/DocumentTemplate.d.ts.map +0 -1
- package/dist/src/models/DocumentTemplate.js +0 -723
- package/dist/src/models/DocumentTemplate.js.map +0 -1
- package/dist/src/models/DocumentTemplate.test.d.ts +0 -2
- package/dist/src/models/DocumentTemplate.test.d.ts.map +0 -1
- package/dist/src/models/DocumentTemplate.test.js +0 -57
- package/dist/src/models/DocumentTemplate.test.js.map +0 -1
- package/dist/src/models/Email.d.ts +0 -140
- package/dist/src/models/Email.d.ts.map +0 -1
- package/dist/src/models/Email.js +0 -1345
- package/dist/src/models/Email.js.map +0 -1
- package/dist/src/models/Email.test.d.ts +0 -2
- package/dist/src/models/Email.test.d.ts.map +0 -1
- package/dist/src/models/Email.test.js +0 -1036
- package/dist/src/models/Email.test.js.map +0 -1
- package/dist/src/models/EmailRecipient.d.ts.map +0 -1
- package/dist/src/models/EmailRecipient.js +0 -198
- package/dist/src/models/EmailRecipient.js.map +0 -1
- package/dist/src/models/EmailTemplate.d.ts +0 -23
- package/dist/src/models/EmailTemplate.d.ts.map +0 -1
- package/dist/src/models/EmailTemplate.js +0 -83
- package/dist/src/models/EmailTemplate.js.map +0 -1
- package/dist/src/models/EmailVerificationCode.d.ts +0 -59
- package/dist/src/models/EmailVerificationCode.d.ts.map +0 -1
- package/dist/src/models/EmailVerificationCode.js +0 -343
- package/dist/src/models/EmailVerificationCode.js.map +0 -1
- package/dist/src/models/Event.d.ts.map +0 -1
- package/dist/src/models/Event.js +0 -136
- package/dist/src/models/Event.js.map +0 -1
- package/dist/src/models/EventNotification.d.ts +0 -31
- package/dist/src/models/EventNotification.d.ts.map +0 -1
- package/dist/src/models/EventNotification.js +0 -102
- package/dist/src/models/EventNotification.js.map +0 -1
- package/dist/src/models/Group.d.ts +0 -45
- package/dist/src/models/Group.d.ts.map +0 -1
- package/dist/src/models/Group.js +0 -228
- package/dist/src/models/Group.js.map +0 -1
- package/dist/src/models/Image.d.ts +0 -16
- package/dist/src/models/Image.d.ts.map +0 -1
- package/dist/src/models/Image.js +0 -173
- package/dist/src/models/Image.js.map +0 -1
- package/dist/src/models/Invoice.d.ts.map +0 -1
- package/dist/src/models/Invoice.js +0 -190
- package/dist/src/models/Invoice.js.map +0 -1
- package/dist/src/models/InvoicedBalanceItem.d.ts +0 -66
- package/dist/src/models/InvoicedBalanceItem.d.ts.map +0 -1
- package/dist/src/models/InvoicedBalanceItem.js +0 -136
- package/dist/src/models/InvoicedBalanceItem.js.map +0 -1
- package/dist/src/models/Member.d.ts +0 -112
- package/dist/src/models/Member.d.ts.map +0 -1
- package/dist/src/models/Member.js +0 -415
- package/dist/src/models/Member.js.map +0 -1
- package/dist/src/models/MemberPlatformMembership.d.ts +0 -48
- package/dist/src/models/MemberPlatformMembership.d.ts.map +0 -1
- package/dist/src/models/MemberPlatformMembership.js +0 -381
- package/dist/src/models/MemberPlatformMembership.js.map +0 -1
- package/dist/src/models/MemberResponsibilityRecord.d.ts +0 -16
- package/dist/src/models/MemberResponsibilityRecord.d.ts.map +0 -1
- package/dist/src/models/MemberResponsibilityRecord.js +0 -69
- package/dist/src/models/MemberResponsibilityRecord.js.map +0 -1
- package/dist/src/models/MemberUser.d.ts.map +0 -1
- package/dist/src/models/MemberUser.js +0 -26
- package/dist/src/models/MemberUser.js.map +0 -1
- package/dist/src/models/MergedMember.d.ts +0 -23
- package/dist/src/models/MergedMember.d.ts.map +0 -1
- package/dist/src/models/MergedMember.js +0 -127
- package/dist/src/models/MergedMember.js.map +0 -1
- package/dist/src/models/MolliePayment.d.ts.map +0 -1
- package/dist/src/models/MolliePayment.js +0 -28
- package/dist/src/models/MolliePayment.js.map +0 -1
- package/dist/src/models/MollieToken.d.ts +0 -45
- package/dist/src/models/MollieToken.d.ts.map +0 -1
- package/dist/src/models/MollieToken.js +0 -334
- package/dist/src/models/MollieToken.js.map +0 -1
- package/dist/src/models/OneTimeToken.d.ts +0 -38
- package/dist/src/models/OneTimeToken.d.ts.map +0 -1
- package/dist/src/models/OneTimeToken.js +0 -129
- package/dist/src/models/OneTimeToken.js.map +0 -1
- package/dist/src/models/Order.d.ts +0 -112
- package/dist/src/models/Order.d.ts.map +0 -1
- package/dist/src/models/Order.js +0 -906
- package/dist/src/models/Order.js.map +0 -1
- package/dist/src/models/Organization.d.ts +0 -120
- package/dist/src/models/Organization.d.ts.map +0 -1
- package/dist/src/models/Organization.js +0 -828
- package/dist/src/models/Organization.js.map +0 -1
- package/dist/src/models/OrganizationRegistrationPeriod.d.ts +0 -22
- package/dist/src/models/OrganizationRegistrationPeriod.d.ts.map +0 -1
- package/dist/src/models/OrganizationRegistrationPeriod.js +0 -133
- package/dist/src/models/OrganizationRegistrationPeriod.js.map +0 -1
- package/dist/src/models/PasswordToken.d.ts +0 -30
- package/dist/src/models/PasswordToken.d.ts.map +0 -1
- package/dist/src/models/PasswordToken.js +0 -133
- package/dist/src/models/PasswordToken.js.map +0 -1
- package/dist/src/models/PayconiqPayment.d.ts +0 -22
- package/dist/src/models/PayconiqPayment.d.ts.map +0 -1
- package/dist/src/models/PayconiqPayment.js +0 -276
- package/dist/src/models/PayconiqPayment.js.map +0 -1
- package/dist/src/models/Payment.d.ts +0 -117
- package/dist/src/models/Payment.d.ts.map +0 -1
- package/dist/src/models/Payment.js +0 -293
- package/dist/src/models/Payment.js.map +0 -1
- package/dist/src/models/Platform.d.ts.map +0 -1
- package/dist/src/models/Platform.js +0 -182
- package/dist/src/models/Platform.js.map +0 -1
- package/dist/src/models/Platform.test.d.ts +0 -2
- package/dist/src/models/Platform.test.d.ts.map +0 -1
- package/dist/src/models/Platform.test.js +0 -90
- package/dist/src/models/Platform.test.js.map +0 -1
- package/dist/src/models/RegisterCode.d.ts.map +0 -1
- package/dist/src/models/RegisterCode.js +0 -80
- package/dist/src/models/RegisterCode.js.map +0 -1
- package/dist/src/models/Registration.d.ts +0 -93
- package/dist/src/models/Registration.d.ts.map +0 -1
- package/dist/src/models/Registration.js +0 -267
- package/dist/src/models/Registration.js.map +0 -1
- package/dist/src/models/RegistrationPeriod.d.ts.map +0 -1
- package/dist/src/models/RegistrationPeriod.js +0 -144
- package/dist/src/models/RegistrationPeriod.js.map +0 -1
- package/dist/src/models/STCredit.d.ts.map +0 -1
- package/dist/src/models/STCredit.js +0 -65
- package/dist/src/models/STCredit.js.map +0 -1
- package/dist/src/models/STInvoice.d.ts +0 -37
- package/dist/src/models/STInvoice.d.ts.map +0 -1
- package/dist/src/models/STInvoice.js +0 -145
- package/dist/src/models/STInvoice.js.map +0 -1
- package/dist/src/models/STPackage.d.ts.map +0 -1
- package/dist/src/models/STPackage.js +0 -280
- package/dist/src/models/STPackage.js.map +0 -1
- package/dist/src/models/STPendingInvoice.d.ts +0 -26
- package/dist/src/models/STPendingInvoice.d.ts.map +0 -1
- package/dist/src/models/STPendingInvoice.js +0 -73
- package/dist/src/models/STPendingInvoice.js.map +0 -1
- package/dist/src/models/StripeAccount.d.ts.map +0 -1
- package/dist/src/models/StripeAccount.js +0 -85
- package/dist/src/models/StripeAccount.js.map +0 -1
- package/dist/src/models/StripeCheckoutSession.d.ts.map +0 -1
- package/dist/src/models/StripeCheckoutSession.js +0 -39
- package/dist/src/models/StripeCheckoutSession.js.map +0 -1
- package/dist/src/models/StripePaymentIntent.d.ts.map +0 -1
- package/dist/src/models/StripePaymentIntent.js +0 -39
- package/dist/src/models/StripePaymentIntent.js.map +0 -1
- package/dist/src/models/Ticket.d.ts +0 -63
- package/dist/src/models/Ticket.d.ts.map +0 -1
- package/dist/src/models/Ticket.js +0 -162
- package/dist/src/models/Ticket.js.map +0 -1
- package/dist/src/models/Token.d.ts +0 -48
- package/dist/src/models/Token.d.ts.map +0 -1
- package/dist/src/models/Token.js +0 -212
- package/dist/src/models/Token.js.map +0 -1
- package/dist/src/models/Token.test.d.ts +0 -2
- package/dist/src/models/Token.test.d.ts.map +0 -1
- package/dist/src/models/Token.test.js +0 -60
- package/dist/src/models/Token.test.js.map +0 -1
- package/dist/src/models/UitpasClientCredential.d.ts.map +0 -1
- package/dist/src/models/UitpasClientCredential.js +0 -66
- package/dist/src/models/UitpasClientCredential.js.map +0 -1
- package/dist/src/models/UsedRegisterCode.d.ts.map +0 -1
- package/dist/src/models/UsedRegisterCode.js +0 -62
- package/dist/src/models/UsedRegisterCode.js.map +0 -1
- package/dist/src/models/User.d.ts +0 -77
- package/dist/src/models/User.d.ts.map +0 -1
- package/dist/src/models/User.js +0 -490
- package/dist/src/models/User.js.map +0 -1
- package/dist/src/models/UserPermissions.d.ts +0 -16
- package/dist/src/models/UserPermissions.d.ts.map +0 -1
- package/dist/src/models/UserPermissions.js +0 -61
- package/dist/src/models/UserPermissions.js.map +0 -1
- package/dist/src/models/Webshop.d.ts +0 -45
- package/dist/src/models/Webshop.d.ts.map +0 -1
- package/dist/src/models/Webshop.js +0 -192
- package/dist/src/models/Webshop.js.map +0 -1
- package/dist/src/models/WebshopDiscountCode.d.ts.map +0 -1
- package/dist/src/models/WebshopDiscountCode.js +0 -93
- package/dist/src/models/WebshopDiscountCode.js.map +0 -1
- package/dist/src/models/WebshopUitpasNumber.d.ts.map +0 -1
- package/dist/src/models/WebshopUitpasNumber.js +0 -95
- package/dist/src/models/WebshopUitpasNumber.js.map +0 -1
- package/dist/src/models/addresses/City.d.ts +0 -15
- package/dist/src/models/addresses/City.d.ts.map +0 -1
- package/dist/src/models/addresses/City.js +0 -39
- package/dist/src/models/addresses/City.js.map +0 -1
- package/dist/src/models/addresses/PostalCode.d.ts +0 -21
- package/dist/src/models/addresses/PostalCode.d.ts.map +0 -1
- package/dist/src/models/addresses/PostalCode.js +0 -143
- package/dist/src/models/addresses/PostalCode.js.map +0 -1
- package/dist/src/models/addresses/PostalCode.test.d.ts +0 -2
- package/dist/src/models/addresses/PostalCode.test.d.ts.map +0 -1
- package/dist/src/models/addresses/PostalCode.test.js +0 -98
- package/dist/src/models/addresses/PostalCode.test.js.map +0 -1
- package/dist/src/models/addresses/Province.d.ts +0 -9
- package/dist/src/models/addresses/Province.d.ts.map +0 -1
- package/dist/src/models/addresses/Province.js +0 -28
- package/dist/src/models/addresses/Province.js.map +0 -1
- package/dist/src/models/addresses/Street.d.ts.map +0 -1
- package/dist/src/models/addresses/Street.js +0 -30
- package/dist/src/models/addresses/Street.js.map +0 -1
- package/dist/src/models/index.d.ts +0 -54
- package/dist/src/models/index.d.ts.map +0 -1
- package/dist/src/models/index.js +0 -69
- package/dist/src/models/index.js.map +0 -1
- package/dist/src/structures/OrganizationServerMetaData.d.ts.map +0 -1
- package/dist/src/structures/OrganizationServerMetaData.js +0 -135
- package/dist/src/structures/OrganizationServerMetaData.js.map +0 -1
- package/dist/tests/jest.global.setup.d.ts +0 -3
- package/dist/tests/jest.global.setup.d.ts.map +0 -1
- package/dist/tests/jest.global.setup.js +0 -33
- package/dist/tests/jest.global.setup.js.map +0 -1
- package/dist/tests/jest.setup.d.ts +0 -2
- package/dist/tests/jest.setup.d.ts.map +0 -1
- package/dist/tests/jest.setup.js +0 -32
- package/dist/tests/jest.setup.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- /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/factories → factories}/AddressFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/EmergencyContactFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/OrganizationTagFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/ParentFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/PlatformEventTypeFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/PlatformResponsibilityFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/RecordFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/RegisterCodeFactory.d.ts +0 -0
- /package/dist/{src/factories → factories}/index.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/Handlebars.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/MemberMerger.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/RateLimiter.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/migrations → migrations}/1593773929-create-initial-tables.sql +0 -0
- /package/dist/{src/migrations → migrations}/1605261999-gemeenten-tmp.sql +0 -0
- /package/dist/{src/migrations → migrations}/1605262045-import-postcodes.d.ts +0 -0
- /package/dist/{src/migrations → migrations}/1605262046-import-postcodes-nl.d.ts +0 -0
- /package/dist/{src/migrations → migrations}/1605279038-drop-gemeenten-tmp.sql +0 -0
- /package/dist/{src/migrations → migrations}/1708607340-tickets-deleted-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1710459176-register-code-invoices.sql +0 -0
- /package/dist/{src/migrations → migrations}/1712158247-discount-codes.sql +0 -0
- /package/dist/{src/migrations → migrations}/1713178665-drop-invites.sql +0 -0
- /package/dist/{src/migrations → migrations}/1713178666-drop-keychain.sql +0 -0
- /package/dist/{src/migrations → migrations}/1713178667-drop-challenges.sql +0 -0
- /package/dist/{src/migrations → migrations}/1713178668-drop-user-keys.sql +0 -0
- /package/dist/{src/migrations → migrations}/1713178669-drop-organization-key.sql +0 -0
- /package/dist/{src/migrations → migrations}/1714985451-user-nullable-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1714985452-email-verification-code-nullable-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1714985453-user-organization-permissions.sql +0 -0
- /package/dist/{src/migrations → migrations}/1714985454-user-organization-permissions.sql +0 -0
- /package/dist/{src/migrations → migrations}/1715079362-platform.sql +0 -0
- /package/dist/{src/migrations → migrations}/1715181649-registrations-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1715181650-registrations-organization-id-fill.sql +0 -0
- /package/dist/{src/migrations → migrations}/1715181651-registrations-organization-id-drop-null.sql +0 -0
- /package/dist/{src/migrations → migrations}/1716117067-members-nullable-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719567581-registration-periods.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719567582-organization-registration-periods.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719567881-organization-periodId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719567882-groups-periodId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719567883-platform-periodId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719568079-default-period.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719568080-set-default-period-platform.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719568081-set-default-period-organizations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719568082-set-default-period-groups.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719580828-registrations-periodId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719580829-set-default-period-registrations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1719931362-groups-default-age-group-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1720080975-convert-charset.sql +0 -0
- /package/dist/{src/migrations → migrations}/1720080976-responsibilities.sql +0 -0
- /package/dist/{src/migrations → migrations}/1720088136-member-membership-types.sql +0 -0
- /package/dist/{src/migrations → migrations}/1720088137-member-membership-types-expire-date.sql +0 -0
- /package/dist/{src/migrations → migrations}/1720444931-organization-active.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721050380-email-table.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721050381-email-recipients-table.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721342679-responsibility-groupId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721342680-responsibility-groupId-foreign-key.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721400546-users-memberId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721639159-membership-deleted-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721639160-membership-generated.sql +0 -0
- /package/dist/{src/migrations → migrations}/1721841819-group-type.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722090482-events.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722269236-group-waitinglist-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722525785-balance-item-paying-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722525787-depending-balance-item.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722845608-registration-stock-reservations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722845609-group-stock-reservations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722852362-stripe-intents-account-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722852363-stripe-checkout-sessions-account-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722959111-allow-multiple-registrations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1722963554-registration-group-price-and-options.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723202125-member-number.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723202126-member-number-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723218160-balance-item-unit-price.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723218161-balance-item-amount.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723218162-balance-item-type.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723218163-balance-item-type-defaults.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723218164-balance-item-relations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723652795-payments-paying-user-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723652796-payments-paying-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723652797-payments-paying-organization-id-fk.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723652798-payments-customer.sql +0 -0
- /package/dist/{src/migrations → migrations}/1723736282-merged-members.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724076162-setup-steps.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724156666-member-indexes.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724156667-organization-tag-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724256125-membership-balance-item-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724256126-membership-balance-item-fk.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724258844-membershipOrganizationId.sql +0 -0
- /package/dist/{src/migrations → migrations}/1724258845-membershipOrganizationId-fk.sql +0 -0
- /package/dist/{src/migrations → migrations}/1726054851-balance-item-price-pending.sql +0 -0
- /package/dist/{src/migrations → migrations}/1726054852-cached-outstanding-balances.sql +0 -0
- /package/dist/{src/migrations → migrations}/1726668114-maximum-free-amount.sql +0 -0
- /package/dist/{src/migrations → migrations}/1726668115-free-amount.sql +0 -0
- /package/dist/{src/migrations → migrations}/1726668116-price-without-discount.sql +0 -0
- /package/dist/{src/migrations → migrations}/1727947041-registration-record-answers.sql +0 -0
- /package/dist/{src/migrations → migrations}/1729251385-order-extra-filter-columns.sql +0 -0
- /package/dist/{src/migrations → migrations}/1732285080-audit-logs.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733129611-clear-audit-logs.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733129612-audit-logs-source.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733317908-added-missing-organization-fk-on-registrations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733317909-paying-organization-id-registrations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733317910-paying-organization-id-fk.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733410641-audit-log-external-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733418667-desc-audit-log-primary-key.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733909398-balance-items-due-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733909399-recalculate-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1733994454-balance-item-price-open.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734084689-payment-type.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734084690-move-payment-column-order.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734084691-fill-payment-type-refunds.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734084692-fill-payment-type-reallocations.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734429094-registration-trial-until.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734429095-membership-trial-until.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734535120-registration-period-previous-period-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734535121-platform-previous-period-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734626607-cached-balance-amount-open.sql +0 -0
- /package/dist/{src/migrations → migrations}/1734698906-cached-balance-amount-paid.sql +0 -0
- /package/dist/{src/migrations → migrations}/1735573520-emails-email-type.sql +0 -0
- /package/dist/{src/migrations → migrations}/1735573521-email-recipients-email-type.sql +0 -0
- /package/dist/{src/migrations → migrations}/1735573522-emails-indexes.sql +0 -0
- /package/dist/{src/migrations → migrations}/1735982691-cached-balance-email-reminder-counts.sql +0 -0
- /package/dist/{src/migrations → migrations}/1736850097-audit-logs-meta.sql +0 -0
- /package/dist/{src/migrations → migrations}/1736947931-platform-server-config.sql +0 -0
- /package/dist/{src/migrations → migrations}/1738922428-membership-locked.sql +0 -0
- /package/dist/{src/migrations → migrations}/1739017508-event-notifications.sql +0 -0
- /package/dist/{src/migrations → migrations}/1739017509-event-notifications-link.sql +0 -0
- /package/dist/{src/migrations → migrations}/1739282590-event-notifications-submitted-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1741954610-event-notifications-accepted-record-answers.sql +0 -0
- /package/dist/{src/migrations → migrations}/1742579832-audit-log-longer-object-size.sql +0 -0
- /package/dist/{src/migrations → migrations}/1747913433-registration-discounts.sql +0 -0
- /package/dist/{src/migrations → migrations}/1747996262-balance-items-paid-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1747996263-balance-items-paid-at-fill.sql +0 -0
- /package/dist/{src/migrations → migrations}/1751633220-create-uitpas-client-credentials.sql +0 -0
- /package/dist/{src/migrations → migrations}/1751970372-create-webshop-uitpas-numbers.sql +0 -0
- /package/dist/{src/migrations → migrations}/1752655335-events-webshop-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1752678047-confirmation-email.sql +0 -0
- /package/dist/{src/migrations → migrations}/1753363434-service-fees.sql +0 -0
- /package/dist/{src/migrations → migrations}/1753430415-update-webshop-uitpasnumbers.sql +0 -0
- /package/dist/{src/migrations → migrations}/1755529026-email-sender-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1755789797-email-counts-errors.sql +0 -0
- /package/dist/{src/migrations → migrations}/1755789798-email-recipient-errors.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756115313-email-recipient-ids-and-errors.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756115314-email-recipient-email-optional.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756115315-email-recipients-count.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756115316-email-cached-counts.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756115317-email-deleted-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756293494-registration-period-next-period-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756293495-platform-next-period-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756387016-registration-period-custom-name.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756391212-email-recipients-duplicate.sql +0 -0
- /package/dist/{src/migrations → migrations}/1756821154-email-send-as-email.sql +0 -0
- /package/dist/{src/migrations → migrations}/1758034021-email-recipient-previous-error.sql +0 -0
- /package/dist/{src/migrations → migrations}/1760535508-update-cached-balances-object-id-unique-constraint.sql +0 -0
- /package/dist/{src/migrations → migrations}/1761750780-renamed-invoice-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1761750781-rename-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1761750782-invoices-add-organization-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1761750783-invoices-organization-id-fk.sql +0 -0
- /package/dist/{src/migrations → migrations}/1762521336-did-send-peppol.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216321-multiply-balance-item-payments.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216322-multiply-balance-items.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216323-bigint-cached-balances.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216324-multiply-cached-balances.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216325-multiply-member-platform-memberships.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216326-multiply-payments.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216327-multiply-register-codes.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216328-multiply-credits.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216329-multiply-orders.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216330-multiply-uitpas-numbers.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216331-balance-item-vat-percentages.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216332-balance-item-price-total.sql +0 -0
- /package/dist/{src/migrations → migrations}/1763216333-balance-item-price-total-fill.sql +0 -0
- /package/dist/{src/migrations → migrations}/1765895470-document-year.sql +0 -0
- /package/dist/{src/migrations → migrations}/1766150401-document-published-at.sql +0 -0
- /package/dist/{src/migrations → migrations}/1766410598-registration-end-date.sql +0 -0
- /package/dist/{src/migrations → migrations}/1769087807-invoices-table.sql +0 -0
- /package/dist/{src/migrations → migrations}/1769087808-invoiced-balance-items-table.sql +0 -0
- /package/dist/{src/migrations → migrations}/1769087809-payments-invoice-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1769621227-payments-rounding-amount.sql +0 -0
- /package/dist/{src/migrations → migrations}/1770917406-create-cached-balances-global-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1770917407-create-member-name-ordering-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1770917408-create-member-name-ordering-index-desc.sql +0 -0
- /package/dist/{src/migrations → migrations}/1770917409-create-member-age-ordering-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1770917410-create-member-age-ordering-index-desc.sql +0 -0
- /package/dist/{src/migrations → migrations}/1770917411-drop-duplicate-member-indexes.sql +0 -0
- /package/dist/{src/migrations → migrations}/1771510518-events-index-organization-id-start-date.sql +0 -0
- /package/dist/{src/migrations → migrations}/1771918307-membership-active-filter-index.sql +0 -0
- /package/dist/{src/migrations → migrations}/1772033555-balance-item-package-id.sql +0 -0
- /package/dist/{src/migrations → migrations}/1772033715-balance-item-start-end-date.sql +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Drenthe +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Flevoland +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Friesland +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Gelderland +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Groningen +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Limburg +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Noord-Brabant +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Noord-Holland +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Overrijsel +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Utrecht +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Zeeland +0 -0
- /package/dist/{src/migrations → migrations}/data/postcodes/nl/Zuid-Holland +0 -0
- /package/dist/{src/models → models}/AuditLog.d.ts +0 -0
- /package/dist/{src/models → models}/BuckarooPayment.d.ts +0 -0
- /package/dist/{src/models → models}/EmailRecipient.d.ts +0 -0
- /package/dist/{src/models → models}/Event.d.ts +0 -0
- /package/dist/{src/models → models}/Invoice.d.ts +0 -0
- /package/dist/{src/models → models}/MemberUser.d.ts +0 -0
- /package/dist/{src/models → models}/MolliePayment.d.ts +0 -0
- /package/dist/{src/models → models}/Platform.d.ts +0 -0
- /package/dist/{src/models → models}/RegisterCode.d.ts +0 -0
- /package/dist/{src/models → models}/RegistrationPeriod.d.ts +0 -0
- /package/dist/{src/models → models}/STCredit.d.ts +0 -0
- /package/dist/{src/models → models}/STPackage.d.ts +0 -0
- /package/dist/{src/models → models}/StripeAccount.d.ts +0 -0
- /package/dist/{src/models → models}/StripeCheckoutSession.d.ts +0 -0
- /package/dist/{src/models → models}/StripePaymentIntent.d.ts +0 -0
- /package/dist/{src/models → models}/UitpasClientCredential.d.ts +0 -0
- /package/dist/{src/models → models}/UsedRegisterCode.d.ts +0 -0
- /package/dist/{src/models → models}/WebshopDiscountCode.d.ts +0 -0
- /package/dist/{src/models → models}/WebshopUitpasNumber.d.ts +0 -0
- /package/dist/{src/models → models}/addresses/Street.d.ts +0 -0
- /package/dist/{src/structures → structures}/OrganizationServerMetaData.d.ts +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GroupCategory } from '@stamhoofd/structures';
|
|
2
|
+
import { GroupPrivateSettings, GroupSettings, GroupStatus, Group as GroupStruct, GroupType, StockReservation } from '@stamhoofd/structures';
|
|
3
|
+
import { QueryableModel } from '@stamhoofd/sql';
|
|
4
|
+
import type { OrganizationRegistrationPeriod } from './OrganizationRegistrationPeriod.js';
|
|
5
|
+
export declare class Group extends QueryableModel {
|
|
6
|
+
static table: string;
|
|
7
|
+
id: string;
|
|
8
|
+
type: GroupType;
|
|
9
|
+
settings: GroupSettings;
|
|
10
|
+
privateSettings: GroupPrivateSettings;
|
|
11
|
+
organizationId: string;
|
|
12
|
+
waitingListId: string | null;
|
|
13
|
+
periodId: string;
|
|
14
|
+
defaultAgeGroupId: string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Every time a new registration period starts, this number increases. This is used to mark all older registrations as 'out of date' automatically
|
|
17
|
+
*/
|
|
18
|
+
cycle: number;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
deletedAt: Date | null;
|
|
22
|
+
status: GroupStatus;
|
|
23
|
+
/**
|
|
24
|
+
* Editing this field is only allowed when running inside the QueueHandler
|
|
25
|
+
*/
|
|
26
|
+
stockReservations: StockReservation[];
|
|
27
|
+
static getAll(organizationId: string, periodId: string | null, active?: boolean, types?: GroupType[]): Promise<Group[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns all parent and grandparents of this group
|
|
30
|
+
*/
|
|
31
|
+
getParentCategories(all: GroupCategory[], recursive?: boolean): GroupCategory[];
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated
|
|
34
|
+
*/
|
|
35
|
+
getStructure(): GroupStruct;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated
|
|
38
|
+
*/
|
|
39
|
+
getPrivateStructure(): GroupStruct;
|
|
40
|
+
private static getCount;
|
|
41
|
+
updateOccupancy(): Promise<void>;
|
|
42
|
+
static deleteUnreachable(organizationId: string, period: OrganizationRegistrationPeriod, allGroups: Group[]): Promise<void>;
|
|
43
|
+
static applyStockReservations(groupId: string, addStockReservations: StockReservation[], free?: boolean): Promise<void>;
|
|
44
|
+
static freeStockReservations(groupId: string, reservations: StockReservation[]): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Group.d.ts.map
|
|
@@ -0,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;mBAIE,QAAQ;IAWvB,eAAe;WAYR,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B,EAAE,SAAS,EAAE,KAAK,EAAE;WA+CpG,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,EAAE,IAAI,UAAQ;WAiB9F,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE;CAGvF"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { column, Database } from '@simonbackx/simple-database';
|
|
3
|
+
import { GroupPrivateSettings, GroupSettings, GroupStatus, Group as GroupStruct, GroupType, StockReservation } from '@stamhoofd/structures';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
6
|
+
import { QueueHandler } from '@stamhoofd/queues';
|
|
7
|
+
import { QueryableModel } from '@stamhoofd/sql';
|
|
8
|
+
import { Registration } from './Registration.js';
|
|
9
|
+
if (Registration === undefined) {
|
|
10
|
+
throw new Error('Import Registration is undefined');
|
|
11
|
+
}
|
|
12
|
+
export class Group extends QueryableModel {
|
|
13
|
+
static table = 'groups';
|
|
14
|
+
// static cache = new ModelCache<Group>();
|
|
15
|
+
id;
|
|
16
|
+
type = GroupType.Membership;
|
|
17
|
+
settings;
|
|
18
|
+
privateSettings = GroupPrivateSettings.create({});
|
|
19
|
+
organizationId;
|
|
20
|
+
waitingListId = null;
|
|
21
|
+
periodId;
|
|
22
|
+
defaultAgeGroupId = null;
|
|
23
|
+
/**
|
|
24
|
+
* Every time a new registration period starts, this number increases. This is used to mark all older registrations as 'out of date' automatically
|
|
25
|
+
*/
|
|
26
|
+
cycle = 0;
|
|
27
|
+
createdAt;
|
|
28
|
+
updatedAt;
|
|
29
|
+
deletedAt = null;
|
|
30
|
+
status = GroupStatus.Open;
|
|
31
|
+
/**
|
|
32
|
+
* Editing this field is only allowed when running inside the QueueHandler
|
|
33
|
+
*/
|
|
34
|
+
stockReservations = [];
|
|
35
|
+
static async getAll(organizationId, periodId, active = true, types = [GroupType.Membership]) {
|
|
36
|
+
const query = Group.select()
|
|
37
|
+
.where('organizationId', organizationId);
|
|
38
|
+
if (active) {
|
|
39
|
+
query.andWhere('deletedAt', null);
|
|
40
|
+
}
|
|
41
|
+
if (periodId) {
|
|
42
|
+
query.andWhere('periodId', periodId);
|
|
43
|
+
}
|
|
44
|
+
query.andWhere('type', types);
|
|
45
|
+
return await query.fetch();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns all parent and grandparents of this group
|
|
49
|
+
*/
|
|
50
|
+
getParentCategories(all, recursive = true) {
|
|
51
|
+
const map = new Map();
|
|
52
|
+
const parents = all.filter(g => g.groupIds.includes(this.id));
|
|
53
|
+
for (const parent of parents) {
|
|
54
|
+
map.set(parent.id, parent);
|
|
55
|
+
if (recursive) {
|
|
56
|
+
const hisParents = parent.getParentCategories(all);
|
|
57
|
+
for (const pp of hisParents) {
|
|
58
|
+
map.set(pp.id, pp);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return [...map.values()];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated
|
|
66
|
+
*/
|
|
67
|
+
getStructure() {
|
|
68
|
+
return GroupStruct.create({ ...this, privateSettings: null });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated
|
|
72
|
+
*/
|
|
73
|
+
getPrivateStructure() {
|
|
74
|
+
return GroupStruct.create(this);
|
|
75
|
+
}
|
|
76
|
+
static async getCount(where, params) {
|
|
77
|
+
const query = `select count(*) as c from \`${Registration.table}\` where ${where}`;
|
|
78
|
+
const [results] = await Database.select(query, params);
|
|
79
|
+
const count = results[0]['']['c'];
|
|
80
|
+
if (Number.isInteger(count)) {
|
|
81
|
+
return count;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
async updateOccupancy() {
|
|
86
|
+
this.settings.registeredMembers = await Group.getCount('groupId = ? and registeredAt is not null AND deactivatedAt is null', [this.id]);
|
|
87
|
+
this.settings.reservedMembers = await Group.getCount('groupId = ? and registeredAt is null AND (canRegister = 1 OR reservedUntil >= ?)', [this.id, new Date()]);
|
|
88
|
+
}
|
|
89
|
+
static async deleteUnreachable(organizationId, period, allGroups) {
|
|
90
|
+
const reachable = new Map();
|
|
91
|
+
const visited = new Map();
|
|
92
|
+
const queue = [period.settings.rootCategoryId];
|
|
93
|
+
visited.set(period.settings.rootCategoryId, true);
|
|
94
|
+
while (queue.length > 0) {
|
|
95
|
+
const id = queue.shift();
|
|
96
|
+
if (!id) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
const category = period.settings.categories.find(c => c.id === id);
|
|
100
|
+
if (!category) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
for (const i of category.categoryIds) {
|
|
104
|
+
if (!visited.get(i)) {
|
|
105
|
+
queue.push(i);
|
|
106
|
+
visited.set(i, true);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const g of category.groupIds) {
|
|
110
|
+
reachable.set(g, true);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const group of allGroups) {
|
|
114
|
+
if (group.periodId !== period.periodId) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (group.type !== GroupType.Membership) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (!reachable.get(group.id) && group.deletedAt === null) {
|
|
121
|
+
console.log('Deleting unreachable group ' + group.id + ' from organization ' + organizationId + ' org period ' + period.id);
|
|
122
|
+
group.deletedAt = new Date();
|
|
123
|
+
await group.save();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
static async applyStockReservations(groupId, addStockReservations, free = false) {
|
|
128
|
+
await QueueHandler.schedule('group-stock-update-' + groupId, async () => {
|
|
129
|
+
const updatedGroup = await Group.getByID(groupId);
|
|
130
|
+
if (!updatedGroup) {
|
|
131
|
+
throw new Error('Expected group');
|
|
132
|
+
}
|
|
133
|
+
if (!free) {
|
|
134
|
+
updatedGroup.stockReservations = StockReservation.added(updatedGroup.stockReservations, addStockReservations);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
updatedGroup.stockReservations = StockReservation.removed(updatedGroup.stockReservations, addStockReservations);
|
|
138
|
+
}
|
|
139
|
+
await updatedGroup.save();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
static async freeStockReservations(groupId, reservations) {
|
|
143
|
+
return await this.applyStockReservations(groupId, reservations, true);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
__decorate([
|
|
147
|
+
column({
|
|
148
|
+
primary: true, type: 'string', beforeSave(value) {
|
|
149
|
+
return value ?? uuidv4();
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
], Group.prototype, "id", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
column({ type: 'string' })
|
|
155
|
+
], Group.prototype, "type", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
column({ type: 'json', decoder: GroupSettings })
|
|
158
|
+
], Group.prototype, "settings", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
column({
|
|
161
|
+
type: 'json', decoder: GroupPrivateSettings,
|
|
162
|
+
})
|
|
163
|
+
], Group.prototype, "privateSettings", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
column({ type: 'string' })
|
|
166
|
+
], Group.prototype, "organizationId", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
column({ type: 'string', nullable: true })
|
|
169
|
+
], Group.prototype, "waitingListId", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
column({ type: 'string' })
|
|
172
|
+
], Group.prototype, "periodId", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
column({ type: 'string', nullable: true })
|
|
175
|
+
], Group.prototype, "defaultAgeGroupId", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
column({ type: 'integer' })
|
|
178
|
+
], Group.prototype, "cycle", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
column({
|
|
181
|
+
type: 'datetime', beforeSave(old) {
|
|
182
|
+
if (old !== undefined) {
|
|
183
|
+
return old;
|
|
184
|
+
}
|
|
185
|
+
const date = new Date();
|
|
186
|
+
date.setMilliseconds(0);
|
|
187
|
+
return date;
|
|
188
|
+
},
|
|
189
|
+
})
|
|
190
|
+
], Group.prototype, "createdAt", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
column({
|
|
193
|
+
type: 'datetime', beforeSave() {
|
|
194
|
+
const date = new Date();
|
|
195
|
+
date.setMilliseconds(0);
|
|
196
|
+
return date;
|
|
197
|
+
},
|
|
198
|
+
skipUpdate: true,
|
|
199
|
+
})
|
|
200
|
+
], Group.prototype, "updatedAt", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
column({
|
|
203
|
+
type: 'datetime',
|
|
204
|
+
nullable: true,
|
|
205
|
+
})
|
|
206
|
+
], Group.prototype, "deletedAt", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
column({ type: 'string' })
|
|
209
|
+
], Group.prototype, "status", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
column({ type: 'json', decoder: new ArrayDecoder(StockReservation) })
|
|
212
|
+
], Group.prototype, "stockReservations", void 0);
|
|
213
|
+
//# sourceMappingURL=Group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../src/models/Group.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAqB,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,WAAW,EAAE,KAAK,IAAI,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5I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AgB,CAAC,EAAE,CAAC;gDAC3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import { QueryableModel } from '@stamhoofd/sql';
|
|
3
|
+
import type { ResolutionRequest } from '@stamhoofd/structures';
|
|
4
|
+
import { File, Resolution } from '@stamhoofd/structures';
|
|
5
|
+
export declare class Image extends QueryableModel {
|
|
6
|
+
static table: string;
|
|
7
|
+
id: string;
|
|
8
|
+
source: File;
|
|
9
|
+
resolutions: Resolution[];
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
static s3Client: S3Client | null;
|
|
12
|
+
static getS3Client(): S3Client;
|
|
13
|
+
static create(fileContent: string | Buffer, type: string | undefined, resolutions: ResolutionRequest[], isPrivateFile?: boolean, user?: {
|
|
14
|
+
id: string;
|
|
15
|
+
} | null): Promise<Image>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/models/Image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAIhE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzD,qBAAa,KAAM,SAAQ,cAAc;IACrC,MAAM,CAAC,KAAK,SAAY;IAKxB,EAAE,EAAG,MAAM,CAAC;IAGZ,MAAM,EAAE,IAAI,CAAC;IAGb,WAAW,EAAE,UAAU,EAAE,CAAM;IAG/B,SAAS,EAAE,IAAI,CAAc;IAE7B,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAExC,MAAM,CAAC,WAAW,IAAI,QAAQ;WAejB,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAAE,aAAa,GAAE,OAAe,EAAE,IAAI,GAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAW,GAAG,OAAO,CAAC,KAAK,CAAC;CAoJpM"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3'; // ES Modules import
|
|
3
|
+
import { column } from '@simonbackx/simple-database';
|
|
4
|
+
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
5
|
+
import { SimpleError } from '@simonbackx/simple-errors';
|
|
6
|
+
import { QueryableModel } from '@stamhoofd/sql';
|
|
7
|
+
import { File, Resolution } from '@stamhoofd/structures';
|
|
8
|
+
import sharp from 'sharp';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
+
export class Image extends QueryableModel {
|
|
11
|
+
static table = 'images';
|
|
12
|
+
id;
|
|
13
|
+
source;
|
|
14
|
+
resolutions = [];
|
|
15
|
+
createdAt = new Date();
|
|
16
|
+
static s3Client = null;
|
|
17
|
+
static getS3Client() {
|
|
18
|
+
if (!this.s3Client) {
|
|
19
|
+
this.s3Client = new S3Client({
|
|
20
|
+
forcePathStyle: false, // Configures to use subdomain/virtual calling format.
|
|
21
|
+
endpoint: 'https://' + STAMHOOFD.SPACES_ENDPOINT,
|
|
22
|
+
credentials: {
|
|
23
|
+
accessKeyId: STAMHOOFD.SPACES_KEY,
|
|
24
|
+
secretAccessKey: STAMHOOFD.SPACES_SECRET,
|
|
25
|
+
},
|
|
26
|
+
region: 'eu-west-1', // Not used, but required by the S3Client
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return this.s3Client;
|
|
30
|
+
}
|
|
31
|
+
static async create(fileContent, type, resolutions, isPrivateFile = false, user = null) {
|
|
32
|
+
if (!STAMHOOFD.SPACES_BUCKET || !STAMHOOFD.SPACES_ENDPOINT || !STAMHOOFD.SPACES_KEY || !STAMHOOFD.SPACES_SECRET) {
|
|
33
|
+
throw new SimpleError({
|
|
34
|
+
code: 'not_available',
|
|
35
|
+
message: 'Uploading is not available',
|
|
36
|
+
statusCode: 503,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let fileType = 'png';
|
|
40
|
+
if (type == 'image/jpeg' || type == 'image/jpg') {
|
|
41
|
+
fileType = 'jpg';
|
|
42
|
+
}
|
|
43
|
+
if (type == 'image/webp') {
|
|
44
|
+
fileType = 'webp';
|
|
45
|
+
}
|
|
46
|
+
if (type === 'image/svg+xml' || type === 'image/svg') {
|
|
47
|
+
fileType = 'svg';
|
|
48
|
+
}
|
|
49
|
+
console.log('creating image', fileType, type, resolutions);
|
|
50
|
+
const supportsTransparency = fileType == 'png' || fileType == 'svg' || fileType == 'webp';
|
|
51
|
+
const promises = [];
|
|
52
|
+
if (resolutions.length) {
|
|
53
|
+
let sharpStream = sharp(fileContent, fileType === 'svg' ? { density: 600 } : {}).rotate();
|
|
54
|
+
if (!supportsTransparency) {
|
|
55
|
+
sharpStream = sharpStream.flatten({ background: { r: 255, g: 255, b: 255 } });
|
|
56
|
+
}
|
|
57
|
+
for (const r of resolutions) {
|
|
58
|
+
const size = {
|
|
59
|
+
width: r.width ?? undefined,
|
|
60
|
+
height: r.height ?? undefined,
|
|
61
|
+
fit: r.fit,
|
|
62
|
+
withoutEnlargement: type !== 'image/svg+xml',
|
|
63
|
+
};
|
|
64
|
+
let t = sharpStream.resize(size);
|
|
65
|
+
// Generate the image data
|
|
66
|
+
if (!supportsTransparency) {
|
|
67
|
+
t = t.jpeg({
|
|
68
|
+
quality: 80,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
t = t.png();
|
|
73
|
+
}
|
|
74
|
+
promises.push(t.toBuffer({ resolveWithObject: true }));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const files = await Promise.all(promises);
|
|
78
|
+
const client = this.getS3Client();
|
|
79
|
+
let prefix = (STAMHOOFD.SPACES_PREFIX ?? '');
|
|
80
|
+
if (prefix.length > 0) {
|
|
81
|
+
prefix += '/';
|
|
82
|
+
}
|
|
83
|
+
prefix += (STAMHOOFD.environment ?? 'development') === 'development' ? ('development/') : ('');
|
|
84
|
+
// Prepend user id to the file path
|
|
85
|
+
if (isPrivateFile && user) {
|
|
86
|
+
// Private files
|
|
87
|
+
prefix += 'users/' + user.id + '/';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// Public files
|
|
91
|
+
prefix += 'p/';
|
|
92
|
+
}
|
|
93
|
+
const uploadPromises = [];
|
|
94
|
+
const image = new Image();
|
|
95
|
+
image.id = uuidv4();
|
|
96
|
+
for (const f of files) {
|
|
97
|
+
const fileId = uuidv4();
|
|
98
|
+
const key = prefix + image.id + '/' + fileId + (!supportsTransparency ? '.jpg' : '.png');
|
|
99
|
+
const cmd = new PutObjectCommand({
|
|
100
|
+
Bucket: STAMHOOFD.SPACES_BUCKET,
|
|
101
|
+
Key: key,
|
|
102
|
+
Body: f.data,
|
|
103
|
+
ContentType: !supportsTransparency ? 'image/jpeg' : 'image/png',
|
|
104
|
+
ACL: isPrivateFile ? 'private' : 'public-read',
|
|
105
|
+
});
|
|
106
|
+
uploadPromises.push(client.send(cmd));
|
|
107
|
+
const _file = new File({
|
|
108
|
+
id: fileId,
|
|
109
|
+
server: 'https://' + STAMHOOFD.SPACES_BUCKET + '.' + STAMHOOFD.SPACES_ENDPOINT,
|
|
110
|
+
path: key,
|
|
111
|
+
size: f.info.size,
|
|
112
|
+
isPrivate: isPrivateFile,
|
|
113
|
+
});
|
|
114
|
+
if (isPrivateFile) {
|
|
115
|
+
if (!await _file.sign()) {
|
|
116
|
+
throw new SimpleError({
|
|
117
|
+
code: 'failed_to_sign',
|
|
118
|
+
message: 'Failed to sign file',
|
|
119
|
+
human: $t('%B6'),
|
|
120
|
+
statusCode: 500,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const _image = new Resolution({
|
|
125
|
+
file: _file,
|
|
126
|
+
width: f.info.width,
|
|
127
|
+
height: f.info.height,
|
|
128
|
+
});
|
|
129
|
+
image.resolutions.push(_image);
|
|
130
|
+
}
|
|
131
|
+
// Also include the source, in private mode
|
|
132
|
+
const fileId = uuidv4();
|
|
133
|
+
const uploadExt = fileType;
|
|
134
|
+
const key = prefix + (STAMHOOFD.environment ?? 'development') + '/' + image.id + '/' + fileId + '.' + uploadExt;
|
|
135
|
+
image.source = new File({
|
|
136
|
+
id: fileId,
|
|
137
|
+
server: 'https://' + STAMHOOFD.SPACES_BUCKET + '.' + STAMHOOFD.SPACES_ENDPOINT,
|
|
138
|
+
path: key,
|
|
139
|
+
size: fileContent.length,
|
|
140
|
+
// Don't set private here, as we don't allow to download this file
|
|
141
|
+
});
|
|
142
|
+
const cmd = new PutObjectCommand({
|
|
143
|
+
Bucket: STAMHOOFD.SPACES_BUCKET,
|
|
144
|
+
Key: key,
|
|
145
|
+
Body: fileContent,
|
|
146
|
+
ContentType: type ?? 'image/jpeg',
|
|
147
|
+
ACL: 'private',
|
|
148
|
+
});
|
|
149
|
+
uploadPromises.push(client.send(cmd));
|
|
150
|
+
await Promise.all(uploadPromises);
|
|
151
|
+
await image.save();
|
|
152
|
+
return image;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
__decorate([
|
|
156
|
+
column({ primary: true, type: 'string', beforeSave(value) {
|
|
157
|
+
return value ?? uuidv4();
|
|
158
|
+
} })
|
|
159
|
+
], Image.prototype, "id", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
column({ type: 'json', decoder: File })
|
|
162
|
+
], Image.prototype, "source", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
column({ type: 'json', decoder: new ArrayDecoder(Resolution) })
|
|
165
|
+
], Image.prototype, "resolutions", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
column({ type: 'datetime' })
|
|
168
|
+
], Image.prototype, "createdAt", void 0);
|
|
169
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/models/Image.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC,CAAC,oBAAoB;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,OAAO,KAAM,SAAQ,cAAc;IACrC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC;IAKxB,EAAE,CAAU;IAGZ,MAAM,CAAO;IAGb,WAAW,GAAiB,EAAE,CAAC;IAG/B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAE7B,MAAM,CAAC,QAAQ,GAAoB,IAAI,CAAC;IAExC,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC;gBACzB,cAAc,EAAE,KAAK,EAAE,sDAAsD;gBAC7E,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAC,eAAe;gBAChD,WAAW,EAAE;oBACT,WAAW,EAAE,SAAS,CAAC,UAAU;oBACjC,eAAe,EAAE,SAAS,CAAC,aAAa;iBAC3C;gBACD,MAAM,EAAE,WAAW,EAAE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SAAc;IAO1B,EAAE,EAAG,MAAM,CAAC;IAGZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG7B,QAAQ,kBAA8B;IAGtC,MAAM,UAAsB;IAE5B;;OAEG;IAEH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IAEH,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE3C;;;;;;;;;;;;;;OAcG;IAEH,qBAAqB,EAAE,MAAM,CAAK;IAElC;;OAEG;IAEH,QAAQ,EAAE,WAAW,EAAE,CAAM;IAG7B,cAAc,SAAK;IAGnB,eAAe,SAAK;IAGpB,0BAA0B,SAAK;IAG/B,YAAY,SAAK;IAGjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGhC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGhC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGhC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAQ;IAGxB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAQ;IAExB;;OAEG;IAEH,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGxC,aAAa,UAAS;IAEtB;;OAEG;IAaH,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE/B;;OAEG;IAEH,KAAK,EAAE,IAAI,GAAG,IAAI,CAAQ;IAY1B,SAAS,EAAE,IAAI,CAAC;IAEhB,eAAe,EAAE,IAAI,GAAG,IAAI,CAAQ;IAapC,SAAS,EAAE,IAAI,CAAC;WAEH,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE;;;CAQpD"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { column } from '@simonbackx/simple-database';
|
|
3
|
+
import { Company, File, PaymentCustomer, VATSubtotal } from '@stamhoofd/structures';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
import { ArrayDecoder } from '@simonbackx/simple-encoding';
|
|
6
|
+
import { QueryableModel } from '@stamhoofd/sql';
|
|
7
|
+
import { InvoicedBalanceItem } from './InvoicedBalanceItem.js';
|
|
8
|
+
export class Invoice extends QueryableModel {
|
|
9
|
+
static table = 'invoices';
|
|
10
|
+
id;
|
|
11
|
+
number = null;
|
|
12
|
+
customer = PaymentCustomer.create({});
|
|
13
|
+
seller = Company.create({});
|
|
14
|
+
/**
|
|
15
|
+
* seller organization
|
|
16
|
+
*/
|
|
17
|
+
organizationId;
|
|
18
|
+
/**
|
|
19
|
+
* Can be null if it is not linked to an organization.
|
|
20
|
+
* This is only used to allow the payer to list their (incoming) invoices.
|
|
21
|
+
*
|
|
22
|
+
* In the future we could expand this with members, users, and/or orders
|
|
23
|
+
*/
|
|
24
|
+
payingOrganizationId = null;
|
|
25
|
+
/**
|
|
26
|
+
* This is the rounding amount in cents that is applied to the normal calculation of the invoiced balance items (prices exluding VAT) to come to the actual total price of the invoice.
|
|
27
|
+
*
|
|
28
|
+
* This is visible on the invoice. It is use to correct for differences between the paid price and the calculated invoice price because of rounding issues or things that can't be represented properly in PEPPOL due to rounding
|
|
29
|
+
*
|
|
30
|
+
* - Say we invoice 31 items of 5 euro including VAT, so 4,13 euro excluding VAT. This means InvoicedBalanceItem has
|
|
31
|
+
* - balanceInvoicedAmount = 5 euro
|
|
32
|
+
* - amount = 31_00_00 (31 pieces)
|
|
33
|
+
* - unitPrice = 4_13_00 (4,13 euro excluding VAT, rounded to 1 cent because of PEPPOL)
|
|
34
|
+
* The normal invoiced sum would be 155 euro if we sum balanceInvoicedAmount
|
|
35
|
+
* But the invoice total price will be 128,03 excluding VAT, and 154,92 euro including VAT because of rounding rules (round on total level, not individual item level).
|
|
36
|
+
* In this case payableRoundingAmount would be 0,08 euro, because that is the price that needs to be added to the normal calculation to come to the actual invoice total price that needs to be paid (155 euro).
|
|
37
|
+
* A different solution might be to increase the price excluding VAT of some items by 0,07 euro (or add an extra item on the invoice with the same VAT rate), so the total excluding VAT becomes 128,10 euro, and including VAT 155 euro. This is not always possible though, in some cases we maintain a difference of 1 cent.
|
|
38
|
+
* balanceRoundingAmount would be 0 because there is no difference lower than 1 cent.
|
|
39
|
+
*/
|
|
40
|
+
payableRoundingAmount = 0;
|
|
41
|
+
/**
|
|
42
|
+
* List of VAT per VAT rate or category. This is stored in case the calculation changes over time.
|
|
43
|
+
*/
|
|
44
|
+
VATTotal = [];
|
|
45
|
+
VATTotalAmount = 0;
|
|
46
|
+
totalWithoutVAT = 0;
|
|
47
|
+
totalBalanceInvoicedAmount = 0;
|
|
48
|
+
totalWithVAT = 0;
|
|
49
|
+
ipAddress = null;
|
|
50
|
+
userAgent = null;
|
|
51
|
+
stripeAccountId = null;
|
|
52
|
+
reference = null;
|
|
53
|
+
pdf = null;
|
|
54
|
+
xml = null;
|
|
55
|
+
/**
|
|
56
|
+
* If a invoice was refunded because of a cancellation, we store the negative invoice id here
|
|
57
|
+
*/
|
|
58
|
+
negativeInvoiceId = null;
|
|
59
|
+
didSendPeppol = false;
|
|
60
|
+
/**
|
|
61
|
+
* Official invoice date. Set when a number has been generated.
|
|
62
|
+
*/
|
|
63
|
+
invoicedAt = null;
|
|
64
|
+
/**
|
|
65
|
+
* If null, invoicedAt is used
|
|
66
|
+
*/
|
|
67
|
+
dueAt = null;
|
|
68
|
+
createdAt;
|
|
69
|
+
_forceUpdatedAt = null;
|
|
70
|
+
updatedAt;
|
|
71
|
+
static async loadBalanceItems(invoices) {
|
|
72
|
+
if (invoices.length === 0) {
|
|
73
|
+
return { invoicedBalanceItems: [] };
|
|
74
|
+
}
|
|
75
|
+
// Load all the related models from the database so we can build the structures
|
|
76
|
+
const invoicedBalanceItems = await InvoicedBalanceItem.select().where('invoiceId', invoices.map(i => i.id)).fetch();
|
|
77
|
+
return { invoicedBalanceItems };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
__decorate([
|
|
81
|
+
column({
|
|
82
|
+
primary: true, type: 'string', beforeSave(value) {
|
|
83
|
+
return value ?? uuidv4();
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
], Invoice.prototype, "id", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
column({ type: 'string', nullable: true })
|
|
89
|
+
], Invoice.prototype, "number", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
column({ type: 'json', decoder: PaymentCustomer })
|
|
92
|
+
], Invoice.prototype, "customer", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
column({ type: 'json', decoder: Company })
|
|
95
|
+
], Invoice.prototype, "seller", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
column({ type: 'string' })
|
|
98
|
+
], Invoice.prototype, "organizationId", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
column({ type: 'string', nullable: true })
|
|
101
|
+
], Invoice.prototype, "payingOrganizationId", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
column({ type: 'integer' })
|
|
104
|
+
], Invoice.prototype, "payableRoundingAmount", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
column({ type: 'json', decoder: new ArrayDecoder(VATSubtotal) })
|
|
107
|
+
], Invoice.prototype, "VATTotal", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
column({ type: 'integer' })
|
|
110
|
+
], Invoice.prototype, "VATTotalAmount", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
column({ type: 'integer' })
|
|
113
|
+
], Invoice.prototype, "totalWithoutVAT", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
column({ type: 'integer' })
|
|
116
|
+
], Invoice.prototype, "totalBalanceInvoicedAmount", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
column({ type: 'integer' })
|
|
119
|
+
], Invoice.prototype, "totalWithVAT", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
column({ type: 'string', nullable: true })
|
|
122
|
+
], Invoice.prototype, "ipAddress", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
column({ type: 'string', nullable: true })
|
|
125
|
+
], Invoice.prototype, "userAgent", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
column({ type: 'string', nullable: true })
|
|
128
|
+
], Invoice.prototype, "stripeAccountId", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
column({ type: 'string', nullable: true })
|
|
131
|
+
], Invoice.prototype, "reference", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
column({ type: 'json', decoder: File, nullable: true })
|
|
134
|
+
], Invoice.prototype, "pdf", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
column({ type: 'json', decoder: File, nullable: true })
|
|
137
|
+
], Invoice.prototype, "xml", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
column({ type: 'string', nullable: true })
|
|
140
|
+
], Invoice.prototype, "negativeInvoiceId", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
column({ type: 'boolean' })
|
|
143
|
+
], Invoice.prototype, "didSendPeppol", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
column({
|
|
146
|
+
type: 'datetime',
|
|
147
|
+
nullable: true,
|
|
148
|
+
beforeSave(old) {
|
|
149
|
+
if (old !== undefined || !this.number) {
|
|
150
|
+
return old;
|
|
151
|
+
}
|
|
152
|
+
const date = new Date();
|
|
153
|
+
date.setMilliseconds(0);
|
|
154
|
+
return date;
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
], Invoice.prototype, "invoicedAt", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
column({ type: 'datetime', nullable: true })
|
|
160
|
+
], Invoice.prototype, "dueAt", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
column({
|
|
163
|
+
type: 'datetime', beforeSave(old) {
|
|
164
|
+
if (old !== undefined) {
|
|
165
|
+
return old;
|
|
166
|
+
}
|
|
167
|
+
const date = new Date();
|
|
168
|
+
date.setMilliseconds(0);
|
|
169
|
+
return date;
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
], Invoice.prototype, "createdAt", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
column({
|
|
175
|
+
type: 'datetime', beforeSave() {
|
|
176
|
+
if (this._forceUpdatedAt) {
|
|
177
|
+
return this._forceUpdatedAt;
|
|
178
|
+
}
|
|
179
|
+
const date = new Date();
|
|
180
|
+
date.setMilliseconds(0);
|
|
181
|
+
return date;
|
|
182
|
+
},
|
|
183
|
+
skipUpdate: true,
|
|
184
|
+
})
|
|
185
|
+
], Invoice.prototype, "updatedAt", void 0);
|
|
186
|
+
//# sourceMappingURL=Invoice.js.map
|