feat(invitations): accept invitations with C4 consent and contact grants; share the E0 quota across holdings

This commit is contained in:
shira committed 2026-10-09 18:03:35 +03:00
1 parent a5990d3fc6
commit 676b3c6e24
59 files changed
+4926 -194

No files matched your search

+7 -5
View File
@@ -367,9 +367,8 @@ func TestNeedCreationResultMigrationRollbackPreflight(t *testing.T) {
t.Fatalf("apply migrations to rollback test database: %v", err)
}
// The preflight belongs to the migration that created the replay table, so
// the migrations added after it are rolled back first. The database holds
// no data yet, which keeps their own guarded rollbacks out of this test.
rollBackAboveMigration(ctx, t, migrator, needCreationResultMigrationVersion)
// the migrations added after it are rolled back first. The one organization
// below has its own holding, so their guarded rollbacks do not refuse.
pool := newPoolFor(ctx, t, databaseURL)
now := time.Now().UTC().Truncate(time.Microsecond)
fixture := organizationFixture{
@@ -377,6 +376,11 @@ func TestNeedCreationResultMigrationRollbackPreflight(t *testing.T) {
identity: identityFixture{ctx: ctx, pool: pool, store: postgresadapter.NewIdentityStore(pool), now: now},
transactor: postgresadapter.NewTransactor(pool), now: now,
}
// The organization is created while the latest schema is in place: its
// creation needs the holdings table, which the rollback below removes.
owner := fixture.employer(t, "need-migration-owner@example.test")
organization := fixture.create(t, owner, fixture.completeProfile(t, "ООО Миграция needs"), now)
rollBackAboveMigration(ctx, t, migrator, needCreationResultMigrationVersion)
scope := []byte(strings.Repeat("s", outbound.IdempotencyDigestSize))
fingerprint := []byte(strings.Repeat("f", outbound.IdempotencyDigestSize))
if _, err := pool.Exec(ctx, `
@@ -400,8 +404,6 @@ func TestNeedCreationResultMigrationRollbackPreflight(t *testing.T) {
now.Add(-outbound.IdempotencyRetention-time.Second), now.Add(-time.Second), scope); err != nil {
t.Fatalf("expire idempotency replay before checking historical bounds: %v", err)
}
owner := fixture.employer(t, "need-migration-owner@example.test")
organization := fixture.create(t, owner, fixture.completeProfile(t, "ООО Миграция needs"), now)
need := newIntegrationNeed(t, organization.ID(), "Bounded rollback fixture", now.Add(time.Minute))
encoded, err := json.Marshal(need.Snapshot())
if err != nil {