* feat(api): add webhook CRUD API router and tests Add tRPC router for managing workspace webhooks: - list, create, update, delete endpoints (admin role required) - test endpoint to send a synthetic payload to a webhook URL - URL validation, event subscription filtering - Unit tests for all router procedures - Integration tests with PGlite test database - Add vitest config and test infrastructure for API package Depends on #391 (DB schema & repository). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(api): use assertPermission instead of assertUserInWorkspace Replace assertUserInWorkspace with assertPermission("workspace:manage") per project conventions. The permissions system is the preferred authorization approach for new code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(api): use @kan/db alias instead of relative imports in tests Replace relative path imports (../../db/src/...) with the @kan/db alias configured in vitest.config.ts for consistency and robustness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(api): use webhookUrlSchema in router input validation Cherry-pick router-related changes from b2cc9ac: - Use extracted webhookUrlSchema zod validator in create/update input schemas for consistent SSRF checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(api): replace dynamic import with static import for webhook utility Add packages/api/src/utils/webhook.ts with sendWebhookToUrl, createCardWebhookPayload, and webhookUrlSchema. Replace the dynamic import() in the test endpoint with a static import at the top of the file for better tree-shaking, type-checking, and readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(api): align sendWebhooksForWorkspace tests with merged PR #392 The merged delivery utility uses client-side event filtering (getActiveByWorkspaceId takes 2 args, not 3). Update test assertions to match the actual implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Henry <30578846+hjball@users.noreply.github.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { attachmentRouter } from "./routers/attachment";
|
|
import { boardRouter } from "./routers/board";
|
|
import { cardRouter } from "./routers/card";
|
|
import { checklistRouter } from "./routers/checklist";
|
|
import { feedbackRouter } from "./routers/feedback";
|
|
import { healthRouter } from "./routers/health";
|
|
import { importRouter } from "./routers/import";
|
|
import { integrationRouter } from "./routers/integration";
|
|
import { labelRouter } from "./routers/label";
|
|
import { listRouter } from "./routers/list";
|
|
import { memberRouter } from "./routers/member";
|
|
import { permissionRouter } from "./routers/permission";
|
|
import { userRouter } from "./routers/user";
|
|
import { webhookRouter } from "./routers/webhook";
|
|
import { workspaceRouter } from "./routers/workspace";
|
|
import { createTRPCRouter } from "./trpc";
|
|
|
|
export const appRouter = createTRPCRouter({
|
|
attachment: attachmentRouter,
|
|
board: boardRouter,
|
|
card: cardRouter,
|
|
checklist: checklistRouter,
|
|
feedback: feedbackRouter,
|
|
health: healthRouter,
|
|
label: labelRouter,
|
|
list: listRouter,
|
|
member: memberRouter,
|
|
import: importRouter,
|
|
permission: permissionRouter,
|
|
user: userRouter,
|
|
webhook: webhookRouter,
|
|
workspace: workspaceRouter,
|
|
integration: integrationRouter,
|
|
});
|
|
|
|
export type AppRouter = typeof appRouter;
|