@stamhoofd/models 2.152.0 → 2.160.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/LICENSE.md +7 -7
- package/dist/factories/AddressFactory.js +9 -3
- package/dist/factories/AddressFactory.js.map +1 -1
- package/dist/factories/BalanceItemFactory.js +1 -1
- package/dist/factories/BalanceItemFactory.js.map +1 -1
- package/dist/factories/DocumentTemplateFactory.js +3 -8
- package/dist/factories/DocumentTemplateFactory.js.map +1 -1
- package/dist/factories/EmailTemplateFactory.js +1 -1
- package/dist/factories/EmailTemplateFactory.js.map +1 -1
- package/dist/factories/EmergencyContactFactory.js +13 -13
- package/dist/factories/EmergencyContactFactory.js.map +1 -1
- package/dist/factories/EventFactory.js +4 -2
- package/dist/factories/EventFactory.js.map +1 -1
- package/dist/factories/EventNotificationFactory.js +6 -3
- package/dist/factories/EventNotificationFactory.js.map +1 -1
- package/dist/factories/EventNotificationTypeFactory.js +3 -2
- package/dist/factories/EventNotificationTypeFactory.js.map +1 -1
- package/dist/factories/GroupFactory.js +6 -5
- package/dist/factories/GroupFactory.js.map +1 -1
- package/dist/factories/MemberFactory.js +35 -23
- package/dist/factories/MemberFactory.js.map +1 -1
- package/dist/factories/MemberResponsibilityRecordFactory.js +7 -6
- package/dist/factories/MemberResponsibilityRecordFactory.js.map +1 -1
- package/dist/factories/OrderFactory.js +16 -12
- package/dist/factories/OrderFactory.js.map +1 -1
- package/dist/factories/OrganizationFactory.js +18 -9
- package/dist/factories/OrganizationFactory.js.map +1 -1
- package/dist/factories/OrganizationRegistrationPeriodFactory.js +1 -1
- package/dist/factories/OrganizationRegistrationPeriodFactory.js.map +1 -1
- package/dist/factories/OrganizationTagFactory.js +1 -1
- package/dist/factories/OrganizationTagFactory.js.map +1 -1
- package/dist/factories/ParentFactory.js +39 -23
- package/dist/factories/ParentFactory.js.map +1 -1
- package/dist/factories/PlatformEventTypeFactory.js +3 -2
- package/dist/factories/PlatformEventTypeFactory.js.map +1 -1
- package/dist/factories/PlatformResponsibilityFactory.js +3 -2
- package/dist/factories/PlatformResponsibilityFactory.js.map +1 -1
- package/dist/factories/RecordAnswerFactory.js +17 -18
- package/dist/factories/RecordAnswerFactory.js.map +1 -1
- package/dist/factories/RecordCategoryFactory.js +1 -1
- package/dist/factories/RecordCategoryFactory.js.map +1 -1
- package/dist/factories/RecordFactory.js +2 -2
- package/dist/factories/RecordFactory.js.map +1 -1
- package/dist/factories/RegisterCodeFactory.js +6 -3
- package/dist/factories/RegisterCodeFactory.js.map +1 -1
- package/dist/factories/RegistrationFactory.js +8 -3
- package/dist/factories/RegistrationFactory.js.map +1 -1
- package/dist/factories/RegistrationInvitationFactory.js +1 -1
- package/dist/factories/RegistrationInvitationFactory.js.map +1 -1
- package/dist/factories/RegistrationPeriodFactory.js +1 -1
- package/dist/factories/RegistrationPeriodFactory.js.map +1 -1
- package/dist/factories/STPackageFactory.js +1 -1
- package/dist/factories/STPackageFactory.js.map +1 -1
- package/dist/factories/TenantFactory.js +2 -2
- package/dist/factories/TenantFactory.js.map +1 -1
- package/dist/factories/TicketFactory.js +5 -2
- package/dist/factories/TicketFactory.js.map +1 -1
- package/dist/factories/UserFactory.js +7 -3
- package/dist/factories/UserFactory.js.map +1 -1
- package/dist/factories/WebshopFactory.js +3 -2
- package/dist/factories/WebshopFactory.js.map +1 -1
- package/dist/helpers/DNSValidator.js +20 -9
- package/dist/helpers/DNSValidator.js.map +1 -1
- package/dist/helpers/Handlebars.js +12 -15
- package/dist/helpers/Handlebars.js.map +1 -1
- package/dist/helpers/InvoiceCounter.js +9 -3
- package/dist/helpers/InvoiceCounter.js.map +1 -1
- package/dist/helpers/RateLimiter.js +43 -12
- package/dist/helpers/RateLimiter.js.map +1 -1
- package/dist/helpers/WebshopCounter.js +5 -3
- package/dist/helpers/WebshopCounter.js.map +1 -1
- package/dist/helpers/countDays.js +15 -0
- package/dist/helpers/countDays.js.map +1 -0
- package/dist/helpers/errorToSimpleErrors.js +8 -3
- package/dist/helpers/errorToSimpleErrors.js.map +1 -1
- package/dist/migrations/1605262045-import-postcodes.js +6 -5
- package/dist/migrations/1605262045-import-postcodes.js.map +1 -1
- package/dist/migrations/1605262046-import-postcodes-nl.js +10 -5
- package/dist/migrations/1605262046-import-postcodes-nl.js.map +1 -1
- package/dist/migrations/1720080975-convert-charset.js +52 -5
- package/dist/migrations/1720080975-convert-charset.js.map +1 -1
- package/dist/migrations/1720080976-convert-charset-leads.js +6 -3
- package/dist/migrations/1720080976-convert-charset-leads.js.map +1 -1
- package/dist/migrations/1733994455-balance-item-status-open.js +3 -9
- package/dist/migrations/1733994455-balance-item-status-open.js.map +1 -1
- package/dist/migrations/1780412083-documents-set-locked.js +1 -1
- package/dist/migrations/1780412083-documents-set-locked.js.map +1 -1
- package/dist/migrations/1780928401-v1-groups-migration-data.js +1 -1
- package/dist/migrations/1780928401-v1-groups-migration-data.js.map +1 -1
- package/dist/migrations/1782333024-discount-code-email.sql +3 -0
- package/dist/migrations/1785354098-platform-tenant-backfill.js +1 -1
- package/dist/migrations/1785354098-platform-tenant-backfill.js.map +1 -1
- package/dist/migrations/1788509800-invoiced-balance-items-details.sql +5 -0
- package/dist/migrations/1788900000-document-parent-id.sql +2 -0
- package/dist/migrations/1790788551-email-verification-codes-nullable-user-id.sql +1 -0
- package/dist/migrations/1790849769-registrations-registered-by-member.sql +2 -0
- package/dist/migrations/1791503836-create-mailchimp-credentials.sql +10 -0
- package/dist/migrations/1791503837-create-mailchimp-syncs.sql +16 -0
- package/dist/models/ApplicationFee.js +9 -5
- package/dist/models/ApplicationFee.js.map +1 -1
- package/dist/models/AuditLog.js +17 -8
- package/dist/models/AuditLog.js.map +1 -1
- package/dist/models/BalanceItem.js +45 -33
- package/dist/models/BalanceItem.js.map +1 -1
- package/dist/models/BalanceItemPayment.js +9 -5
- package/dist/models/BalanceItemPayment.js.map +1 -1
- package/dist/models/BuckarooPayment.js +5 -3
- package/dist/models/BuckarooPayment.js.map +1 -1
- package/dist/models/CachedBalance.js +36 -19
- package/dist/models/CachedBalance.js.map +1 -1
- package/dist/models/Document.js +22 -110
- package/dist/models/Document.js.map +1 -1
- package/dist/models/DocumentTemplate.js +587 -220
- package/dist/models/DocumentTemplate.js.map +1 -1
- package/dist/models/Email.js +71 -40
- package/dist/models/Email.js.map +1 -1
- package/dist/models/EmailRecipient.js +28 -11
- package/dist/models/EmailRecipient.js.map +1 -1
- package/dist/models/EmailTemplate.js +14 -7
- package/dist/models/EmailTemplate.js.map +1 -1
- package/dist/models/EmailVerificationCode.js +62 -17
- package/dist/models/EmailVerificationCode.js.map +1 -1
- package/dist/models/Event.js +17 -9
- package/dist/models/Event.js.map +1 -1
- package/dist/models/EventNotification.js +13 -7
- package/dist/models/EventNotification.js.map +1 -1
- package/dist/models/Group.js +22 -30
- package/dist/models/Group.js.map +1 -1
- package/dist/models/Image.js +123 -18
- package/dist/models/Image.js.map +1 -1
- package/dist/models/ImpersonationToken.js +12 -6
- package/dist/models/ImpersonationToken.js.map +1 -1
- package/dist/models/Invoice.js +29 -9
- package/dist/models/Invoice.js.map +1 -1
- package/dist/models/InvoicedBalanceItem.js +33 -5
- package/dist/models/InvoicedBalanceItem.js.map +1 -1
- package/dist/models/MFARecoveryCode.js +8 -5
- package/dist/models/MFARecoveryCode.js.map +1 -1
- package/dist/models/MFATOTP.js +13 -6
- package/dist/models/MFATOTP.js.map +1 -1
- package/dist/models/MFAToken.js +17 -6
- package/dist/models/MFAToken.js.map +1 -1
- package/dist/models/MailchimpCredential.js +60 -0
- package/dist/models/MailchimpCredential.js.map +1 -0
- package/dist/models/MailchimpSync.js +92 -0
- package/dist/models/MailchimpSync.js.map +1 -0
- package/dist/models/Member.js +34 -57
- package/dist/models/Member.js.map +1 -1
- package/dist/models/MemberPlatformMembership.js +11 -6
- package/dist/models/MemberPlatformMembership.js.map +1 -1
- package/dist/models/MemberResponsibilityRecord.js +8 -5
- package/dist/models/MemberResponsibilityRecord.js.map +1 -1
- package/dist/models/MemberUser.js +4 -3
- package/dist/models/MemberUser.js.map +1 -1
- package/dist/models/MergedMember.js +2 -2
- package/dist/models/MergedMember.js.map +1 -1
- package/dist/models/MolliePayment.js +5 -3
- package/dist/models/MolliePayment.js.map +1 -1
- package/dist/models/MollieToken.js +34 -18
- package/dist/models/MollieToken.js.map +1 -1
- package/dist/models/Notification.js +10 -6
- package/dist/models/Notification.js.map +1 -1
- package/dist/models/NotificationPreference.js +17 -5
- package/dist/models/NotificationPreference.js.map +1 -1
- package/dist/models/NotificationRecipient.js +7 -4
- package/dist/models/NotificationRecipient.js.map +1 -1
- package/dist/models/Order.js +116 -64
- package/dist/models/Order.js.map +1 -1
- package/dist/models/Organization.js +34 -20
- package/dist/models/Organization.js.map +1 -1
- package/dist/models/OrganizationRegistrationPeriod.js +32 -15
- package/dist/models/OrganizationRegistrationPeriod.js.map +1 -1
- package/dist/models/PasswordToken.js +5 -4
- package/dist/models/PasswordToken.js.map +1 -1
- package/dist/models/PayconiqPayment.js +38 -17
- package/dist/models/PayconiqPayment.js.map +1 -1
- package/dist/models/Payment.js +57 -30
- package/dist/models/Payment.js.map +1 -1
- package/dist/models/PaymentSettlement.js +9 -5
- package/dist/models/PaymentSettlement.js.map +1 -1
- package/dist/models/Platform.js +14 -10
- package/dist/models/Platform.js.map +1 -1
- package/dist/models/RegisterCode.js +6 -4
- package/dist/models/RegisterCode.js.map +1 -1
- package/dist/models/Registration.js +20 -8
- package/dist/models/Registration.js.map +1 -1
- package/dist/models/RegistrationInvitation.js +7 -4
- package/dist/models/RegistrationInvitation.js.map +1 -1
- package/dist/models/RegistrationPeriod.js +13 -49
- package/dist/models/RegistrationPeriod.js.map +1 -1
- package/dist/models/STCredit.js +13 -7
- package/dist/models/STCredit.js.map +1 -1
- package/dist/models/STInvoice.js +9 -5
- package/dist/models/STInvoice.js.map +1 -1
- package/dist/models/STPackage.js +13 -9
- package/dist/models/STPackage.js.map +1 -1
- package/dist/models/STPendingInvoice.js +9 -5
- package/dist/models/STPendingInvoice.js.map +1 -1
- package/dist/models/Settlement.js +10 -6
- package/dist/models/Settlement.js.map +1 -1
- package/dist/models/SettlementCharge.js +9 -5
- package/dist/models/SettlementCharge.js.map +1 -1
- package/dist/models/StripeAccount.js +35 -11
- package/dist/models/StripeAccount.js.map +1 -1
- package/dist/models/StripeCheckoutSession.js +5 -3
- package/dist/models/StripeCheckoutSession.js.map +1 -1
- package/dist/models/StripePaymentIntent.js +5 -3
- package/dist/models/StripePaymentIntent.js.map +1 -1
- package/dist/models/Ticket.js +9 -5
- package/dist/models/Ticket.js.map +1 -1
- package/dist/models/Token.js +10 -6
- package/dist/models/Token.js.map +1 -1
- package/dist/models/UitpasClientCredential.js +9 -5
- package/dist/models/UitpasClientCredential.js.map +1 -1
- package/dist/models/UsedRegisterCode.js +9 -5
- package/dist/models/UsedRegisterCode.js.map +1 -1
- package/dist/models/User.js +38 -75
- package/dist/models/User.js.map +1 -1
- package/dist/models/UserPermissions.js +9 -5
- package/dist/models/UserPermissions.js.map +1 -1
- package/dist/models/UserSession.js +4 -4
- package/dist/models/UserSession.js.map +1 -1
- package/dist/models/ViesCachedResult.js +2 -2
- package/dist/models/ViesCachedResult.js.map +1 -1
- package/dist/models/WebauthnChallenge.js +14 -6
- package/dist/models/WebauthnChallenge.js.map +1 -1
- package/dist/models/WebauthnCredential.js +12 -5
- package/dist/models/WebauthnCredential.js.map +1 -1
- package/dist/models/Webshop.js +13 -8
- package/dist/models/Webshop.js.map +1 -1
- package/dist/models/WebshopDiscountCode.js +23 -8
- package/dist/models/WebshopDiscountCode.js.map +1 -1
- package/dist/models/WebshopUitpasNumber.js +11 -9
- package/dist/models/WebshopUitpasNumber.js.map +1 -1
- package/dist/models/_relations.js +1 -1
- package/dist/models/_relations.js.map +1 -1
- package/dist/models/addresses/City.js +5 -3
- package/dist/models/addresses/City.js.map +1 -1
- package/dist/models/addresses/PostalCode.js +28 -11
- package/dist/models/addresses/PostalCode.js.map +1 -1
- package/dist/models/addresses/Province.js +5 -3
- package/dist/models/addresses/Province.js.map +1 -1
- package/dist/models/addresses/Street.js +5 -3
- package/dist/models/addresses/Street.js.map +1 -1
- package/dist/models/v1GroupMigrationData.js +2 -2
- package/dist/models/v1GroupMigrationData.js.map +1 -1
- package/dist/services/RegistrationPeriodService.js +39 -0
- package/dist/services/RegistrationPeriodService.js.map +1 -0
- package/dist/services/UserService.js +69 -0
- package/dist/services/UserService.js.map +1 -0
- package/dist/structures/OrganizationServerMetaData.js +21 -8
- package/dist/structures/OrganizationServerMetaData.js.map +1 -1
- package/{dist → dist-types}/factories/AddressFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/AddressFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/BalanceItemFactory.d.ts +1 -1
- package/dist-types/factories/BalanceItemFactory.d.ts.map +1 -0
- package/{dist → dist-types}/factories/DocumentTemplateFactory.d.ts +1 -1
- package/dist-types/factories/DocumentTemplateFactory.d.ts.map +1 -0
- package/{dist → dist-types}/factories/EmailTemplateFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/EmailTemplateFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/EmergencyContactFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/EmergencyContactFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/EventFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/EventFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/EventNotificationFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/EventNotificationFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/EventNotificationTypeFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/EventNotificationTypeFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/GroupFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/GroupFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/MemberFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/MemberFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/MemberResponsibilityRecordFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/MemberResponsibilityRecordFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/OrderFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/OrderFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/OrganizationFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/OrganizationFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/OrganizationRegistrationPeriodFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/OrganizationRegistrationPeriodFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/OrganizationTagFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/OrganizationTagFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/ParentFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/ParentFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/PlatformEventTypeFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/PlatformEventTypeFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/PlatformResponsibilityFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/PlatformResponsibilityFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/RecordAnswerFactory.d.ts +1 -1
- package/dist-types/factories/RecordAnswerFactory.d.ts.map +1 -0
- package/{dist → dist-types}/factories/RecordCategoryFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/RecordCategoryFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/RecordFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/RecordFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/RegisterCodeFactory.d.ts +1 -1
- package/dist-types/factories/RegisterCodeFactory.d.ts.map +1 -0
- package/{dist → dist-types}/factories/RegistrationFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/RegistrationFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/RegistrationInvitationFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/RegistrationInvitationFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/RegistrationPeriodFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/RegistrationPeriodFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/STPackageFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/STPackageFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/TenantFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/TenantFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/TicketFactory.d.ts +1 -1
- package/{dist → dist-types}/factories/TicketFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/UserFactory.d.ts +2 -1
- package/{dist → dist-types}/factories/UserFactory.d.ts.map +1 -1
- package/{dist → dist-types}/factories/WebshopFactory.d.ts +2 -2
- package/{dist → dist-types}/factories/WebshopFactory.d.ts.map +1 -1
- package/{dist → dist-types}/helpers/DNSValidator.d.ts.map +1 -1
- package/{dist → dist-types}/helpers/Handlebars.d.ts.map +1 -1
- package/dist-types/helpers/InvoiceCounter.d.ts.map +1 -0
- package/dist-types/helpers/RateLimiter.d.ts +42 -0
- package/dist-types/helpers/RateLimiter.d.ts.map +1 -0
- package/{dist → dist-types}/helpers/WebshopCounter.d.ts.map +1 -1
- package/dist-types/helpers/countDays.d.ts +5 -0
- package/dist-types/helpers/countDays.d.ts.map +1 -0
- package/dist-types/helpers/errorToSimpleErrors.d.ts +3 -0
- package/{dist → dist-types}/helpers/errorToSimpleErrors.d.ts.map +1 -1
- package/{dist → dist-types}/migrations/1605262045-import-postcodes.d.ts +2 -2
- package/{dist → dist-types}/migrations/1605262045-import-postcodes.d.ts.map +1 -1
- package/dist-types/migrations/1605262046-import-postcodes-nl.d.ts +4 -0
- package/{dist → dist-types}/migrations/1605262046-import-postcodes-nl.d.ts.map +1 -1
- package/dist-types/migrations/1720080975-convert-charset.d.ts +4 -0
- package/{dist → dist-types}/migrations/1720080975-convert-charset.d.ts.map +1 -1
- package/{dist → dist-types}/migrations/1720080976-convert-charset-leads.d.ts +1 -1
- package/{dist → dist-types}/migrations/1720080976-convert-charset-leads.d.ts.map +1 -1
- package/{dist → dist-types}/migrations/1733994455-balance-item-status-open.d.ts +1 -1
- package/{dist → dist-types}/migrations/1733994455-balance-item-status-open.d.ts.map +1 -1
- package/dist-types/migrations/1780412083-documents-set-locked.d.ts +4 -0
- package/{dist → dist-types}/migrations/1780412083-documents-set-locked.d.ts.map +1 -1
- package/{dist → dist-types}/migrations/1780928401-v1-groups-migration-data.d.ts +1 -1
- package/{dist → dist-types}/migrations/1780928401-v1-groups-migration-data.d.ts.map +1 -1
- package/{dist → dist-types}/migrations/1785354098-platform-tenant-backfill.d.ts +1 -1
- package/{dist → dist-types}/migrations/1785354098-platform-tenant-backfill.d.ts.map +1 -1
- package/{dist → dist-types}/models/ApplicationFee.d.ts +1 -1
- package/{dist → dist-types}/models/ApplicationFee.d.ts.map +1 -1
- package/{dist → dist-types}/models/AuditLog.d.ts +1 -1
- package/dist-types/models/AuditLog.d.ts.map +1 -0
- package/{dist → dist-types}/models/BalanceItem.d.ts +1 -1
- package/dist-types/models/BalanceItem.d.ts.map +1 -0
- package/{dist → dist-types}/models/BalanceItemPayment.d.ts +2 -2
- package/dist-types/models/BalanceItemPayment.d.ts.map +1 -0
- package/{dist → dist-types}/models/BuckarooPayment.d.ts +1 -1
- package/dist-types/models/BuckarooPayment.d.ts.map +1 -0
- package/{dist → dist-types}/models/CachedBalance.d.ts +2 -2
- package/dist-types/models/CachedBalance.d.ts.map +1 -0
- package/{dist → dist-types}/models/Document.d.ts +6 -8
- package/dist-types/models/Document.d.ts.map +1 -0
- package/dist-types/models/DocumentTemplate.d.ts +121 -0
- package/dist-types/models/DocumentTemplate.d.ts.map +1 -0
- package/{dist → dist-types}/models/Email.d.ts +2 -2
- package/dist-types/models/Email.d.ts.map +1 -0
- package/{dist → dist-types}/models/EmailRecipient.d.ts +7 -2
- package/dist-types/models/EmailRecipient.d.ts.map +1 -0
- package/{dist → dist-types}/models/EmailTemplate.d.ts +1 -1
- package/{dist → dist-types}/models/EmailTemplate.d.ts.map +1 -1
- package/{dist → dist-types}/models/EmailVerificationCode.d.ts +15 -2
- package/dist-types/models/EmailVerificationCode.d.ts.map +1 -0
- package/{dist → dist-types}/models/Event.d.ts +1 -1
- package/{dist → dist-types}/models/Event.d.ts.map +1 -1
- package/{dist → dist-types}/models/EventNotification.d.ts +2 -2
- package/{dist → dist-types}/models/EventNotification.d.ts.map +1 -1
- package/{dist → dist-types}/models/Group.d.ts +8 -6
- package/dist-types/models/Group.d.ts.map +1 -0
- package/dist-types/models/Image.d.ts +48 -0
- package/dist-types/models/Image.d.ts.map +1 -0
- package/{dist → dist-types}/models/ImpersonationToken.d.ts +1 -1
- package/dist-types/models/ImpersonationToken.d.ts.map +1 -0
- package/{dist → dist-types}/models/Invoice.d.ts +1 -1
- package/{dist → dist-types}/models/Invoice.d.ts.map +1 -1
- package/{dist → dist-types}/models/InvoicedBalanceItem.d.ts +10 -2
- package/dist-types/models/InvoicedBalanceItem.d.ts.map +1 -0
- package/{dist → dist-types}/models/MFARecoveryCode.d.ts +1 -1
- package/{dist → dist-types}/models/MFARecoveryCode.d.ts.map +1 -1
- package/{dist → dist-types}/models/MFATOTP.d.ts +2 -1
- package/{dist → dist-types}/models/MFATOTP.d.ts.map +1 -1
- package/{dist → dist-types}/models/MFAToken.d.ts +7 -2
- package/dist-types/models/MFAToken.d.ts.map +1 -0
- package/dist-types/models/MailchimpCredential.d.ts +14 -0
- package/dist-types/models/MailchimpCredential.d.ts.map +1 -0
- package/dist-types/models/MailchimpSync.d.ts +24 -0
- package/dist-types/models/MailchimpSync.d.ts.map +1 -0
- package/{dist → dist-types}/models/Member.d.ts +5 -5
- package/dist-types/models/Member.d.ts.map +1 -0
- package/{dist → dist-types}/models/MemberPlatformMembership.d.ts +1 -1
- package/{dist → dist-types}/models/MemberPlatformMembership.d.ts.map +1 -1
- package/{dist → dist-types}/models/MemberResponsibilityRecord.d.ts +2 -2
- package/dist-types/models/MemberResponsibilityRecord.d.ts.map +1 -0
- package/{dist → dist-types}/models/MemberUser.d.ts +1 -1
- package/dist-types/models/MemberUser.d.ts.map +1 -0
- package/{dist → dist-types}/models/MergedMember.d.ts +2 -2
- package/{dist → dist-types}/models/MergedMember.d.ts.map +1 -1
- package/{dist → dist-types}/models/MolliePayment.d.ts +1 -1
- package/dist-types/models/MolliePayment.d.ts.map +1 -0
- package/{dist → dist-types}/models/MollieToken.d.ts +8 -8
- package/{dist → dist-types}/models/MollieToken.d.ts.map +1 -1
- package/{dist → dist-types}/models/Notification.d.ts +1 -1
- package/{dist → dist-types}/models/Notification.d.ts.map +1 -1
- package/{dist → dist-types}/models/NotificationPreference.d.ts +3 -1
- package/dist-types/models/NotificationPreference.d.ts.map +1 -0
- package/{dist → dist-types}/models/NotificationRecipient.d.ts +1 -1
- package/{dist → dist-types}/models/NotificationRecipient.d.ts.map +1 -1
- package/{dist → dist-types}/models/Order.d.ts +4 -5
- package/dist-types/models/Order.d.ts.map +1 -0
- package/{dist → dist-types}/models/Organization.d.ts +1 -1
- package/dist-types/models/Organization.d.ts.map +1 -0
- package/{dist → dist-types}/models/OrganizationRegistrationPeriod.d.ts +1 -1
- package/dist-types/models/OrganizationRegistrationPeriod.d.ts.map +1 -0
- package/{dist → dist-types}/models/PasswordToken.d.ts +2 -2
- package/dist-types/models/PasswordToken.d.ts.map +1 -0
- package/{dist → dist-types}/models/PayconiqPayment.d.ts +1 -1
- package/dist-types/models/PayconiqPayment.d.ts.map +1 -0
- package/{dist → dist-types}/models/Payment.d.ts +3 -5
- package/dist-types/models/Payment.d.ts.map +1 -0
- package/{dist → dist-types}/models/PaymentSettlement.d.ts +1 -1
- package/{dist → dist-types}/models/PaymentSettlement.d.ts.map +1 -1
- package/{dist → dist-types}/models/Platform.d.ts +1 -1
- package/dist-types/models/Platform.d.ts.map +1 -0
- package/{dist → dist-types}/models/RegisterCode.d.ts +1 -1
- package/{dist → dist-types}/models/RegisterCode.d.ts.map +1 -1
- package/{dist → dist-types}/models/Registration.d.ts +6 -2
- package/dist-types/models/Registration.d.ts.map +1 -0
- package/{dist → dist-types}/models/RegistrationInvitation.d.ts +1 -1
- package/dist-types/models/RegistrationInvitation.d.ts.map +1 -0
- package/{dist → dist-types}/models/RegistrationPeriod.d.ts +1 -3
- package/dist-types/models/RegistrationPeriod.d.ts.map +1 -0
- package/{dist → dist-types}/models/STCredit.d.ts +1 -1
- package/dist-types/models/STCredit.d.ts.map +1 -0
- package/{dist → dist-types}/models/STInvoice.d.ts +1 -1
- package/{dist → dist-types}/models/STInvoice.d.ts.map +1 -1
- package/{dist → dist-types}/models/STPackage.d.ts +1 -1
- package/dist-types/models/STPackage.d.ts.map +1 -0
- package/{dist → dist-types}/models/STPendingInvoice.d.ts +2 -2
- package/dist-types/models/STPendingInvoice.d.ts.map +1 -0
- package/{dist → dist-types}/models/Settlement.d.ts +1 -1
- package/{dist → dist-types}/models/Settlement.d.ts.map +1 -1
- package/{dist → dist-types}/models/SettlementCharge.d.ts +1 -1
- package/{dist → dist-types}/models/SettlementCharge.d.ts.map +1 -1
- package/dist-types/models/StripeAccount.d.ts +24 -0
- package/dist-types/models/StripeAccount.d.ts.map +1 -0
- package/{dist → dist-types}/models/StripeCheckoutSession.d.ts +1 -1
- package/{dist → dist-types}/models/StripeCheckoutSession.d.ts.map +1 -1
- package/{dist → dist-types}/models/StripePaymentIntent.d.ts +1 -1
- package/{dist → dist-types}/models/StripePaymentIntent.d.ts.map +1 -1
- package/{dist → dist-types}/models/Ticket.d.ts +2 -2
- package/{dist → dist-types}/models/Ticket.d.ts.map +1 -1
- package/{dist → dist-types}/models/Token.d.ts +2 -2
- package/{dist → dist-types}/models/Token.d.ts.map +1 -1
- package/{dist → dist-types}/models/UitpasClientCredential.d.ts +1 -1
- package/dist-types/models/UitpasClientCredential.d.ts.map +1 -0
- package/{dist → dist-types}/models/UsedRegisterCode.d.ts +1 -1
- package/{dist → dist-types}/models/UsedRegisterCode.d.ts.map +1 -1
- package/{dist → dist-types}/models/User.d.ts +10 -6
- package/dist-types/models/User.d.ts.map +1 -0
- package/{dist → dist-types}/models/UserPermissions.d.ts +4 -3
- package/dist-types/models/UserPermissions.d.ts.map +1 -0
- package/{dist → dist-types}/models/UserSession.d.ts +1 -1
- package/dist-types/models/UserSession.d.ts.map +1 -0
- package/{dist → dist-types}/models/ViesCachedResult.d.ts +1 -1
- package/{dist → dist-types}/models/ViesCachedResult.d.ts.map +1 -1
- package/{dist → dist-types}/models/WebauthnChallenge.d.ts +2 -1
- package/dist-types/models/WebauthnChallenge.d.ts.map +1 -0
- package/{dist → dist-types}/models/WebauthnCredential.d.ts +2 -1
- package/{dist → dist-types}/models/WebauthnCredential.d.ts.map +1 -1
- package/{dist → dist-types}/models/Webshop.d.ts +2 -2
- package/dist-types/models/Webshop.d.ts.map +1 -0
- package/{dist → dist-types}/models/WebshopDiscountCode.d.ts +8 -2
- package/dist-types/models/WebshopDiscountCode.d.ts.map +1 -0
- package/{dist → dist-types}/models/WebshopUitpasNumber.d.ts +1 -1
- package/{dist → dist-types}/models/WebshopUitpasNumber.d.ts.map +1 -1
- package/{dist → dist-types}/models/addresses/City.d.ts +2 -2
- package/{dist → dist-types}/models/addresses/City.d.ts.map +1 -1
- package/{dist → dist-types}/models/addresses/PostalCode.d.ts +2 -2
- package/dist-types/models/addresses/PostalCode.d.ts.map +1 -0
- package/{dist → dist-types}/models/addresses/Province.d.ts +1 -1
- package/{dist → dist-types}/models/addresses/Province.d.ts.map +1 -1
- package/{dist → dist-types}/models/addresses/Street.d.ts +2 -2
- package/{dist → dist-types}/models/addresses/Street.d.ts.map +1 -1
- package/{dist → dist-types}/models/v1GroupMigrationData.d.ts +1 -1
- package/{dist → dist-types}/models/v1GroupMigrationData.d.ts.map +1 -1
- package/dist-types/services/RegistrationPeriodService.d.ts +5 -0
- package/dist-types/services/RegistrationPeriodService.d.ts.map +1 -0
- package/dist-types/services/UserService.d.ts +19 -0
- package/dist-types/services/UserService.d.ts.map +1 -0
- package/{dist → dist-types}/structures/OrganizationServerMetaData.d.ts +1 -1
- package/dist-types/structures/OrganizationServerMetaData.d.ts.map +1 -0
- package/package.json +81 -64
- package/src/factories/AddressFactory.ts +9 -3
- package/src/factories/BalanceItemFactory.ts +6 -2
- package/src/factories/DocumentTemplateFactory.ts +21 -14
- package/src/factories/EmailTemplateFactory.ts +5 -4
- package/src/factories/EmergencyContactFactory.ts +13 -13
- package/src/factories/EventFactory.ts +4 -2
- package/src/factories/EventNotificationFactory.ts +6 -3
- package/src/factories/EventNotificationTypeFactory.ts +4 -2
- package/src/factories/GroupFactory.ts +28 -12
- package/src/factories/MemberFactory.ts +40 -23
- package/src/factories/MemberResponsibilityRecordFactory.ts +15 -8
- package/src/factories/OrderFactory.ts +17 -12
- package/src/factories/OrganizationFactory.ts +18 -9
- package/src/factories/OrganizationRegistrationPeriodFactory.ts +5 -2
- package/src/factories/OrganizationTagFactory.ts +1 -1
- package/src/factories/ParentFactory.ts +45 -27
- package/src/factories/PlatformEventTypeFactory.ts +4 -2
- package/src/factories/PlatformResponsibilityFactory.ts +4 -2
- package/src/factories/RecordAnswerFactory.ts +36 -14
- package/src/factories/RecordCategoryFactory.ts +3 -5
- package/src/factories/RecordFactory.ts +2 -2
- package/src/factories/RegisterCodeFactory.ts +11 -6
- package/src/factories/RegistrationFactory.ts +20 -11
- package/src/factories/RegistrationInvitationFactory.ts +2 -2
- package/src/factories/RegistrationPeriodFactory.ts +2 -2
- package/src/factories/STPackageFactory.ts +5 -2
- package/src/factories/TenantFactory.test.ts +6 -3
- package/src/factories/TenantFactory.ts +2 -2
- package/src/factories/TicketFactory.ts +5 -2
- package/src/factories/UserFactory.ts +21 -10
- package/src/factories/WebshopFactory.ts +7 -4
- package/src/helpers/DNSValidator.ts +76 -43
- package/src/helpers/Handlebars.ts +34 -20
- package/src/helpers/InvoiceCounter.test.ts +7 -3
- package/src/helpers/InvoiceCounter.ts +26 -6
- package/src/helpers/RateLimiter.test.ts +91 -0
- package/src/helpers/RateLimiter.ts +59 -26
- package/src/helpers/WebshopCounter.ts +13 -7
- package/src/helpers/countDays.ts +15 -0
- package/src/helpers/errorToSimpleErrors.ts +9 -3
- package/src/migrations/1605262045-import-postcodes.ts +23 -14
- package/src/migrations/1605262046-import-postcodes-nl.ts +28 -10
- package/src/migrations/1720080975-convert-charset.ts +56 -5
- package/src/migrations/1720080976-convert-charset-leads.ts +10 -3
- package/src/migrations/1733994455-balance-item-status-open.ts +3 -9
- package/src/migrations/1780412083-documents-set-locked.ts +4 -2
- package/src/migrations/1780928401-v1-groups-migration-data.ts +1 -1
- package/src/migrations/1782333024-discount-code-email.sql +3 -0
- package/src/migrations/1785354098-platform-tenant-backfill.ts +4 -2
- package/src/migrations/1788509800-invoiced-balance-items-details.sql +5 -0
- package/src/migrations/1788900000-document-parent-id.sql +2 -0
- package/src/migrations/1790788551-email-verification-codes-nullable-user-id.sql +1 -0
- package/src/migrations/1790849769-registrations-registered-by-member.sql +2 -0
- package/src/migrations/1791503836-create-mailchimp-credentials.sql +10 -0
- package/src/migrations/1791503837-create-mailchimp-syncs.sql +16 -0
- package/src/models/ApplicationFee.ts +9 -5
- package/src/models/AuditLog.ts +29 -9
- package/src/models/BalanceItem.ts +111 -44
- package/src/models/BalanceItemPayment.ts +12 -8
- package/src/models/BuckarooPayment.ts +5 -3
- package/src/models/CachedBalance.test.ts +65 -13
- package/src/models/CachedBalance.ts +159 -83
- package/src/models/Document.ts +26 -127
- package/src/models/DocumentTemplate.test.ts +166 -1
- package/src/models/DocumentTemplate.ts +786 -209
- package/src/models/Email.ts +170 -66
- package/src/models/EmailRecipient.ts +36 -11
- package/src/models/EmailTemplate.ts +15 -8
- package/src/models/EmailVerificationCode.ts +108 -32
- package/src/models/Event.ts +23 -10
- package/src/models/EventNotification.ts +19 -9
- package/src/models/Group.ts +60 -46
- package/src/models/Image.ts +149 -25
- package/src/models/ImpersonationToken.ts +18 -7
- package/src/models/Invoice.ts +42 -9
- package/src/models/InvoicedBalanceItem.ts +36 -8
- package/src/models/MFARecoveryCode.ts +8 -5
- package/src/models/MFATOTP.ts +36 -10
- package/src/models/MFAToken.ts +35 -7
- package/src/models/MailchimpCredential.ts +55 -0
- package/src/models/MailchimpSync.ts +86 -0
- package/src/models/Member.ts +112 -101
- package/src/models/MemberPlatformMembership.ts +11 -6
- package/src/models/MemberResponsibilityRecord.ts +15 -7
- package/src/models/MemberUser.ts +4 -3
- package/src/models/MergedMember.ts +3 -3
- package/src/models/MolliePayment.ts +5 -3
- package/src/models/MollieToken.ts +97 -54
- package/src/models/Notification.ts +10 -6
- package/src/models/NotificationPreference.ts +18 -5
- package/src/models/NotificationRecipient.ts +7 -4
- package/src/models/Order.ts +241 -109
- package/src/models/Organization.test.ts +1 -1
- package/src/models/Organization.ts +119 -63
- package/src/models/OrganizationRegistrationPeriod.ts +62 -19
- package/src/models/PasswordToken.ts +14 -7
- package/src/models/PayconiqPayment.ts +115 -42
- package/src/models/Payment.ts +148 -65
- package/src/models/PaymentSettlement.ts +9 -5
- package/src/models/Platform.test.ts +33 -11
- package/src/models/Platform.ts +34 -16
- package/src/models/RegisterCode.ts +6 -4
- package/src/models/Registration.ts +29 -9
- package/src/models/RegistrationInvitation.ts +7 -4
- package/src/models/RegistrationPeriod.ts +21 -58
- package/src/models/STCredit.ts +20 -11
- package/src/models/STInvoice.ts +9 -5
- package/src/models/STPackage.ts +27 -14
- package/src/models/STPendingInvoice.ts +11 -7
- package/src/models/Settlement.ts +10 -6
- package/src/models/SettlementCharge.ts +9 -5
- package/src/models/StripeAccount.test.ts +47 -0
- package/src/models/StripeAccount.ts +52 -12
- package/src/models/StripeCheckoutSession.ts +5 -3
- package/src/models/StripePaymentIntent.ts +5 -3
- package/src/models/Ticket.ts +13 -9
- package/src/models/Token.test.ts +1 -2
- package/src/models/Token.ts +25 -12
- package/src/models/UitpasClientCredential.ts +12 -6
- package/src/models/UsedRegisterCode.ts +9 -5
- package/src/models/User.ts +130 -135
- package/src/models/UserPermissions.ts +12 -7
- package/src/models/UserSession.ts +9 -4
- package/src/models/ViesCachedResult.ts +2 -2
- package/src/models/WebauthnChallenge.ts +15 -6
- package/src/models/WebauthnCredential.ts +13 -5
- package/src/models/Webshop.ts +24 -12
- package/src/models/WebshopDiscountCode.ts +23 -8
- package/src/models/WebshopUitpasNumber.ts +22 -12
- package/src/models/_relations.ts +1 -1
- package/src/models/addresses/City.ts +6 -4
- package/src/models/addresses/PostalCode.ts +59 -14
- package/src/models/addresses/Province.ts +5 -3
- package/src/models/addresses/Street.ts +6 -4
- package/src/models/tenantId.test.ts +6 -1
- package/src/models/v1GroupMigrationData.ts +2 -2
- package/src/services/RegistrationPeriodService.ts +48 -0
- package/src/services/UserService.ts +81 -0
- package/src/structures/OrganizationServerMetaData.ts +40 -16
- package/dist/factories/BalanceItemFactory.d.ts.map +0 -1
- package/dist/factories/DocumentTemplateFactory.d.ts.map +0 -1
- package/dist/factories/RecordAnswerFactory.d.ts.map +0 -1
- package/dist/factories/RegisterCodeFactory.d.ts.map +0 -1
- package/dist/helpers/InvoiceCounter.d.ts.map +0 -1
- package/dist/helpers/RateLimiter.d.ts +0 -28
- package/dist/helpers/RateLimiter.d.ts.map +0 -1
- package/dist/helpers/errorToSimpleErrors.d.ts +0 -3
- package/dist/migrations/1605262046-import-postcodes-nl.d.ts +0 -4
- package/dist/migrations/1720080975-convert-charset.d.ts +0 -4
- package/dist/migrations/1780412083-documents-set-locked.d.ts +0 -4
- package/dist/models/AuditLog.d.ts.map +0 -1
- package/dist/models/BalanceItem.d.ts.map +0 -1
- package/dist/models/BalanceItemPayment.d.ts.map +0 -1
- package/dist/models/BuckarooPayment.d.ts.map +0 -1
- package/dist/models/CachedBalance.d.ts.map +0 -1
- package/dist/models/Document.d.ts.map +0 -1
- package/dist/models/DocumentTemplate.d.ts +0 -57
- package/dist/models/DocumentTemplate.d.ts.map +0 -1
- package/dist/models/Email.d.ts.map +0 -1
- package/dist/models/EmailRecipient.d.ts.map +0 -1
- package/dist/models/EmailVerificationCode.d.ts.map +0 -1
- package/dist/models/Group.d.ts.map +0 -1
- package/dist/models/Image.d.ts +0 -18
- package/dist/models/Image.d.ts.map +0 -1
- package/dist/models/ImpersonationToken.d.ts.map +0 -1
- package/dist/models/InvoicedBalanceItem.d.ts.map +0 -1
- package/dist/models/MFAToken.d.ts.map +0 -1
- package/dist/models/Member.d.ts.map +0 -1
- package/dist/models/MemberResponsibilityRecord.d.ts.map +0 -1
- package/dist/models/MemberUser.d.ts.map +0 -1
- package/dist/models/MolliePayment.d.ts.map +0 -1
- package/dist/models/NotificationPreference.d.ts.map +0 -1
- package/dist/models/Order.d.ts.map +0 -1
- package/dist/models/Organization.d.ts.map +0 -1
- package/dist/models/OrganizationRegistrationPeriod.d.ts.map +0 -1
- package/dist/models/PasswordToken.d.ts.map +0 -1
- package/dist/models/PayconiqPayment.d.ts.map +0 -1
- package/dist/models/Payment.d.ts.map +0 -1
- package/dist/models/Platform.d.ts.map +0 -1
- package/dist/models/Registration.d.ts.map +0 -1
- package/dist/models/RegistrationInvitation.d.ts.map +0 -1
- package/dist/models/RegistrationPeriod.d.ts.map +0 -1
- package/dist/models/STCredit.d.ts.map +0 -1
- package/dist/models/STPackage.d.ts.map +0 -1
- package/dist/models/STPendingInvoice.d.ts.map +0 -1
- package/dist/models/StripeAccount.d.ts +0 -17
- package/dist/models/StripeAccount.d.ts.map +0 -1
- package/dist/models/UitpasClientCredential.d.ts.map +0 -1
- package/dist/models/User.d.ts.map +0 -1
- package/dist/models/UserPermissions.d.ts.map +0 -1
- package/dist/models/UserSession.d.ts.map +0 -1
- package/dist/models/WebauthnChallenge.d.ts.map +0 -1
- package/dist/models/Webshop.d.ts.map +0 -1
- package/dist/models/WebshopDiscountCode.d.ts.map +0 -1
- package/dist/models/addresses/PostalCode.d.ts.map +0 -1
- package/dist/structures/OrganizationServerMetaData.d.ts.map +0 -1
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- /package/{dist → dist-types}/constants/sessions.d.ts +0 -0
- /package/{dist → dist-types}/constants/sessions.d.ts.map +0 -0
- /package/{dist → dist-types}/factories/index.d.ts +0 -0
- /package/{dist → dist-types}/factories/index.d.ts.map +0 -0
- /package/{dist → dist-types}/helpers/DNSValidator.d.ts +0 -0
- /package/{dist → dist-types}/helpers/Handlebars.d.ts +0 -0
- /package/{dist → dist-types}/helpers/InvoiceCounter.d.ts +0 -0
- /package/{dist → dist-types}/helpers/WebshopCounter.d.ts +0 -0
- /package/{dist → dist-types}/index.d.ts +0 -0
- /package/{dist → dist-types}/index.d.ts.map +0 -0
- /package/{dist → dist-types}/models/_relations.d.ts +0 -0
- /package/{dist → dist-types}/models/_relations.d.ts.map +0 -0
- /package/{dist → dist-types}/models/index.d.ts +0 -0
- /package/{dist → dist-types}/models/index.d.ts.map +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
PermissionRoleDetailed,
|
|
3
|
+
PlatformConfig,
|
|
4
|
+
PlatformMembershipType,
|
|
5
|
+
PlatformPrivateConfig,
|
|
6
|
+
} from '@stamhoofd/structures';
|
|
2
7
|
import { Platform } from './Platform.js';
|
|
3
|
-
import { Database } from '@
|
|
8
|
+
import { Database } from '@stamhoofd/node-database';
|
|
4
9
|
import { STExpect, TestUtils } from '@stamhoofd/test-utils';
|
|
5
10
|
import { QueueHandler } from '@stamhoofd/queues';
|
|
6
11
|
|
|
@@ -160,15 +165,22 @@ describe('Model.Platform', () => {
|
|
|
160
165
|
const struct = await Platform.getStructForTenant('child-tenant');
|
|
161
166
|
|
|
162
167
|
expect(struct.parentTenant?.id).toBe(root.id);
|
|
163
|
-
expect(struct.parentTenant?.config.membershipTypes.map(m => m.name)).toEqual([
|
|
168
|
+
expect(struct.parentTenant?.config.membershipTypes.map((m) => m.name)).toEqual([
|
|
169
|
+
'Root type',
|
|
170
|
+
]);
|
|
164
171
|
});
|
|
165
172
|
|
|
166
173
|
test('the parent never carries its private config', async () => {
|
|
167
174
|
await createChildOfRoot();
|
|
168
175
|
|
|
169
176
|
// Both variants: a child tenant administrator has no rights on the parent either way
|
|
170
|
-
expect(
|
|
171
|
-
|
|
177
|
+
expect(
|
|
178
|
+
(await Platform.getStructForTenant('child-tenant')).parentTenant?.privateConfig,
|
|
179
|
+
).toBeNull();
|
|
180
|
+
expect(
|
|
181
|
+
(await Platform.getPrivateStructForTenant('child-tenant')).parentTenant
|
|
182
|
+
?.privateConfig,
|
|
183
|
+
).toBeNull();
|
|
172
184
|
});
|
|
173
185
|
|
|
174
186
|
test('the parent is only one level deep', async () => {
|
|
@@ -252,7 +264,9 @@ describe('Model.Platform', () => {
|
|
|
252
264
|
other.id = 'second-tenant';
|
|
253
265
|
other.periodId = root.periodId;
|
|
254
266
|
other.config = PlatformConfig.create({
|
|
255
|
-
membershipTypes: [
|
|
267
|
+
membershipTypes: [
|
|
268
|
+
PlatformMembershipType.create({ id: 't2', name: 'Second tenant type' }),
|
|
269
|
+
],
|
|
256
270
|
});
|
|
257
271
|
await other.save();
|
|
258
272
|
|
|
@@ -268,14 +282,18 @@ describe('Model.Platform', () => {
|
|
|
268
282
|
test('each tenant caches its own struct', async () => {
|
|
269
283
|
const { root } = await createSecondTenant();
|
|
270
284
|
|
|
271
|
-
root.config.membershipTypes = [
|
|
285
|
+
root.config.membershipTypes = [
|
|
286
|
+
PlatformMembershipType.create({ id: 't1', name: 'Root type' }),
|
|
287
|
+
];
|
|
272
288
|
await root.save();
|
|
273
289
|
|
|
274
290
|
const rootStruct = await Platform.getStructForTenant('1');
|
|
275
291
|
const otherStruct = await Platform.getStructForTenant('second-tenant');
|
|
276
292
|
|
|
277
|
-
expect(rootStruct.config.membershipTypes.map(m => m.name)).toEqual(['Root type']);
|
|
278
|
-
expect(otherStruct.config.membershipTypes.map(m => m.name)).toEqual([
|
|
293
|
+
expect(rootStruct.config.membershipTypes.map((m) => m.name)).toEqual(['Root type']);
|
|
294
|
+
expect(otherStruct.config.membershipTypes.map((m) => m.name)).toEqual([
|
|
295
|
+
'Second tenant type',
|
|
296
|
+
]);
|
|
279
297
|
});
|
|
280
298
|
|
|
281
299
|
test('saving one tenant does not discard another tenant cache', async () => {
|
|
@@ -283,12 +301,16 @@ describe('Model.Platform', () => {
|
|
|
283
301
|
|
|
284
302
|
const otherBefore = await Platform.getStructForTenant('second-tenant');
|
|
285
303
|
|
|
286
|
-
root.config.membershipTypes = [
|
|
304
|
+
root.config.membershipTypes = [
|
|
305
|
+
PlatformMembershipType.create({ id: 't1', name: 'Changed' }),
|
|
306
|
+
];
|
|
287
307
|
await root.save();
|
|
288
308
|
|
|
289
309
|
// Same object identity: the second tenant's cache was never rebuilt
|
|
290
310
|
expect(await Platform.getStructForTenant('second-tenant')).toBe(otherBefore);
|
|
291
|
-
expect((await Platform.getStructForTenant('1')).config.membershipTypes[0].name).toBe(
|
|
311
|
+
expect((await Platform.getStructForTenant('1')).config.membershipTypes[0].name).toBe(
|
|
312
|
+
'Changed',
|
|
313
|
+
);
|
|
292
314
|
});
|
|
293
315
|
|
|
294
316
|
test('clearing one tenant cache leaves the other in place', async () => {
|
package/src/models/Platform.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { column } from '@
|
|
2
|
-
import { SimpleError } from '@
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
|
+
import { SimpleError } from '@stamhoofd/common-errors';
|
|
3
3
|
import { QueueHandler } from '@stamhoofd/queues';
|
|
4
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
5
|
-
import {
|
|
4
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
5
|
+
import {
|
|
6
|
+
AuditLogReplacementDependencies,
|
|
7
|
+
PlatformConfig,
|
|
8
|
+
PlatformPrivateConfig,
|
|
9
|
+
PlatformServerConfig,
|
|
10
|
+
Platform as PlatformStruct,
|
|
11
|
+
} from '@stamhoofd/structures';
|
|
6
12
|
import { uuidToName } from '@stamhoofd/structures/helpers/uuidToName.js';
|
|
7
13
|
import type { Language } from '@stamhoofd/types/Language';
|
|
8
14
|
import { deepFreeze } from '@stamhoofd/utility';
|
|
@@ -21,7 +27,9 @@ export class Platform extends QueryableModel {
|
|
|
21
27
|
static table = 'platform';
|
|
22
28
|
|
|
23
29
|
@column({
|
|
24
|
-
primary: true,
|
|
30
|
+
primary: true,
|
|
31
|
+
type: 'string',
|
|
32
|
+
beforeSave(value) {
|
|
25
33
|
return value ?? uuidv4();
|
|
26
34
|
},
|
|
27
35
|
})
|
|
@@ -90,7 +98,7 @@ export class Platform extends QueryableModel {
|
|
|
90
98
|
throw new SimpleError({
|
|
91
99
|
code: 'only_platform',
|
|
92
100
|
message: 'Period id should only be used if userMode is platform',
|
|
93
|
-
human: $t(
|
|
101
|
+
human: $t('%1AD'),
|
|
94
102
|
});
|
|
95
103
|
}
|
|
96
104
|
|
|
@@ -116,7 +124,9 @@ export class Platform extends QueryableModel {
|
|
|
116
124
|
this.nextPeriodId = period?.nextPeriodId ?? null;
|
|
117
125
|
}
|
|
118
126
|
|
|
119
|
-
static async getPrivateStructForTenant(
|
|
127
|
+
static async getPrivateStructForTenant(
|
|
128
|
+
tenantId: string,
|
|
129
|
+
): Promise<PlatformStruct & { privateConfig: PlatformPrivateConfig }> {
|
|
120
130
|
const privateStruct = (await this.getCache(tenantId)).privateStruct;
|
|
121
131
|
|
|
122
132
|
if (!privateStruct.privateConfig) {
|
|
@@ -126,7 +136,9 @@ export class Platform extends QueryableModel {
|
|
|
126
136
|
return privateStruct;
|
|
127
137
|
}
|
|
128
138
|
|
|
129
|
-
static async getSharedPrivateStruct(): Promise<
|
|
139
|
+
static async getSharedPrivateStruct(): Promise<
|
|
140
|
+
PlatformStruct & { privateConfig: PlatformPrivateConfig }
|
|
141
|
+
> {
|
|
130
142
|
return await this.getPrivateStructForTenant(ROOT_TENANT_ID);
|
|
131
143
|
}
|
|
132
144
|
|
|
@@ -139,7 +151,7 @@ export class Platform extends QueryableModel {
|
|
|
139
151
|
return undefined;
|
|
140
152
|
}
|
|
141
153
|
|
|
142
|
-
return await this.select().where('uri', uri).first(false) ?? undefined;
|
|
154
|
+
return (await this.select().where('uri', uri).first(false)) ?? undefined;
|
|
143
155
|
}
|
|
144
156
|
|
|
145
157
|
static async getByDomain(domain: string): Promise<Platform | undefined> {
|
|
@@ -147,7 +159,7 @@ export class Platform extends QueryableModel {
|
|
|
147
159
|
return undefined;
|
|
148
160
|
}
|
|
149
161
|
|
|
150
|
-
return await this.select().where('domain', domain).first(false) ?? undefined;
|
|
162
|
+
return (await this.select().where('domain', domain).first(false)) ?? undefined;
|
|
151
163
|
}
|
|
152
164
|
|
|
153
165
|
static async getForEditing(tenantId: string = ROOT_TENANT_ID): Promise<Platform> {
|
|
@@ -176,9 +188,10 @@ export class Platform extends QueryableModel {
|
|
|
176
188
|
|
|
177
189
|
if (STAMHOOFD.userMode === 'platform') {
|
|
178
190
|
model.periodId = (await RegistrationPeriod.all())[0].id;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
191
|
+
} else {
|
|
192
|
+
const period = await RegistrationPeriod.select()
|
|
193
|
+
.where('organizationId', null)
|
|
194
|
+
.first(true);
|
|
182
195
|
model.periodId = period.id;
|
|
183
196
|
}
|
|
184
197
|
|
|
@@ -239,7 +252,9 @@ export class Platform extends QueryableModel {
|
|
|
239
252
|
});
|
|
240
253
|
|
|
241
254
|
// We clone to avoid the chance of updating the platform model
|
|
242
|
-
const privateStruct = struct.clone() as PlatformStruct & {
|
|
255
|
+
const privateStruct = struct.clone() as PlatformStruct & {
|
|
256
|
+
privateConfig: PlatformPrivateConfig;
|
|
257
|
+
};
|
|
243
258
|
|
|
244
259
|
const clone = struct.clone();
|
|
245
260
|
clone.privateConfig = null;
|
|
@@ -250,7 +265,7 @@ export class Platform extends QueryableModel {
|
|
|
250
265
|
// together with the caches. Uses the public struct on purpose: resolving privateConfig
|
|
251
266
|
// roles would change the names that get persisted in audit logs.
|
|
252
267
|
// Still process-wide: it becomes tenant-aware once a request carries its tenant.
|
|
253
|
-
AuditLogReplacementDependencies.uuidToName = uuid => uuidToName(uuid, clone);
|
|
268
|
+
AuditLogReplacementDependencies.uuidToName = (uuid) => uuidToName(uuid, clone);
|
|
254
269
|
}
|
|
255
270
|
|
|
256
271
|
deepFreeze(model);
|
|
@@ -276,7 +291,10 @@ export class Platform extends QueryableModel {
|
|
|
276
291
|
|
|
277
292
|
const parent = await this.getByID(model.parentTenantId);
|
|
278
293
|
if (!parent) {
|
|
279
|
-
console.error(
|
|
294
|
+
console.error(
|
|
295
|
+
'[Platform] Tenant ' + model.id + ' has an unknown parentTenantId',
|
|
296
|
+
model.parentTenantId,
|
|
297
|
+
);
|
|
280
298
|
return null;
|
|
281
299
|
}
|
|
282
300
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { column } from '@
|
|
2
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
3
3
|
import basex from 'base-x';
|
|
4
4
|
import crypto from 'crypto';
|
|
5
5
|
|
|
@@ -43,7 +43,8 @@ export class RegisterCode extends QueryableModel {
|
|
|
43
43
|
invoiceValue: number | null = null;
|
|
44
44
|
|
|
45
45
|
@column({
|
|
46
|
-
type: 'datetime',
|
|
46
|
+
type: 'datetime',
|
|
47
|
+
beforeSave(old?: any) {
|
|
47
48
|
if (old !== undefined) {
|
|
48
49
|
return old;
|
|
49
50
|
}
|
|
@@ -55,7 +56,8 @@ export class RegisterCode extends QueryableModel {
|
|
|
55
56
|
createdAt: Date;
|
|
56
57
|
|
|
57
58
|
@column({
|
|
58
|
-
type: 'datetime',
|
|
59
|
+
type: 'datetime',
|
|
60
|
+
beforeSave() {
|
|
59
61
|
const date = new Date();
|
|
60
62
|
date.setMilliseconds(0);
|
|
61
63
|
return date;
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import type { ManyToOneRelation } from '@
|
|
2
|
-
import { column } from '@
|
|
1
|
+
import type { ManyToOneRelation } from '@stamhoofd/node-database';
|
|
2
|
+
import { column } from '@stamhoofd/node-database';
|
|
3
3
|
import type { RecordAnswer } from '@stamhoofd/structures';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AppliedRegistrationDiscount,
|
|
6
|
+
GroupPrice,
|
|
7
|
+
RecordAnswerMapDecoder,
|
|
8
|
+
RegisterItemOption,
|
|
9
|
+
Registration as RegistrationStructure,
|
|
10
|
+
StockReservation,
|
|
11
|
+
} from '@stamhoofd/structures';
|
|
5
12
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
13
|
|
|
7
|
-
import { ArrayDecoder, MapDecoder, StringDecoder } from '@
|
|
8
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
14
|
+
import { ArrayDecoder, MapDecoder, StringDecoder } from '@stamhoofd/common-encoding';
|
|
15
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
9
16
|
import type { Group } from './Group.js';
|
|
10
17
|
|
|
11
18
|
export class Registration extends QueryableModel {
|
|
12
19
|
static table = 'registrations';
|
|
13
20
|
|
|
14
21
|
@column({
|
|
15
|
-
primary: true,
|
|
22
|
+
primary: true,
|
|
23
|
+
type: 'string',
|
|
24
|
+
beforeSave(value) {
|
|
16
25
|
return value ?? uuidv4();
|
|
17
26
|
},
|
|
18
27
|
})
|
|
@@ -62,7 +71,8 @@ export class Registration extends QueryableModel {
|
|
|
62
71
|
price: number | null = null;
|
|
63
72
|
|
|
64
73
|
@column({
|
|
65
|
-
type: 'datetime',
|
|
74
|
+
type: 'datetime',
|
|
75
|
+
beforeSave(old?: any) {
|
|
66
76
|
if (old !== undefined) {
|
|
67
77
|
return old;
|
|
68
78
|
}
|
|
@@ -74,7 +84,8 @@ export class Registration extends QueryableModel {
|
|
|
74
84
|
createdAt: Date;
|
|
75
85
|
|
|
76
86
|
@column({
|
|
77
|
-
type: 'datetime',
|
|
87
|
+
type: 'datetime',
|
|
88
|
+
beforeSave() {
|
|
78
89
|
const date = new Date();
|
|
79
90
|
date.setMilliseconds(0);
|
|
80
91
|
return date;
|
|
@@ -127,6 +138,12 @@ export class Registration extends QueryableModel {
|
|
|
127
138
|
@column({ type: 'boolean' })
|
|
128
139
|
sendConfirmationEmail = true;
|
|
129
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Started by the member (or a linked user) instead of by an administrator, so administrators get notified once it is valid
|
|
143
|
+
*/
|
|
144
|
+
@column({ type: 'boolean' })
|
|
145
|
+
registeredByMember = false;
|
|
146
|
+
|
|
130
147
|
@column({ type: 'datetime', nullable: true })
|
|
131
148
|
deactivatedAt: Date | null = null;
|
|
132
149
|
|
|
@@ -166,6 +183,9 @@ export class Registration extends QueryableModel {
|
|
|
166
183
|
}
|
|
167
184
|
|
|
168
185
|
shouldIncludeStock() {
|
|
169
|
-
return (
|
|
186
|
+
return (
|
|
187
|
+
(this.registeredAt !== null && this.deactivatedAt === null) ||
|
|
188
|
+
(this.reservedUntil && this.reservedUntil > new Date())
|
|
189
|
+
);
|
|
170
190
|
}
|
|
171
191
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { column } from '@
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
|
|
4
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
4
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Invitation to register for a group. If an invitation exists the member can always register even if he does not meet the requirements of the group.
|
|
@@ -11,7 +11,9 @@ export class RegistrationInvitation extends QueryableModel {
|
|
|
11
11
|
static table = 'registration_invitations';
|
|
12
12
|
|
|
13
13
|
@column({
|
|
14
|
-
primary: true,
|
|
14
|
+
primary: true,
|
|
15
|
+
type: 'string',
|
|
16
|
+
beforeSave(value) {
|
|
15
17
|
return value ?? uuidv4();
|
|
16
18
|
},
|
|
17
19
|
})
|
|
@@ -27,7 +29,8 @@ export class RegistrationInvitation extends QueryableModel {
|
|
|
27
29
|
organizationId: string;
|
|
28
30
|
|
|
29
31
|
@column({
|
|
30
|
-
type: 'datetime',
|
|
32
|
+
type: 'datetime',
|
|
33
|
+
beforeSave(old?: any) {
|
|
31
34
|
if (old !== undefined) {
|
|
32
35
|
return old;
|
|
33
36
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { column } from '@
|
|
2
|
-
import { SimpleError } from '@
|
|
3
|
-
import { QueryableModel, SQL, SQLWhereSign } from '@stamhoofd/sql';
|
|
4
|
-
import {
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
|
+
import { SimpleError } from '@stamhoofd/common-errors';
|
|
3
|
+
import { QueryableModel, SQL, SQLWhereSign } from '@stamhoofd/node-sql';
|
|
4
|
+
import {
|
|
5
|
+
RegistrationPeriodBase,
|
|
6
|
+
RegistrationPeriodSettings,
|
|
7
|
+
RegistrationPeriod as RegistrationPeriodStruct,
|
|
8
|
+
} from '@stamhoofd/structures';
|
|
5
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
-
import { Platform } from './Platform.js';
|
|
7
10
|
|
|
8
11
|
export class RegistrationPeriod extends QueryableModel {
|
|
9
12
|
static table = 'registration_periods';
|
|
10
13
|
|
|
11
14
|
@column({
|
|
12
|
-
primary: true,
|
|
15
|
+
primary: true,
|
|
16
|
+
type: 'string',
|
|
17
|
+
beforeSave(value) {
|
|
13
18
|
return value ?? uuidv4();
|
|
14
19
|
},
|
|
15
20
|
})
|
|
@@ -46,7 +51,8 @@ export class RegistrationPeriod extends QueryableModel {
|
|
|
46
51
|
locked = false;
|
|
47
52
|
|
|
48
53
|
@column({
|
|
49
|
-
type: 'datetime',
|
|
54
|
+
type: 'datetime',
|
|
55
|
+
beforeSave(old?: any) {
|
|
50
56
|
if (old !== undefined) {
|
|
51
57
|
return old;
|
|
52
58
|
}
|
|
@@ -58,7 +64,8 @@ export class RegistrationPeriod extends QueryableModel {
|
|
|
58
64
|
createdAt: Date;
|
|
59
65
|
|
|
60
66
|
@column({
|
|
61
|
-
type: 'datetime',
|
|
67
|
+
type: 'datetime',
|
|
68
|
+
beforeSave() {
|
|
62
69
|
const date = new Date();
|
|
63
70
|
date.setMilliseconds(0);
|
|
64
71
|
return date;
|
|
@@ -81,7 +88,10 @@ export class RegistrationPeriod extends QueryableModel {
|
|
|
81
88
|
this.endDate = new Date(Date.now() + 1000 * 60 * 60 * 24 * 31); // 1 month
|
|
82
89
|
}
|
|
83
90
|
|
|
84
|
-
static async getByDate(
|
|
91
|
+
static async getByDate(
|
|
92
|
+
date: Date,
|
|
93
|
+
organizationId: string | null,
|
|
94
|
+
): Promise<RegistrationPeriod | null> {
|
|
85
95
|
if (STAMHOOFD.userMode === 'organization' && organizationId === null) {
|
|
86
96
|
throw new SimpleError({
|
|
87
97
|
code: 'invalid_argument',
|
|
@@ -90,7 +100,8 @@ export class RegistrationPeriod extends QueryableModel {
|
|
|
90
100
|
});
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
const query = SQL.select()
|
|
103
|
+
const query = SQL.select()
|
|
104
|
+
.from(SQL.table(this.table))
|
|
94
105
|
.where(SQL.column('startDate'), SQLWhereSign.LessEqual, date)
|
|
95
106
|
.where(SQL.column('endDate'), SQLWhereSign.GreaterEqual, date);
|
|
96
107
|
|
|
@@ -106,52 +117,4 @@ export class RegistrationPeriod extends QueryableModel {
|
|
|
106
117
|
|
|
107
118
|
return RegistrationPeriod.fromRow(result[this.table]) ?? null;
|
|
108
119
|
}
|
|
109
|
-
|
|
110
|
-
async updatePreviousNextPeriods() {
|
|
111
|
-
return await RegistrationPeriod.updatePreviousNextPeriods(this.organizationId, this);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static async updatePreviousNextPeriods(organizationId: string | null, existingReference?: RegistrationPeriod) {
|
|
115
|
-
const allPeriods = await RegistrationPeriod.select().where('organizationId', organizationId).fetch();
|
|
116
|
-
|
|
117
|
-
// Include self if not yet in database
|
|
118
|
-
if (existingReference) {
|
|
119
|
-
if (!existingReference.existsInDatabase) {
|
|
120
|
-
allPeriods.push(existingReference);
|
|
121
|
-
} else {
|
|
122
|
-
// Replace self with this
|
|
123
|
-
const index = allPeriods.findIndex(p => p.id === existingReference.id);
|
|
124
|
-
if (index !== -1) {
|
|
125
|
-
allPeriods[index] = existingReference;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Sort by start date
|
|
131
|
-
allPeriods.sort((a, b) => a.startDate.getTime() - b.startDate.getTime());
|
|
132
|
-
|
|
133
|
-
// Take the one before this.periodId
|
|
134
|
-
let previousPeriod: RegistrationPeriod | null = null;
|
|
135
|
-
|
|
136
|
-
for (const period of allPeriods) {
|
|
137
|
-
period.previousPeriodId = previousPeriod?.id ?? null;
|
|
138
|
-
period.nextPeriodId = null;
|
|
139
|
-
|
|
140
|
-
if (previousPeriod) {
|
|
141
|
-
previousPeriod.nextPeriodId = period.id;
|
|
142
|
-
}
|
|
143
|
-
previousPeriod = period;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Save all
|
|
147
|
-
for (const period of allPeriods) {
|
|
148
|
-
await period.save();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (organizationId === null) {
|
|
152
|
-
const e = await Platform.getForEditing();
|
|
153
|
-
await e.setPreviousPeriodId();
|
|
154
|
-
await e.save();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
120
|
}
|
package/src/models/STCredit.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { column } from '@
|
|
2
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
|
|
5
5
|
export class STCredit extends QueryableModel {
|
|
@@ -7,7 +7,9 @@ export class STCredit extends QueryableModel {
|
|
|
7
7
|
|
|
8
8
|
// Columns
|
|
9
9
|
@column({
|
|
10
|
-
primary: true,
|
|
10
|
+
primary: true,
|
|
11
|
+
type: 'string',
|
|
12
|
+
beforeSave(value) {
|
|
11
13
|
return value ?? uuidv4();
|
|
12
14
|
},
|
|
13
15
|
})
|
|
@@ -26,7 +28,8 @@ export class STCredit extends QueryableModel {
|
|
|
26
28
|
allowTransactions = false;
|
|
27
29
|
|
|
28
30
|
@column({
|
|
29
|
-
type: 'datetime',
|
|
31
|
+
type: 'datetime',
|
|
32
|
+
beforeSave(old?: any) {
|
|
30
33
|
if (old !== undefined) {
|
|
31
34
|
return old;
|
|
32
35
|
}
|
|
@@ -41,7 +44,8 @@ export class STCredit extends QueryableModel {
|
|
|
41
44
|
expireAt: Date | null = null;
|
|
42
45
|
|
|
43
46
|
@column({
|
|
44
|
-
type: 'datetime',
|
|
47
|
+
type: 'datetime',
|
|
48
|
+
beforeSave() {
|
|
45
49
|
const date = new Date();
|
|
46
50
|
date.setMilliseconds(0);
|
|
47
51
|
return date;
|
|
@@ -51,12 +55,17 @@ export class STCredit extends QueryableModel {
|
|
|
51
55
|
updatedAt: Date;
|
|
52
56
|
|
|
53
57
|
static async getForOrganization(organizationId: string) {
|
|
54
|
-
return await STCredit.where(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
return await STCredit.where(
|
|
59
|
+
{ organizationId },
|
|
60
|
+
{
|
|
61
|
+
sort: [
|
|
62
|
+
{
|
|
63
|
+
column: 'createdAt',
|
|
64
|
+
direction: 'DESC',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
);
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
static async getBalance(organizationId: string) {
|
package/src/models/STInvoice.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { column } from '@
|
|
2
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
3
3
|
import { STInvoiceMeta } from '@stamhoofd/structures';
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
5
|
|
|
@@ -13,7 +13,9 @@ export class STInvoice extends QueryableModel {
|
|
|
13
13
|
|
|
14
14
|
// Columns
|
|
15
15
|
@column({
|
|
16
|
-
primary: true,
|
|
16
|
+
primary: true,
|
|
17
|
+
type: 'string',
|
|
18
|
+
beforeSave(value) {
|
|
17
19
|
return value ?? uuidv4();
|
|
18
20
|
},
|
|
19
21
|
})
|
|
@@ -65,7 +67,8 @@ export class STInvoice extends QueryableModel {
|
|
|
65
67
|
negativeInvoiceId: string | null = null;
|
|
66
68
|
|
|
67
69
|
@column({
|
|
68
|
-
type: 'datetime',
|
|
70
|
+
type: 'datetime',
|
|
71
|
+
beforeSave(old?: any) {
|
|
69
72
|
if (old !== undefined) {
|
|
70
73
|
return old;
|
|
71
74
|
}
|
|
@@ -77,7 +80,8 @@ export class STInvoice extends QueryableModel {
|
|
|
77
80
|
createdAt: Date;
|
|
78
81
|
|
|
79
82
|
@column({
|
|
80
|
-
type: 'datetime',
|
|
83
|
+
type: 'datetime',
|
|
84
|
+
beforeSave() {
|
|
81
85
|
const date = new Date();
|
|
82
86
|
date.setMilliseconds(0);
|
|
83
87
|
return date;
|
package/src/models/STPackage.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { column } from '@
|
|
2
|
-
import { SimpleError } from '@
|
|
3
|
-
import {
|
|
1
|
+
import { column } from '@stamhoofd/node-database';
|
|
2
|
+
import { SimpleError } from '@stamhoofd/common-errors';
|
|
3
|
+
import {
|
|
4
|
+
STPackageMeta,
|
|
5
|
+
STPackageStatus,
|
|
6
|
+
STPackageStatusServiceFee,
|
|
7
|
+
STPackageType,
|
|
8
|
+
STPricingType,
|
|
9
|
+
} from '@stamhoofd/structures';
|
|
4
10
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
11
|
|
|
6
|
-
import { QueryableModel } from '@stamhoofd/sql';
|
|
12
|
+
import { QueryableModel } from '@stamhoofd/node-sql';
|
|
7
13
|
|
|
8
14
|
export class STPackage extends QueryableModel {
|
|
9
15
|
static table = 'stamhoofd_packages';
|
|
10
16
|
|
|
11
17
|
// Columns
|
|
12
18
|
@column({
|
|
13
|
-
primary: true,
|
|
19
|
+
primary: true,
|
|
20
|
+
type: 'string',
|
|
21
|
+
beforeSave(value) {
|
|
14
22
|
return value ?? uuidv4();
|
|
15
23
|
},
|
|
16
24
|
})
|
|
@@ -26,7 +34,8 @@ export class STPackage extends QueryableModel {
|
|
|
26
34
|
meta: STPackageMeta;
|
|
27
35
|
|
|
28
36
|
@column({
|
|
29
|
-
type: 'datetime',
|
|
37
|
+
type: 'datetime',
|
|
38
|
+
beforeSave(old?: any) {
|
|
30
39
|
if (old !== undefined) {
|
|
31
40
|
return old;
|
|
32
41
|
}
|
|
@@ -38,7 +47,8 @@ export class STPackage extends QueryableModel {
|
|
|
38
47
|
createdAt: Date;
|
|
39
48
|
|
|
40
49
|
@column({
|
|
41
|
-
type: 'datetime',
|
|
50
|
+
type: 'datetime',
|
|
51
|
+
beforeSave() {
|
|
42
52
|
const date = new Date();
|
|
43
53
|
date.setMilliseconds(0);
|
|
44
54
|
return date;
|
|
@@ -112,7 +122,7 @@ export class STPackage extends QueryableModel {
|
|
|
112
122
|
throw new SimpleError({
|
|
113
123
|
code: 'not_allowed',
|
|
114
124
|
message: 'Not allowed',
|
|
115
|
-
human: $t(
|
|
125
|
+
human: $t('%x7'),
|
|
116
126
|
});
|
|
117
127
|
}
|
|
118
128
|
|
|
@@ -124,7 +134,9 @@ export class STPackage extends QueryableModel {
|
|
|
124
134
|
pack.validAt = null;
|
|
125
135
|
pack.organizationId = this.organizationId;
|
|
126
136
|
|
|
127
|
-
pack.meta.startDate = new Date(
|
|
137
|
+
pack.meta.startDate = new Date(
|
|
138
|
+
Math.max(new Date().getTime(), this.validUntil?.getTime() ?? 0),
|
|
139
|
+
);
|
|
128
140
|
pack.meta.paidAmount = 0;
|
|
129
141
|
pack.meta.paidPrice = 0;
|
|
130
142
|
pack.meta.firstFailedPayment = null;
|
|
@@ -186,11 +198,12 @@ export class STPackage extends QueryableModel {
|
|
|
186
198
|
minimum: this.meta.serviceFeeMinimum,
|
|
187
199
|
maximum: this.meta.serviceFeeMaximum,
|
|
188
200
|
startDate: this.meta.startDate,
|
|
189
|
-
endDate:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
201
|
+
endDate:
|
|
202
|
+
this.validUntil && this.removeAt
|
|
203
|
+
? new Date(Math.min(this.validUntil.getTime(), this.removeAt.getTime()))
|
|
204
|
+
: (this.validUntil ?? this.removeAt),
|
|
205
|
+
}),
|
|
206
|
+
],
|
|
194
207
|
});
|
|
195
208
|
}
|
|
196
209
|
}
|