[PROTOBUS] Move deleteTasksWithIds to protobus (#3282)
* deleteTasksWithIDs protobus migration * Moved deleteTasksWithIds to dedicated message type * Created common StringArrayRequest * Delete webview-ui/.vite-port
This commit is contained in:
1 parent
a953f6e768
commit
cb7234f967
10 files changed
+129
-14
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { Controller } from ".."
|
||||
import { Empty, StringArrayRequest } from "../../../shared/proto/common"
|
||||
import { TaskMethodHandler } from "./index"
|
||||
|
||||
/**
|
||||
* Deletes tasks with the specified IDs
|
||||
* @param controller The controller instance
|
||||
* @param request The request containing an array of task IDs to delete
|
||||
* @returns Empty response
|
||||
* @throws Error if operation fails
|
||||
*/
|
||||
export const deleteTasksWithIds: TaskMethodHandler = async (
|
||||
controller: Controller,
|
||||
request: StringArrayRequest,
|
||||
): Promise<Empty> => {
|
||||
if (!request.value || request.value.length === 0) {
|
||||
throw new Error("Missing task IDs")
|
||||
}
|
||||
|
||||
await Promise.all(request.value.map((value) => controller.deleteTaskWithId(value)))
|
||||
|
||||
return Empty.create()
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
import { registerMethod } from "./index"
|
||||
import { cancelTask } from "./cancelTask"
|
||||
import { clearTask } from "./clearTask"
|
||||
import { deleteTasksWithIds } from "./deleteTasksWithIds"
|
||||
import { newTask } from "./newTask"
|
||||
|
||||
// Register all task service methods
|
||||
@@ -12,5 +13,6 @@ export function registerAllMethods(): void {
|
||||
// Register each method with the registry
|
||||
registerMethod("cancelTask", cancelTask)
|
||||
registerMethod("clearTask", clearTask)
|
||||
registerMethod("deleteTasksWithIds", deleteTasksWithIds)
|
||||
registerMethod("newTask", newTask)
|
||||
}
|
||||
Reference in new issue
Block a user