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.

875 B
Raw Blame
import { z } from "zod/v4";
import { type ChatEvents, toChatEvents } from "./chat-events";
import type { ChatWebhookIntegration } from "./chat-webhook-provider";

export type ChatWebhookFormValues = {
  webhookUrl: string;
  channelName: string;
  events: ChatEvents;
};

export const chatWebhookFormSchema = z.object({
  webhookUrl: z.string(),
  channelName: z.string(),
  events: z.object({
    taskCreated: z.boolean(),
    taskStatusChanged: z.boolean(),
    taskPriorityChanged: z.boolean(),
    taskTitleChanged: z.boolean(),
    taskDescriptionChanged: z.boolean(),
    taskCommentCreated: z.boolean(),
  }),
});

export function toChatWebhookFormValues(
  integration: ChatWebhookIntegration | undefined,
): ChatWebhookFormValues {
  return {
    webhookUrl: "",
    channelName: integration?.channelName ?? "",
    events: toChatEvents(integration?.events),
  };
}