@stamhoofd/backend 2.129.3 → 2.131.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.
Files changed (43) hide show
  1. package/package.json +17 -17
  2. package/src/crons/index.ts +1 -0
  3. package/src/crons/stripe-payout-reports.ts +69 -0
  4. package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.test.ts +324 -2
  5. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +74 -3
  6. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +6 -0
  7. package/src/endpoints/global/members/throwIfDrasticMemberDetailsChange.test.ts +96 -0
  8. package/src/endpoints/global/members/throwIfDrasticMemberDetailsChange.ts +58 -0
  9. package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +68 -0
  10. package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +7 -1
  11. package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +44 -3
  12. package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +31 -2
  13. package/src/endpoints/organization/dashboard/receivable-balances/ChargeReceivableBalancesEndpoint.ts +1 -1
  14. package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +61 -2
  15. package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +14 -1
  16. package/src/endpoints/organization/dashboard/stripe/GetStripePayoutsExportStatusEndpoint.ts +32 -0
  17. package/src/endpoints/organization/dashboard/stripe/StripePayoutsExportEndpoint.test.ts +103 -0
  18. package/src/endpoints/organization/dashboard/stripe/StripePayoutsExportEndpoint.ts +125 -0
  19. package/src/helpers/AuthenticatedStructures.ts +5 -7
  20. package/src/helpers/MembershipCharger.ts +26 -1
  21. package/src/helpers/RegistrationPeriodRelationBackfiller.test.ts +111 -0
  22. package/src/helpers/RegistrationPeriodRelationBackfiller.ts +125 -0
  23. package/src/helpers/StripePayoutExportData.ts +195 -0
  24. package/src/helpers/StripePayoutExportExcel.ts +280 -0
  25. package/src/helpers/StripePayoutReporter.test.ts +419 -0
  26. package/src/helpers/StripePayoutReporter.ts +585 -0
  27. package/src/migrations/1783342463-remove-platform-uitpas-flag.ts +25 -0
  28. package/src/seeds/1783400000-backfill-registration-period-relation.ts +13 -0
  29. package/src/seeds/1783502528-fix-registrations-with-platform-period.ts +426 -0
  30. package/src/services/uitpas/UitpasService.ts +1 -1
  31. package/src/services/uitpas/cancelTicketSales.ts +1 -1
  32. package/src/services/uitpas/checkPermissionsFor.ts +1 -1
  33. package/src/services/uitpas/getSocialTariffForEvent.ts +1 -1
  34. package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +1 -1
  35. package/src/services/uitpas/registerTicketSales.ts +1 -1
  36. package/src/services/uitpas/searchUitpasEvents.ts +22 -18
  37. package/src/services/uitpas/searchUitpasOrganizers.ts +2 -1
  38. package/src/sql-filters/organizations.ts +52 -0
  39. package/tests/e2e/documents.test.ts +3 -1
  40. package/tests/vitest.global.setup.ts +1 -1
  41. package/tests/vitest.setup.ts +4 -2
  42. package/vitest.config.js +10 -0
  43. /package/src/seeds/{1780665427-schedule-stock-updates.ts → 1783515690-schedule-stock-updates.ts} +0 -0
@@ -60,11 +60,13 @@ beforeAll(async () => {
60
60
  // cascade below, so it has to be cleared first
61
61
  await Database.delete('DELETE FROM `invoiced_balance_items`');
62
62
  await Database.delete('DELETE FROM `invoices`');
63
+
64
+ // payments restrict deleting stripe accounts (which cascade from organizations), and a payment
65
+ // can reference a stripe account of a different organization, so payments have to be cleared first
66
+ await Database.delete('DELETE FROM `payments`');
63
67
  await Database.update('UPDATE registration_periods set organizationId = null, customName = ? where organizationId is not null', ['delete']);
64
68
  await Database.delete('DELETE FROM `organizations`');
65
69
  await Database.delete('DELETE FROM `registration_periods` where customName = ?', ['delete']);
66
-
67
- await Database.delete('DELETE FROM `payments`');
68
70
  await Database.delete('OPTIMIZE TABLE organizations;'); // fix breaking of indexes due to deletes (mysql bug?)
69
71
 
70
72
  // Use random file keys in tests
package/vitest.config.js CHANGED
@@ -16,5 +16,15 @@ export default defineConfig({
16
16
  exclude: ['src/migrations/**'],
17
17
  reporter: ['text', 'html', 'lcov'],
18
18
  },
19
+ server: {
20
+ deps: {
21
+ inline: [
22
+ // @simonbackx/simple-endpoints and @simonbackx/simple-database do async imports inside the package
23
+ // we need to make sure Vitest also adds .ts support there
24
+ '@simonbackx/simple-endpoints',
25
+ '@simonbackx/simple-database',
26
+ ],
27
+ },
28
+ },
19
29
  },
20
30
  });