feat(desktop): implement workspace foundation + desktop-client skeleton
Plan 0 (workspaces): add workspaces + workspace_memberships schema, extend JWT/Actor/claims with primary_workspace_id, seed default workspace per tenant, thread workspace_id through tenant monitoring quota. Plan A (desktop skeleton): new Electron app (apps/desktop-client) with main/ preload/renderer, shared Vue component package (packages/ui-shared), and server surface — desktop client registration + token rotation + heartbeat, SSE task event stream, desktop accounts/tasks/content handlers, publish job endpoint, and supporting repositories, services, sqlc queries, and migrations. Hard cutover per plan: remove browser-extension monitoring callback endpoints, stub legacy media API in admin-web, and delete monitoring_callback_handler.go.
This commit is contained in:
@@ -785,11 +785,16 @@ func (s *MonitoringCallbackService) isMonitoringInstallationRecentlyOnline(ctx c
|
||||
func (s *MonitoringCallbackService) persistHeartbeatPrimaryInstallationID(ctx context.Context, tenantID, installationID int64) error {
|
||||
if _, err := s.businessPool.Exec(ctx, `
|
||||
INSERT INTO tenant_monitoring_quotas (
|
||||
tenant_id, primary_installation_id
|
||||
tenant_id, workspace_id, primary_installation_id
|
||||
)
|
||||
VALUES (
|
||||
$1,
|
||||
(SELECT id FROM workspaces WHERE tenant_id = $1 AND is_default = TRUE LIMIT 1),
|
||||
$2
|
||||
)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (tenant_id) DO UPDATE
|
||||
SET primary_installation_id = EXCLUDED.primary_installation_id,
|
||||
SET workspace_id = COALESCE(tenant_monitoring_quotas.workspace_id, EXCLUDED.workspace_id),
|
||||
primary_installation_id = EXCLUDED.primary_installation_id,
|
||||
updated_at = NOW()
|
||||
`, tenantID, installationID); err != nil {
|
||||
return response.ErrInternal(50041, "update_failed", "failed to persist primary monitoring installation")
|
||||
|
||||
Reference in New Issue
Block a user