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

@@ -229,7 +229,8 @@ INSERT INTO organizations (
verification_changed_at,
version,
created_at,
updated_at
updated_at,
holding_id
) VALUES (
$1,
$2,
@@ -244,7 +245,8 @@ INSERT INTO organizations (
$11,
$12,
$13,
$14
$14,
$15
)
`
@@ -263,12 +265,13 @@ type InsertOrganizationParams struct {
Version int64
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
HoldingID pgtype.UUID
}
// Stores a new organization with the verification level that the domain
// gave it. The deferred constraint organizations_owner_required fails the
// transaction at commit unless an active owner membership was inserted in
// it too.
// gave it and the holding of its creator. The deferred constraint
// organizations_owner_required fails the transaction at commit unless an
// active owner membership was inserted in it too.
func (q *Queries) InsertOrganization(ctx context.Context, arg InsertOrganizationParams) error {
_, err := q.db.Exec(ctx, insertOrganization,
arg.ID,
@@ -285,6 +288,7 @@ func (q *Queries) InsertOrganization(ctx context.Context, arg InsertOrganization
arg.Version,
arg.CreatedAt,
arg.UpdatedAt,
arg.HoldingID,
)
return err
}
@@ -549,6 +553,23 @@ type UpdateOrganizationProfileParams struct {
ManagerRoles []string
}
type UpdateOrganizationProfileRow struct {
ID pgtype.UUID
Name string
Description pgtype.Text
Sphere pgtype.Text
ContactWebsite pgtype.Text
ContactEmail pgtype.Text
ContactPhone pgtype.Text
ContactTelegram pgtype.Text
VerificationLevel string
VerificationBasis string
VerificationChangedAt pgtype.Timestamptz
Version int64
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
// Changes the profile of an organization over the version the caller read
// and advances the version in the same statement. It names no verification
// column, so a profile update cannot move the trust level. The change
@@ -562,7 +583,7 @@ type UpdateOrganizationProfileParams struct {
// follow it). No row returns for a stale version, an account that is no
// active manager, or an unknown organization; the adapter reads the
// membership to tell them apart.
func (q *Queries) UpdateOrganizationProfile(ctx context.Context, arg UpdateOrganizationProfileParams) (Organization, error) {
func (q *Queries) UpdateOrganizationProfile(ctx context.Context, arg UpdateOrganizationProfileParams) (UpdateOrganizationProfileRow, error) {
row := q.db.QueryRow(ctx, updateOrganizationProfile,
arg.Name,
arg.Description,
@@ -577,7 +598,7 @@ func (q *Queries) UpdateOrganizationProfile(ctx context.Context, arg UpdateOrgan
arg.ActorID,
arg.ManagerRoles,
)
var i Organization
var i UpdateOrganizationProfileRow
err := row.Scan(
&i.ID,
&i.Name,