Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
feat(action-center): edit, add and delete an action's tasks (#814)
Gökhan Geyikf8598f5528ab
diff --git a/supabase/migrations/00083_action_task_editing.sql b/supabase/migrations/00083_action_task_editing.sqlnew file mode 100644index 000000000..8ea255b8d--- /dev/null+++ b/supabase/migrations/00083_action_task_editing.sql@@ -0,0 +1,81 @@+-- Action tasks become editable: custom text, add, delete, and a status that+-- says "we decided not to" rather than "we are stuck".+--+-- 1. `title`. A task's text lived only in code: `task_key` indexes the+-- per-kind templates the generator writes, and the drawer renders+-- t(actionCenter.actionTasks.<task_key>). There was nowhere to put a+-- sentence a person typed. A generated task keeps its key and no title; a+-- task someone adds or renames carries a title, and the reader prefers the+-- title when it is there. `task_key` becomes nullable, with a check that a+-- row always has one of the two to render from.+--+-- `unique (action_id, task_key)` stays as it is. Postgres treats nulls as+-- distinct in a unique constraint, so an action can hold any number of+-- user-added tasks while still refusing a duplicate template.+--+-- 2. `blocked` becomes `canceled`. Blocked means "still to do, held up";+-- canceled means "not going to happen". Progress reads completed/total, so+-- a blocked task holds an action below 100% forever while it waits for+-- something that may never arrive. Canceled leaves the denominator instead+-- — that part is in the read path, not here. One row carries the old value+-- today, which is the cheapest this rename will ever be.+--+-- 3. action_tasks reopens to members for insert and delete, scoped to their+-- own organization — the same predicate the select and update policies+-- already use. 00082 closed these outright after finding them open to+-- every signed-in user; this is the narrow, intentional version of that+-- permission, and it exists because the Tasks tab now adds and removes+-- tasks. actions and action_events stay closed.++alter table public.action_tasks+ add column if not exists title text;++comment on column public.action_tasks.title is+ 'User-supplied task text. Null for generated tasks, which render from task_key.';++alter table public.action_tasks+ alter column task_key drop not null;++comment on column public.action_tasks.task_key is+ 'Key into the code-side task templates. Null for user-added tasks, which carry a title.';++alter table public.action_tasks+ drop constraint if exists action_tasks_renderable_check;++alter table public.action_tasks+ add constraint action_tasks_renderable_check+ check (task_key is not null or btrim(coalesce(title, '')) <> '');++-- Drop before the update, not after: the old constraint still forbids+-- 'canceled' while it stands, so rewriting the rows under it fails.+alter table public.action_tasks+ drop constraint if exists action_tasks_status_check;++update public.action_tasks set status = 'canceled' where status = 'blocked';++alter table public.action_tasks+ add constraint action_tasks_status_check+ check (status in ('todo', 'in_progress', 'completed', 'canceled'));++drop policy if exists "action_tasks: no client insert" on public.action_tasks;+drop policy if exists "action_tasks: no client delete" on public.action_tasks;++create policy "action_tasks: member insert" on public.action_tasks+ for insert with check (+ action_id in (+ select a.id from public.actions a+ join public.brands b on b.id = a.brand_id+ join public.profiles p on p.organization_id = b.organization_id+ where p.id = auth.uid()+ )+ );++create policy "action_tasks: member delete" on public.action_tasks+ for delete using (+ action_id in (+ select a.id from public.actions a+ join public.brands b on b.id = a.brand_id+ join public.profiles p on p.organization_id = b.organization_id+ where p.id = auth.uid()+ )+ );diff --git a/supabase/schema.sql b/supabase/schema.sqlindex 2e3c4fe31..64f7f0e7c 100644--- a/supabase/schema.sql+++ b/supabase/schema.sql@@ -10175,3 +10175,88 @@ create policy "action_tasks: no client delete" on public.action_taskscreate policy "action_events: no client delete" on public.action_eventsfor delete using (false);+-- ─────────────────────────────────────────────────────────────────────────+-- migrations/00083_action_task_editing.sql+-- ─────────────────────────────────────────────────────────────────────────+-- Action tasks become editable: custom text, add, delete, and a status that+-- says "we decided not to" rather than "we are stuck".+--+-- 1. `title`. A task's text lived only in code: `task_key` indexes the+-- per-kind templates the generator writes, and the drawer renders+-- t(actionCenter.actionTasks.<task_key>). There was nowhere to put a+-- sentence a person typed. A generated task keeps its key and no title; a+-- task someone adds or renames carries a title, and the reader prefers the+-- title when it is there. `task_key` becomes nullable, with a check that a+-- row always has one of the two to render from.+--+-- `unique (action_id, task_key)` stays as it is. Postgres treats nulls as+-- distinct in a unique constraint, so an action can hold any number of+-- user-added tasks while still refusing a duplicate template.+--+-- 2. `blocked` becomes `canceled`. Blocked means "still to do, held up";+-- canceled means "not going to happen". Progress reads completed/total, so+-- a blocked task holds an action below 100% forever while it waits for+-- something that may never arrive. Canceled leaves the denominator instead+-- — that part is in the read path, not here. One row carries the old value+-- today, which is the cheapest this rename will ever be.+--+-- 3. action_tasks reopens to members for insert and delete, scoped to their+-- own organization — the same predicate the select and update policies+-- already use. 00082 closed these outright after finding them open to+-- every signed-in user; this is the narrow, intentional version of that+-- permission, and it exists because the Tasks tab now adds and removes+-- tasks. actions and action_events stay closed.++alter table public.action_tasks+ add column if not exists title text;++comment on column public.action_tasks.title is+ 'User-supplied task text. Null for generated tasks, which render from task_key.';++alter table public.action_tasks+ alter column task_key drop not null;++comment on column public.action_tasks.task_key is+ 'Key into the code-side task templates. Null for user-added tasks, which carry a title.';++alter table public.action_tasks+ drop constraint if exists action_tasks_renderable_check;++alter table public.action_tasks+ add constraint action_tasks_renderable_check+ check (task_key is not null or btrim(coalesce(title, '')) <> '');++-- Drop before the update, not after: the old constraint still forbids+-- 'canceled' while it stands, so rewriting the rows under it fails.+alter table public.action_tasks+ drop constraint if exists action_tasks_status_check;++update public.action_tasks set status = 'canceled' where status = 'blocked';++alter table public.action_tasks+ add constraint action_tasks_status_check+ check (status in ('todo', 'in_progress', 'completed', 'canceled'));++drop policy if exists "action_tasks: no client insert" on public.action_tasks;+drop policy if exists "action_tasks: no client delete" on public.action_tasks;++create policy "action_tasks: member insert" on public.action_tasks+ for insert with check (+ action_id in (+ select a.id from public.actions a+ join public.brands b on b.id = a.brand_id+ join public.profiles p on p.organization_id = b.organization_id+ where p.id = auth.uid()+ )+ );++create policy "action_tasks: member delete" on public.action_tasks+ for delete using (+ action_id in (+ select a.id from public.actions a+ join public.brands b on b.id = a.brand_id+ join public.profiles p on p.organization_id = b.organization_id+ where p.id = auth.uid()+ )+ );+diff --git a/web/messages/en.json b/web/messages/en.jsonindex 1d9563f1f..892b07d64 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -476,7 +476,14 @@"assigned": "Assignee changed","due_date_set": "Due date updated","task_status": "Task updated"- }+ },+ "taskText": "Task text",+ "renameTask": "Rename task",+ "deleteTask": "Delete task",+ "addTask": "Add task",+ "addTaskPlaceholder": "What needs doing?",+ "addTaskConfirm": "Add",+ "addTaskCancel": "Cancel"}},"actionTexts": {@@ -529,7 +536,7 @@"todo": "To Do","in_progress": "In Progress","completed": "Completed",- "blocked": "Blocked"+ "canceled": "Canceled"}},"agent": {diff --git a/web/src/components/action-center/action-drawer.tsx b/web/src/components/action-center/action-drawer.tsxindex 9140d8872..cdc44a049 100644--- a/web/src/components/action-center/action-drawer.tsx+++ b/web/src/components/action-center/action-drawer.tsx@@ -4,7 +4,9 @@ import { useCallback, useEffect, useState } from 'react';import { useTranslations } from 'next-intl';import { useRouter } from '@/i18n/navigation';import { toast } from 'sonner';+import { Plus, Trash2 } from 'lucide-react';import { Badge } from '@/components/ui/badge';+import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import {@@ -24,13 +26,17 @@ import {} from '@/components/ui/sheet';import { Skeleton } from '@/components/ui/skeleton';import {+ addTask,assignAction,+ deleteTask,getActionDetail,setActionDueDate,updateActionStatus,updateTaskStatus,+ updateTaskTitle,type ActionDetail,type ActionItem,+ type ActionTask,} from '@/lib/actions/action-center';import type { TeamMember } from '@/lib/actions/team';import {@@ -39,7 +45,7 @@ import {type ActionStatus,type TaskStatus,} from '@/lib/action-center/registry';-import { actionContextTags, actionTexts, memberLabel } from '@/lib/action-center/display';+import { actionContextTags, actionTexts, memberLabel, taskText } from '@/lib/action-center/display';import { signalTexts } from '@/lib/signals/display';import { isKpiKey } from '@/lib/kpis/registry';import { ImpactDots, SignalStatusBadge } from './signal-table';@@ -251,53 +257,38 @@ export function ActionDrawer({</>) : tab === 'tasks' ? (<section>+ {/* Canceled tasks leave the denominator — the work was called+ off, so it should not hold the action short of done. */}<p className="text-xs text-muted-foreground">{t('drawer.tasksProgress', {completed: detail.tasks.filter((task) => task.status === 'completed').length,- total: detail.tasks.length,+ total: detail.tasks.filter((task) => task.status !== 'canceled').length,})}</p><div className="mt-3 space-y-2">{detail.tasks.map((task) => (- <div+ <TaskRowkey={task.id}- className="flex items-center justify-between gap-3 rounded-md border px-3 py-2"- >- <p- className={cn(- 'min-w-0 flex-1 text-sm',- task.status === 'completed' && 'text-muted-foreground line-through',- )}- >- {task.position}. {tTasks(task.taskKey)}- </p>- <Select- value={task.status}- onValueChange={(value) =>- void mutate(() =>- updateTaskStatus(brandId, action.id, task.id, value as TaskStatus),- )- }- disabled={isBusy}- items={TASK_STATUSES.map((status) => ({- value: status,- label: tTaskStatus(status),- }))}- >- <SelectTrigger className="h-7 w-32 text-xs">- <SelectValue />- </SelectTrigger>- <SelectContent>- {TASK_STATUSES.map((status) => (- <SelectItem key={status} value={status}>- {tTaskStatus(status)}- </SelectItem>- ))}- </SelectContent>- </Select>- </div>+ task={task}+ disabled={isBusy}+ text={taskText(task, tTasks)}+ statusLabel={tTaskStatus}+ t={t}+ onStatusChange={(status) =>+ void mutate(() => updateTaskStatus(brandId, action.id, task.id, status))+ }+ onRename={(title) =>+ void mutate(() => updateTaskTitle(brandId, action.id, task.id, title))+ }+ onDelete={() => void mutate(() => deleteTask(brandId, action.id, task.id))}+ />))}</div>+ <AddTaskForm+ disabled={isBusy}+ t={t}+ onAdd={(title) => void mutate(() => addTask(brandId, action.id, title))}+ /></section>) : tab === 'signals' ? (<section className="space-y-2">@@ -425,3 +416,189 @@ export function ActionDrawer({</Sheet>);}++type TaskTranslator = (key: string, values?: Record<string, string | number>) => string;++/**+ * One task: its text, its status, and the two edits a person can make to it.+ *+ * Renaming happens in place rather than in a dialog — the text is one line and+ * a dialog for one line is a detour. Escape abandons the edit, Enter or blur+ * commits it, and an empty value is treated as abandonment rather than as a+ * request to blank the task out, which the database would refuse anyway.+ */+function TaskRow({+ task,+ text,+ disabled,+ statusLabel,+ t,+ onStatusChange,+ onRename,+ onDelete,+}: {+ task: ActionTask;+ text: string;+ disabled: boolean;+ statusLabel: TaskTranslator;+ t: TaskTranslator;+ onStatusChange: (status: TaskStatus) => void;+ onRename: (title: string) => void;+ onDelete: () => void;+}) {+ const [draft, setDraft] = useState<string | null>(null);+ const isEditing = draft !== null;++ const commit = () => {+ const next = (draft ?? '').trim();+ if (next && next !== text) onRename(next);+ setDraft(null);+ };++ return (+ <div className="flex items-center justify-between gap-2 rounded-md border px-3 py-2">+ {isEditing ? (+ <Input+ autoFocus+ value={draft}+ maxLength={200}+ disabled={disabled}+ aria-label={t('drawer.taskText')}+ className="h-7 min-w-0 flex-1 text-sm"+ onChange={(e) => setDraft(e.target.value)}+ onBlur={commit}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ commit();+ } else if (e.key === 'Escape') {+ e.preventDefault();+ setDraft(null);+ }+ }}+ />+ ) : (+ <button+ type="button"+ disabled={disabled}+ onClick={() => setDraft(text)}+ title={t('drawer.renameTask')}+ className={cn(+ 'min-w-0 flex-1 truncate rounded px-1 py-0.5 text-left text-sm hover:bg-muted/60',+ (task.status === 'completed' || task.status === 'canceled') &&+ 'text-muted-foreground line-through',+ )}+ >+ {task.position}. {text}+ </button>+ )}+ <Select+ value={task.status}+ onValueChange={(value) => onStatusChange(value as TaskStatus)}+ disabled={disabled || isEditing}+ items={TASK_STATUSES.map((status) => ({ value: status, label: statusLabel(status) }))}+ >+ <SelectTrigger className="h-7 w-32 shrink-0 text-xs">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {TASK_STATUSES.map((status) => (+ <SelectItem key={status} value={status}>+ {statusLabel(status)}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ disabled={disabled || isEditing}+ onClick={onDelete}+ aria-label={t('drawer.deleteTask')}+ className="h-7 w-7 shrink-0 text-muted-foreground hover:text-destructive"+ >+ <Trash2 className="h-3.5 w-3.5" />+ </Button>+ </div>+ );+}++/** Append a task of the user's own wording. Collapsed to a single button until+ * it is needed, so the common case — reading the generated list — stays quiet. */+function AddTaskForm({+ disabled,+ t,+ onAdd,+}: {+ disabled: boolean;+ t: TaskTranslator;+ onAdd: (title: string) => void;+}) {+ const [draft, setDraft] = useState<string | null>(null);++ if (draft === null) {+ return (+ <Button+ type="button"+ variant="outline"+ size="sm"+ disabled={disabled}+ onClick={() => setDraft('')}+ className="mt-3 h-8 w-full text-xs"+ >+ <Plus className="mr-1.5 h-3.5 w-3.5" />+ {t('drawer.addTask')}+ </Button>+ );+ }++ const submit = () => {+ const title = draft.trim();+ if (title) onAdd(title);+ setDraft(null);+ };++ return (+ <div className="mt-3 flex items-center gap-2">+ <Input+ autoFocus+ value={draft}+ maxLength={200}+ disabled={disabled}+ placeholder={t('drawer.addTaskPlaceholder')}+ aria-label={t('drawer.addTask')}+ className="h-8 min-w-0 flex-1 text-sm"+ onChange={(e) => setDraft(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === 'Enter') {+ e.preventDefault();+ submit();+ } else if (e.key === 'Escape') {+ e.preventDefault();+ setDraft(null);+ }+ }}+ />+ <Button+ type="button"+ size="sm"+ disabled={disabled || draft.trim() === ''}+ onClick={submit}+ className="h-8 shrink-0 text-xs"+ >+ {t('drawer.addTaskConfirm')}+ </Button>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ disabled={disabled}+ onClick={() => setDraft(null)}+ className="h-8 shrink-0 text-xs"+ >+ {t('drawer.addTaskCancel')}+ </Button>+ </div>+ );+}diff --git a/web/src/lib/action-center/display.ts b/web/src/lib/action-center/display.tsindex da7da58dd..41d7c0eb5 100644--- a/web/src/lib/action-center/display.ts+++ b/web/src/lib/action-center/display.ts@@ -111,3 +111,19 @@ export function comparePriority(a: ActionItem, b: ActionItem): number {export function memberLabel(member: { fullName: string | null; email: string }): string {return member.fullName?.trim() || member.email;}++/**+ * A task's text: what the user wrote, or the template it was generated from.+ *+ * Generated tasks carry a `task_key` into actionCenter.actionTasks and no+ * title. Adding or renaming a task writes a title, which wins from then on —+ * the key stays behind so which template a task grew from is still answerable.+ */+export function taskText(+ task: { taskKey: string | null; title: string | null },+ t: Translator,+): string {+ const title = task.title?.trim();+ if (title) return title;+ return task.taskKey ? t(task.taskKey) : '';+}diff --git a/web/src/lib/action-center/registry.ts b/web/src/lib/action-center/registry.tsindex 24ebc501a..27d16c81a 100644--- a/web/src/lib/action-center/registry.ts+++ b/web/src/lib/action-center/registry.ts@@ -25,7 +25,7 @@ export type ActionKind =| 'fix_low_scores'| 'close_competitor_gap';-export type TaskStatus = 'todo' | 'in_progress' | 'completed' | 'blocked';+export type TaskStatus = 'todo' | 'in_progress' | 'completed' | 'canceled';export const ACTION_CATEGORIES: readonly ActionCategory[] = ['growth',@@ -46,7 +46,12 @@ export const ACTION_STATUSES: readonly ActionStatus[] = [export const ACTION_IMPACTS: readonly ActionImpact[] = ['high', 'medium', 'low'];-export const TASK_STATUSES: readonly TaskStatus[] = ['todo', 'in_progress', 'completed', 'blocked'];+export const TASK_STATUSES: readonly TaskStatus[] = [+ 'todo',+ 'in_progress',+ 'completed',+ 'canceled',+];export interface ActionKindMeta {kind: ActionKind;diff --git a/web/src/lib/actions/action-center.ts b/web/src/lib/actions/action-center.tsindex cab5b7675..538d196d9 100644--- a/web/src/lib/actions/action-center.ts+++ b/web/src/lib/actions/action-center.ts@@ -93,8 +93,11 @@ export async function getActions(brandId: string): Promise<ActionItem[]> {if (signalsRes.error) throw new Error(signalsRes.error.message);if (profilesRes.error) throw new Error(profilesRes.error.message);+ // Canceled tasks leave the denominator: the work was called off, so it must+ // not hold the action below 100% forever the way a blocked one used to.const taskTotals = new Map<string, { total: number; completed: number }>();for (const task of tasksRes.data ?? []) {+ if (task.status === 'canceled') continue;const acc = taskTotals.get(task.action_id) ?? { total: 0, completed: 0 };acc.total += 1;if (task.status === 'completed') acc.completed += 1;@@ -138,7 +141,10 @@ export async function getActions(brandId: string): Promise<ActionItem[]> {export interface ActionTask {id: string;position: number;- taskKey: string;+ /** Template key for a generated task; null once someone renames or adds one. */+ taskKey: string | null;+ /** User-supplied text. Takes precedence over the template when present. */+ title: string | null;status: TaskStatus;}@@ -171,7 +177,7 @@ export async function getActionDetail(brandId: string, actionId: string): Promisconst [tasksRes, signalsRes, eventsRes, kpisRes] = await Promise.all([supabase.from('action_tasks')- .select('id, position, task_key, status')+ .select('id, position, task_key, title, status').eq('action_id', actionId).order('position'),supabase@@ -201,6 +207,7 @@ export async function getActionDetail(brandId: string, actionId: string): Promisid: task.id,position: task.position,taskKey: task.task_key,+ title: task.title,status: task.status as TaskStatus,})),signals: mapSignalRows((signalsRes.data ?? []) as SignalRow[]),@@ -232,6 +239,20 @@ async function logEvent(.insert({ action_id: actionId, event, data, actor_id: auth.user?.id ?? null });}+/** Bump the action's updated stamp so the table's Updated column tracks real+ * work, not just nightly refreshes. */+async function touchAction(+ supabase: Awaited<ReturnType<typeof createClient>>,+ brandId: string,+ actionId: string,+) {+ await supabase+ .from('actions')+ .update({ updated_at: new Date().toISOString() })+ .eq('brand_id', brandId)+ .eq('id', actionId);+}+export async function updateActionStatus(brandId: string,actionId: string,@@ -295,11 +316,113 @@ export async function updateTaskStatus(.eq('id', taskId);if (error) throw new Error(error.message);await logEvent(supabase, actionId, 'task_status', { taskId, to: status });- // Bump the action's updated stamp so the table's Updated column tracks- // real work, not just nightly refreshes.- await supabase- .from('actions')- .update({ updated_at: new Date().toISOString() })- .eq('brand_id', brandId)- .eq('id', actionId);+ await touchAction(supabase, brandId, actionId);+}++/** Longest a task's text may be. Long enough for a real instruction, short+ * enough to stay one line in the drawer. */+const TASK_TITLE_MAX = 200;++function cleanTaskTitle(raw: string): string {+ const title = raw.trim().slice(0, TASK_TITLE_MAX);+ if (!title) throw new Error('Task text is required');+ return title;+}++/**+ * Append a task of the user's own wording.+ *+ * `task_key` stays null — these have no template — so the renderable check+ * carries the title, and `unique (action_id, task_key)` does not apply to+ * them (Postgres treats nulls as distinct), which is what lets an action hold+ * as many as someone types.+ */+export async function addTask(brandId: string, actionId: string, title: string): Promise<void> {+ const supabase = await createClient();+ const text = cleanTaskTitle(title);++ // Append after the current last, reading through the caller's own RLS so a+ // position can only ever be computed from tasks they can see.+ const { data: last, error: lastErr } = await supabase+ .from('action_tasks')+ .select('position')+ .eq('action_id', actionId)+ .order('position', { ascending: false })+ .limit(1)+ .maybeSingle();+ if (lastErr) throw new Error(lastErr.message);++ const { error } = await supabase.from('action_tasks').insert({+ action_id: actionId,+ position: (last?.position ?? 0) + 1,+ title: text,+ status: 'todo',+ });+ if (error) throw new Error(error.message);++ await logEvent(supabase, actionId, 'task_added', { title: text });+ await touchAction(supabase, brandId, actionId);+}++/**+ * Rename a task. A generated task keeps its `task_key` for provenance — which+ * template it grew from stays answerable — and the title simply wins at render+ * time.+ */+export async function updateTaskTitle(+ brandId: string,+ actionId: string,+ taskId: string,+ title: string,+): Promise<void> {+ const supabase = await createClient();+ const text = cleanTaskTitle(title);++ const { error } = await supabase+ .from('action_tasks')+ .update({ title: text, updated_at: new Date().toISOString() })+ .eq('action_id', actionId)+ .eq('id', taskId);+ if (error) throw new Error(error.message);++ await logEvent(supabase, actionId, 'task_renamed', { taskId, title: text });+ await touchAction(supabase, brandId, actionId);+}++/**+ * Remove a task and close the gap in the numbering.+ *+ * The drawer shows `position` to the reader ("1. 2. 3."), so leaving a hole+ * would show one. Renumbering runs row by row rather than in one statement+ * because PostgREST has no bulk conditional update; a handful of tasks per+ * action makes that a non-issue.+ */+export async function deleteTask(brandId: string, actionId: string, taskId: string): Promise<void> {+ const supabase = await createClient();++ const { error } = await supabase+ .from('action_tasks')+ .delete()+ .eq('action_id', actionId)+ .eq('id', taskId);+ if (error) throw new Error(error.message);++ const { data: remaining, error: readErr } = await supabase+ .from('action_tasks')+ .select('id, position')+ .eq('action_id', actionId)+ .order('position');+ if (readErr) throw new Error(readErr.message);++ await Promise.all(+ (remaining ?? [])+ .map((task, index) => ({ task, wanted: index + 1 }))+ .filter(({ task, wanted }) => task.position !== wanted)+ .map(({ task, wanted }) =>+ supabase.from('action_tasks').update({ position: wanted }).eq('id', task.id),+ ),+ );++ await logEvent(supabase, actionId, 'task_deleted', { taskId });+ await touchAction(supabase, brandId, actionId);}diff --git a/web/src/types/supabase.ts b/web/src/types/supabase.tsindex 25c2ec4c3..e9c46f51f 100644--- a/web/src/types/supabase.ts+++ b/web/src/types/supabase.ts@@ -63,7 +63,8 @@ export type Database = {id: stringposition: numberstatus: string- task_key: string+ task_key: string | null+ title: string | nullupdated_at: string}Insert: {@@ -72,7 +73,8 @@ export type Database = {id?: stringposition: numberstatus?: string- task_key: string+ task_key?: string | null+ title?: string | nullupdated_at?: string}Update: {@@ -81,7 +83,8 @@ export type Database = {id?: stringposition?: numberstatus?: string- task_key?: string+ task_key?: string | null+ title?: string | nullupdated_at?: string}Relationships: [