Scope workspace tasks to the bot that has them
A workspace's task now carries the bot that has it there (bot_id with workspace_id), or none while it's shared. A bot reaches its own list and, in its workspaces, its own tasks plus the shared ones; a workspace admin every task there. Bots create workspace tasks for themselves by default, take a shared one by starting it, and hand-overs record the new bot. Removing or deleting a bot makes its workspace tasks shared again. The conversation's Tasks modal shows that bot's tasks in the workspace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -5,8 +5,9 @@ import safeErrorMessage from "@/src/utils/safe-error-message";
|
||||
import type { APIResponseObject, BunextAPIRouteHandler } from "@moduletrace/bunext/types";
|
||||
|
||||
/**
|
||||
* The user's tasks: a bot's own list (`?bot_id=`), a workspace's shared one
|
||||
* (`?workspace_id=`), or every task they reach. `?status=` narrows to one
|
||||
* The user's tasks: a bot's own list (`?bot_id=`), a workspace's
|
||||
* (`?workspace_id=`), one bot's there with the unassigned ones
|
||||
* (`?workspace_id=&bot_id=`), or every task they reach. `?status=` narrows to one
|
||||
* status, `?open=1` to the open ones.
|
||||
*/
|
||||
export const handler: BunextAPIRouteHandler<APIResponseObject<TaskWithNames>> = async ({ req }) => {
|
||||
@@ -32,7 +33,9 @@ export const handler: BunextAPIRouteHandler<APIResponseObject<TaskWithNames>> =
|
||||
payload: await grabTasks({
|
||||
user_id: user.id,
|
||||
only_bot_id: bot_id,
|
||||
with_unassigned: Boolean(bot_id && workspace_id),
|
||||
only_workspace_id: workspace_id,
|
||||
own_list: Boolean(bot_id && !workspace_id),
|
||||
statuses: status ? [status] : undefined,
|
||||
open_only: open,
|
||||
}),
|
||||
|
||||
@@ -11,8 +11,8 @@ import safeErrorMessage from "@/src/utils/safe-error-message";
|
||||
import type { APIResponseObject, BunextAPIRouteHandler } from "@moduletrace/bunext/types";
|
||||
|
||||
/**
|
||||
* Adds a task to a bot's list or a workspace's (`bot_id` or
|
||||
* `workspace_id`), or changes one (`task_id`). Returns the task with its
|
||||
* Adds a task to a bot's list (`bot_id`), a workspace (`workspace_id`,
|
||||
* shared) or a bot in a workspace (both), or changes one (`task_id`). Returns the task with its
|
||||
* notes and files.
|
||||
*/
|
||||
export const handler: BunextAPIRouteHandler<APIResponseObject<TaskDetail>> = async ({ req, body }) => {
|
||||
|
||||
Reference in New Issue
Block a user