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

+15 -5
View File
@@ -41,11 +41,13 @@ var (
organizationTables = []pgx.Identifier{
{"candidate_card_access_events"},
{"invitation_creation_results"}, {"invitation_send_results"}, {"invitation_decline_results"}, {"invitation_declines"},
{"invitation_events"}, {"invitation_terms_versions"}, {"invitations"},
{"invitation_events"}, {"invitation_terms_versions"}, {"invitation_accept_results"}, {"contact_grants"}, {"invitations"},
{"organization_need_versions"}, {"organization_needs"},
{"organization_need_creation_results"},
{"company_invitation_quota_usage"}, {"company_card_view_quota_usage"},
organizationCreationResultsTable, membershipsTable, organizationRepresentativesTable, organizationsTable,
// holdings reference users and are referenced by organizations.
{"holdings"},
}
candidateQuestionnaireTables = []pgx.Identifier{
{"candidate_questionnaire_specializations"}, {"candidate_questionnaires"},
@@ -260,10 +262,16 @@ func TestOrganizationsAndMemberships(t *testing.T) {
reset(t)
member := fixture.employer(t, "member@example.com")
insertOrganization := func(ctx context.Context, tx pgx.Tx, id uuid.UUID) error {
if _, err := tx.Exec(ctx, `
INSERT INTO holdings (id, founder_account_id, created_at) VALUES ($1, $2, $3)
ON CONFLICT (founder_account_id) DO NOTHING`, uuid.New(), member.ID, now); err != nil {
return err
}
_, err := tx.Exec(ctx, `
INSERT INTO organizations (
id, name, verification_level, verification_basis, verification_changed_at, version, created_at, updated_at
) VALUES ($1, 'ООО Без владельца', 'e0', 'confirmed_email', $2, 1, $2, $2)`, id, now)
id, name, verification_level, verification_basis, verification_changed_at, version, created_at, updated_at, holding_id
) VALUES ($1, 'ООО Без владельца', 'e0', 'confirmed_email', $2, 1, $2, $2,
(SELECT id FROM holdings WHERE founder_account_id = $3))`, id, now, member.ID)
return err
}
insertMember := func(ctx context.Context, tx pgx.Tx, organizationID uuid.UUID, role, state string) error {
@@ -692,10 +700,12 @@ func TestOrganizationsAndMemberships(t *testing.T) {
user := fixture.employer(t, "owner@example.com")
organization := fixture.create(t, user, fixture.completeProfile(t, "ООО Пример"), now)
insertOrganization := func(name, verificationLevel, basis string, version int) error {
// The holding of the owner exists, so only the checked columns can fail.
_, err := pool.Exec(ctx, `
INSERT INTO organizations (
id, name, verification_level, verification_basis, verification_changed_at, version, created_at, updated_at
) VALUES ($1, $2, $3, $4, $5, $6, $5, $5)`, uuid.New(), name, verificationLevel, basis, now, version)
id, name, verification_level, verification_basis, verification_changed_at, version, created_at, updated_at, holding_id
) VALUES ($1, $2, $3, $4, $5, $6, $5, $5,
(SELECT id FROM holdings WHERE founder_account_id = $7))`, uuid.New(), name, verificationLevel, basis, now, version, user.ID)
return err
}
for _, test := range []struct {