fix tenant account unbind flow
Desktop Client Build / Resolve Build Metadata (push) Successful in 28s
Frontend CI / Frontend (push) Successful in 2m53s
Backend CI / Backend (push) Successful in 16m10s
Desktop Client Build / Build Desktop Client (push) Successful in 23m44s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 50s

This commit is contained in:
2026-06-19 09:29:04 +08:00
parent 0cddb47055
commit 97ae601cfd
20 changed files with 561 additions and 15 deletions
@@ -723,6 +723,90 @@ func (q *Queries) TombstoneDesktopAccount(ctx context.Context, arg TombstoneDesk
return i, err
}
const tombstoneDesktopAccountForActor = `-- name: TombstoneDesktopAccountForActor :one
UPDATE platform_accounts
SET deleted_at = now(),
delete_requested_at = COALESCE(delete_requested_at, now()),
sync_version = sync_version + 1,
updated_at = now()
WHERE desktop_id = $1
AND workspace_id = $2
AND user_id = $3
AND deleted_at IS NULL
RETURNING
desktop_id,
tenant_id,
workspace_id,
user_id,
client_id,
platform_id,
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
sync_version,
deleted_at,
delete_requested_at,
created_at,
updated_at
`
type TombstoneDesktopAccountForActorParams struct {
DesktopID pgtype.UUID `json:"desktop_id"`
WorkspaceID int64 `json:"workspace_id"`
UserID int64 `json:"user_id"`
}
type TombstoneDesktopAccountForActorRow struct {
DesktopID pgtype.UUID `json:"desktop_id"`
TenantID int64 `json:"tenant_id"`
WorkspaceID int64 `json:"workspace_id"`
UserID int64 `json:"user_id"`
ClientID pgtype.UUID `json:"client_id"`
PlatformID string `json:"platform_id"`
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
SyncVersion int64 `json:"sync_version"`
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
DeleteRequestedAt pgtype.Timestamptz `json:"delete_requested_at"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
func (q *Queries) TombstoneDesktopAccountForActor(ctx context.Context, arg TombstoneDesktopAccountForActorParams) (TombstoneDesktopAccountForActorRow, error) {
row := q.db.QueryRow(ctx, tombstoneDesktopAccountForActor, arg.DesktopID, arg.WorkspaceID, arg.UserID)
var i TombstoneDesktopAccountForActorRow
err := row.Scan(
&i.DesktopID,
&i.TenantID,
&i.WorkspaceID,
&i.UserID,
&i.ClientID,
&i.PlatformID,
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
&i.SyncVersion,
&i.DeletedAt,
&i.DeleteRequestedAt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const upsertDesktopAccount = `-- name: UpsertDesktopAccount :one
INSERT INTO platform_accounts (
desktop_id,