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
@@ -139,3 +139,18 @@ func (h *DesktopAccountHandler) RequestDelete(c *gin.Context) {
}
response.Success(c, data)
}
func (h *DesktopAccountHandler) TenantDelete(c *gin.Context) {
desktopID, err := uuid.Parse(c.Param("id"))
if err != nil {
response.Error(c, response.ErrBadRequest(40082, "invalid_desktop_account_id", "desktop account id must be a uuid"))
return
}
data, err := h.svc.DeleteForActor(c.Request.Context(), auth.MustActor(c.Request.Context()), desktopID)
if err != nil {
response.Error(c, err)
return
}
response.Success(c, data)
}
@@ -193,6 +193,15 @@ func (h *DesktopDispatchHandler) replayQueuedPublishTasks(ctx context.Context, c
AND dt.kind = 'publish'
AND dt.status = 'queued'
AND dt.attempts < 3
AND EXISTS (
SELECT 1
FROM platform_accounts AS pa
WHERE pa.desktop_id = dt.target_account_id
AND pa.workspace_id = dt.workspace_id
AND pa.client_id = dt.target_client_id
AND pa.deleted_at IS NULL
AND pa.delete_requested_at IS NULL
)
AND NOT EXISTS (
SELECT 1
FROM desktop_publish_jobs AS j
@@ -89,6 +89,7 @@ func RegisterRoutes(app *bootstrap.App) {
))
tenantProtected.GET("/accounts", desktopAccountHandler.TenantList)
tenantProtected.POST("/accounts/:id/request-delete", desktopAccountHandler.RequestDelete)
tenantProtected.DELETE("/accounts/:id", desktopAccountHandler.TenantDelete)
tenantProtected.POST("/tasks/:id/reconcile", desktopTaskHandler.Reconcile)
tenantProtected.POST("/tasks/:id/cancel", desktopTaskHandler.TenantCancel)
tenantProtected.GET("/publish-tasks", desktopTaskHandler.TenantListPublish)
@@ -29,6 +29,7 @@ func TestProtectedRoutes_RequireAuth(t *testing.T) {
{http.MethodPost, "/api/desktop/clients/register"},
{http.MethodGet, "/api/tenant/accounts"},
{http.MethodPost, "/api/tenant/accounts/:id/request-delete"},
{http.MethodDelete, "/api/tenant/accounts/:id"},
{http.MethodPost, "/api/tenant/tasks/:id/reconcile"},
{http.MethodPost, "/api/tenant/tasks/:id/cancel"},
{http.MethodGet, "/api/tenant/publish-tasks"},