feat(platform): add the notification inbox and deterministic match search
This commit is contained in:
1 parent
5edff21d2d
commit
0b11021b16
169 files changed
+17083
-443
No files matched your search
@@ -186,7 +186,6 @@ func (q *Queries) InsertCompanyInvitationQuotaUsage(ctx context.Context, arg Ins
|
||||
}
|
||||
|
||||
const lockCompanyQuotaOrganization = `-- name: LockCompanyQuotaOrganization :one
|
||||
|
||||
SELECT
|
||||
id,
|
||||
verification_level,
|
||||
@@ -204,9 +203,6 @@ type LockCompanyQuotaOrganizationRow struct {
|
||||
VerificationChangedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
// Writers lock the organization first, then invitation/card-view state, and
|
||||
// finally usage rows. The organization lock serializes quota decisions for
|
||||
// the tenant and makes the subsequent count and insert atomic.
|
||||
func (q *Queries) LockCompanyQuotaOrganization(ctx context.Context, organizationID pgtype.UUID) (LockCompanyQuotaOrganizationRow, error) {
|
||||
row := q.db.QueryRow(ctx, lockCompanyQuotaOrganization, organizationID)
|
||||
var i LockCompanyQuotaOrganizationRow
|
||||
@@ -219,6 +215,32 @@ func (q *Queries) LockCompanyQuotaOrganization(ctx context.Context, organization
|
||||
return i, err
|
||||
}
|
||||
|
||||
const lockCompanyQuotaOrganizationFirst = `-- name: LockCompanyQuotaOrganizationFirst :one
|
||||
|
||||
SELECT id
|
||||
FROM organizations
|
||||
WHERE id = $1
|
||||
FOR NO KEY UPDATE
|
||||
`
|
||||
|
||||
// Writers lock the organization first, then invitation/card-view state, and
|
||||
// finally usage rows. The organization lock serializes quota decisions for
|
||||
// the tenant and makes the subsequent count and insert atomic.
|
||||
// Takes the organization lock ahead of every share lock of a reader that will
|
||||
// reserve usage later. FOR NO KEY UPDATE conflicts with itself and with FOR
|
||||
// SHARE, so readers of one organization queue up instead of deadlocking on a
|
||||
// share lock that each then tries to raise, but it does not conflict with the
|
||||
// FOR KEY SHARE that a foreign key takes, such as the hidden-organization
|
||||
// insert of a candidate, which holds the candidate's row and then needs this
|
||||
// one. The reservation itself still takes FOR UPDATE inside the same
|
||||
// transaction.
|
||||
func (q *Queries) LockCompanyQuotaOrganizationFirst(ctx context.Context, organizationID pgtype.UUID) (pgtype.UUID, error) {
|
||||
row := q.db.QueryRow(ctx, lockCompanyQuotaOrganizationFirst, organizationID)
|
||||
var id pgtype.UUID
|
||||
err := row.Scan(&id)
|
||||
return id, err
|
||||
}
|
||||
|
||||
const refreshCompanyCardViewQuotaUsage = `-- name: RefreshCompanyCardViewQuotaUsage :execrows
|
||||
UPDATE company_card_view_quota_usage
|
||||
SET
|
||||
|
||||
Reference in new issue
Block a user