improved a lot of things
This commit is contained in:
@@ -172,3 +172,18 @@ BEGIN
|
||||
END LOOP;
|
||||
END;
|
||||
$$;
|
||||
|
||||
-- ── RPC: get_diffs_by_status ──────────────────────────────────────────────────
|
||||
-- Used by getDiffsByStatus() in queries.ts.
|
||||
-- Joins intent_diffs → artboards to scope results by workspace_id.
|
||||
|
||||
create or replace function get_diffs_by_status(p_workspace_id uuid, p_status text)
|
||||
returns setof intent_diffs
|
||||
language sql stable as $$
|
||||
select d.*
|
||||
from intent_diffs d
|
||||
join artboards a on a.id = d.artboard_id
|
||||
where a.workspace_id = p_workspace_id
|
||||
and d.status = p_status
|
||||
order by d.created_at desc;
|
||||
$$;
|
||||
|
||||
@@ -267,6 +267,14 @@ export async function removeTeamMember(
|
||||
if (error) throw new Error(error.message);
|
||||
}
|
||||
|
||||
export async function deleteWorkspace(db: DbClient, id: string): Promise<void> {
|
||||
const { error } = await (db
|
||||
.from('workspaces')
|
||||
.delete()
|
||||
.eq('id', id) as unknown as Promise<{ data: unknown; error: DbError | null }>);
|
||||
if (error) throw new Error(error.message);
|
||||
}
|
||||
|
||||
export async function updateWorkspace(
|
||||
db: DbClient,
|
||||
id: string,
|
||||
|
||||
Reference in New Issue
Block a user