Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

696 B
Raw Blame
import { Effect, Schema } from "effect";
import { KaneoApi } from "./kaneo-api.js";

export type BulkOperation =
  | "updateStatus"
  | "updatePriority"
  | "updateAssignee"
  | "delete"
  | "addLabel"
  | "removeLabel"
  | "updateDueDate";

export const BulkResult = Schema.Struct({
  success: Schema.Boolean,
  updatedCount: Schema.Number,
});
export type BulkResult = typeof BulkResult.Type;

export const bulkUpdateTasks = Effect.fnUntraced(function* (body: {
  readonly taskIds: ReadonlyArray<string>;
  readonly operation: BulkOperation;
  readonly value?: string | null;
}) {
  const api = yield* KaneoApi;
  return yield* api.request("PATCH", "/api/task/bulk", BulkResult, { body });
});