⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
refactor(api): generate the OpenAPI spec from Zod instead of rewriting it
Andrej Acevski5912afe5152e
diff --git a/AGENTS.md b/AGENTS.mdindex 47cee60d4..415bcd4f3 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -31,7 +31,7 @@ This is an operating guide, not a README. These rules are good defaults; explici- The API is the authority for authentication and authorization. Hiding an action in the UI is not an authorization check.- Workspace-scoped operations must use the existing `@kaneo/permissions` vocabulary and API middleware.- Do not expose secrets, credentials, internal fields, or private workspace data through responses, logs, events, WebSockets, or MCP tools.-- Public API behavior must retain accurate Valibot validation and OpenAPI metadata.+- Public API behavior must retain accurate Zod validation and OpenAPI metadata.- Mutations that affect realtime state must consider event publication, WebSocket delivery, and client cache invalidation.- Database changes must work for existing installations, not only empty development databases.- User-facing web copy must use static i18n keys. `i18n/en-US.json` is the source of truth.@@ -40,7 +40,7 @@ This is an operating guide, not a README. These rules are good defaults; expliciBefore calling a behavior change complete, decide which surfaces apply:-- API route, validator, controller, authorization, error behavior, and OpenAPI description.+- API route, validator, controller, authorization, error behavior, and OpenAPI description. Route middleware declared via `createRoute({ middleware })` runs BEFORE the request validators, so middleware must read the raw request rather than `c.req.valid()`.- Typed client, web fetcher, query or mutation hook, cache invalidation, and UI states.- Events, project- or user-scoped WebSockets, and optional Redis fan-out.- Permission definitions, API enforcement, and UI capability checks.@@ -54,7 +54,7 @@ Not every change touches every surface. Make the decision deliberately rather th## Project conventions- Keep API handlers thin and domain behavior in controllers or focused utilities.-- Validate API inputs with Valibot unless an existing integration requires another library. Use `HTTPException` for expected HTTP failures.+- Validate API inputs with Zod through `@hono/zod-openapi`: define routes with `createRoute` and mount them on the `apiRouter()` factory in `apps/api/src/openapi.ts`. Request schemas live in a feature's `schema.ts`, response schemas in its `response.ts` (named with `.openapi("Name")` so they become reusable components). Use `HTTPException` for expected HTTP failures. Valibot remains only for internal, non-HTTP config validation under `plugins/` and `ws/`.- Use `requireWorkspacePermission` rather than duplicating role checks.- Use `publishEvent()` when a mutation drives activity, notifications, integrations, or realtime updates.- Keep web requests in `apps/web/src/fetchers/` and server state in TanStack Query hooks.diff --git a/apps/api/package.json b/apps/api/package.jsonindex 9b5991fe8..d58be8864 100644--- a/apps/api/package.json+++ b/apps/api/package.json@@ -36,7 +36,7 @@"@better-auth/drizzle-adapter": "^1.6.26","@hono/node-server": "^2.1.0","@hono/node-ws": "^1.3.1",- "@hono/standard-validator": "^0.4.0",+ "@hono/zod-openapi": "^1.6.1","@kaneo/email": "workspace:*","@kaneo/permissions": "workspace:*","@modelcontextprotocol/sdk": "^1.30.0",@@ -47,7 +47,6 @@"@paralleldrive/cuid2": "^3.3.0","@sentry/node": "^10.70.0","@sentry/profiling-node": "^10.70.0",- "@valibot/to-json-schema": "^1.7.1","bcryptjs": "^3.0.2","better-auth": "^1.6.26","creem": "^1.6.0",@@ -55,7 +54,6 @@"drizzle-kit": "^0.31.10","drizzle-orm": "^0.45.2","hono": "^4.13.0",- "hono-openapi": "^1.3.1","ioredis": "^6.0.0","octokit": "^5.0.5","pg": "^8.22.0",diff --git a/apps/api/src/activity/index.ts b/apps/api/src/activity/index.tsindex 09b0e20c2..109c5f119 100644--- a/apps/api/src/activity/index.ts+++ b/apps/api/src/activity/index.ts@@ -1,8 +1,10 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import { subscribeToEvent } from "../events";-import { activitySchema } from "../schemas";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import createActivity from "./controllers/create-activity";@@ -10,164 +12,159 @@ import createComment from "./controllers/create-comment";import deleteComment from "./controllers/delete-comment";import getActivities from "./controllers/get-activities";import updateComment from "./controllers/update-comment";+import { activityListSchema, activitySchema } from "./response";+import {+ createActivityBody,+ createCommentBody,+ deleteCommentBody,+ taskIdParam,+ updateCommentBody,+} from "./schema";-const activity = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/:taskId",- describeRoute({- operationId: "getActivities",- tags: ["Activity"],- description: "Get all activities for a specific task",- responses: {- 200: {- description: "List of activities for the task",- content: {- "application/json": { schema: resolver(v.array(activitySchema)) },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),- workspaceAccess.fromTaskId(),- async (c) => {- const { taskId } = c.req.valid("param");- const activities = await getActivities(taskId);- return c.json(activities);- },- )- .post(- "/create",- describeRoute({- operationId: "createActivity",- tags: ["Activity"],- description: "Create a new activity (system-generated event)",- responses: {- 200: {- description: "Activity created successfully",- content: {- "application/json": { schema: resolver(activitySchema) },- },- },- },- }),- validator(- "json",- v.object({- taskId: v.string(),- message: v.nullable(v.string()),- type: v.string(),- eventData: v.optional(v.nullable(v.record(v.string(), v.unknown()))),- }),+const getActivitiesRoute = createRoute({+ method: "get",+ operationId: "getActivities",+ path: "/{taskId}",+ tags: ["Activity"],+ summary: "Get task activity",+ description:+ "Get a task's full activity feed, newest first: comments alongside system events such as status and assignee changes.",+ middleware: [workspaceAccess.fromTaskId()] as const,+ request: { params: taskIdParam },+ responses: {+ 200: jsonResponse("List of activities for the task", activityListSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",),+ 403: errorResponse("No access to the task's workspace"),+ },+});++const createActivityRoute = createRoute({+ method: "post",+ operationId: "createActivity",+ path: "/create",+ tags: ["Activity"],+ summary: "Create activity",+ description:+ "Record a system-generated event on a task. Most events are written by the server itself; this exists for importers and integrations.",+ middleware: [workspaceAccess.fromTaskId(),requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { taskId, message, type, eventData } = c.req.valid("json");- const userId = c.get("userId");- const activity = await createActivity(- taskId,- type,- userId,- message,- eventData,- );- return c.json(activity);+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createActivityBody } },},- )- .post(- "/comment",- describeRoute({- operationId: "createComment",- tags: ["Activity"],- description: "Create a new comment on a task",- responses: {- 200: {- description: "Comment created successfully",- content: {- "application/json": { schema: resolver(activitySchema) },- },- },- },- }),- validator(- "json",- v.object({- taskId: v.string(),- comment: v.string(),- }),+ },+ responses: {+ 200: jsonResponse("The created activity", activitySchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),+ },+});++const createCommentRoute = createRoute({+ method: "post",+ operationId: "createComment",+ path: "/comment",+ tags: ["Activity"],+ summary: "Create comment",+ description:+ "Add a comment to a task. Equivalent to POST /comment/{taskId}, kept for the activity-feed client.",+ middleware: [workspaceAccess.fromTaskId(),requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { taskId, comment } = c.req.valid("json");- const userId = c.get("userId");- const newComment = await createComment(taskId, userId, comment);-- return c.json(newComment);+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createCommentBody } },},- )- .put(- "/comment",- describeRoute({- operationId: "updateComment",- tags: ["Activity"],- description: "Update an existing comment",- responses: {- 200: {- description: "Comment updated successfully",- content: {- "application/json": { schema: resolver(activitySchema) },- },- },- },- }),- validator(- "json",- v.object({- activityId: v.string(),- comment: v.string(),- }),+ },+ responses: {+ 200: jsonResponse("The created comment", activitySchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),- workspaceAccess.fromActivity("activityId"),- async (c) => {- const { activityId, comment } = c.req.valid("json");- const userId = c.get("userId");- const updatedComment = await updateComment(userId, activityId, comment);- return c.json(updatedComment);+ },+});++const updateCommentRoute = createRoute({+ method: "put",+ operationId: "updateComment",+ path: "/comment",+ tags: ["Activity"],+ summary: "Update comment",+ description: "Edit a comment. Only the comment's author may do this.",+ middleware: [workspaceAccess.fromActivity("activityId")] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: updateCommentBody } },},+ },+ responses: {+ 200: jsonResponse("The updated comment", activitySchema),+ 400: errorResponse("Invalid body, or unknown activity"),+ 403: errorResponse("Not the author, or no access to the workspace"),+ 404: errorResponse("Comment not found"),+ },+});++const deleteCommentRoute = createRoute({+ method: "delete",+ operationId: "deleteComment",+ path: "/comment",+ tags: ["Activity"],+ summary: "Delete comment",+ description: "Delete a comment. Only the comment's author may do this.",+ middleware: [workspaceAccess.fromActivity("activityId")] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: deleteCommentBody } },+ },+ },+ responses: {+ 200: jsonResponse("The deleted comment", activitySchema),+ 400: errorResponse("Invalid body, or unknown activity"),+ 403: errorResponse("Not the author, or no access to the workspace"),+ 404: errorResponse("Comment not found"),+ },+});++const activity = apiRouter()+ .openapi(getActivitiesRoute, async (c) =>+ c.json(await getActivities(c.req.valid("param").taskId), 200),)- .delete(- "/comment",- describeRoute({- operationId: "deleteComment",- tags: ["Activity"],- description: "Delete a comment",- responses: {- 200: {- description: "Comment deleted successfully",- content: {- "application/json": { schema: resolver(activitySchema) },- },- },- },- }),- validator(- "json",- v.object({- activityId: v.string(),- }),+ .openapi(createActivityRoute, async (c) => {+ const { taskId, message, type, eventData } = c.req.valid("json");+ return c.json(+ await createActivity(taskId, type, c.get("userId"), message, eventData),+ 200,+ );+ })+ .openapi(createCommentRoute, async (c) => {+ const { taskId, comment } = c.req.valid("json");+ return c.json(await createComment(taskId, c.get("userId"), comment), 200);+ })+ .openapi(updateCommentRoute, async (c) => {+ const { activityId, comment } = c.req.valid("json");+ return c.json(+ await updateComment(c.get("userId"), activityId, comment),+ 200,+ );+ })+ .openapi(deleteCommentRoute, async (c) =>+ c.json(+ await deleteComment(c.get("userId"), c.req.valid("json").activityId),+ 200,),- workspaceAccess.fromActivity("activityId"),- async (c) => {- const { activityId } = c.req.valid("json");- const userId = c.get("userId");- const deletedComment = await deleteComment(userId, activityId);- return c.json(deletedComment);- },);subscribeToEvent<{diff --git a/apps/api/src/activity/response.ts b/apps/api/src/activity/response.tsnew file mode 100644index 000000000..3b4c35cb0--- /dev/null+++ b/apps/api/src/activity/response.ts@@ -0,0 +1,32 @@+import { responseTimestamp, z } from "../openapi";++const activityTypeDescription =+ "One of: comment, task, create, status_changed, priority_changed, assignee_changed, unassigned, due_date_changed, title_changed, description_changed.";++// The raw activity row. Comments are activities with type `comment` and a+// non-null content, which is why comment mutations return this same shape.+export const activitySchema = z+ .object({+ id: z.string(),+ taskId: z.string(),+ type: z.string().openapi({ description: activityTypeDescription }),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ userId: z.string().nullable(),+ content: z.string().nullable(),+ eventData: z.unknown().openapi({+ description:+ "Type-specific payload, e.g. { oldStatus, newStatus } for status_changed. Null for plain comments.",+ }),+ externalUserName: z.string().nullable().openapi({+ description: "Set when the activity was imported from another tool.",+ }),+ externalUserAvatar: z.string().nullable(),+ externalSource: z.string().nullable().openapi({+ description: "The tool it was imported from, e.g. planka, trello, jira.",+ }),+ externalUrl: z.string().nullable(),+ })+ .openapi("Activity");++export const activityListSchema = z.array(activitySchema);diff --git a/apps/api/src/activity/schema.ts b/apps/api/src/activity/schema.tsnew file mode 100644index 000000000..7b7946ef9--- /dev/null+++ b/apps/api/src/activity/schema.ts@@ -0,0 +1,29 @@+import { z } from "../openapi";++export const taskIdParam = z.object({ taskId: z.string() });++export const createActivityBody = z.object({+ taskId: z.string(),+ message: z.string().nullable().openapi({+ description:+ "Free-text body. Null for events whose meaning is in eventData.",+ }),+ type: z.string().openapi({+ description: "The event kind, e.g. status_changed or assignee_changed.",+ }),+ eventData: z.record(z.string(), z.unknown()).nullable().optional().openapi({+ description: "Type-specific payload stored alongside the event.",+ }),+});++export const createCommentBody = z.object({+ taskId: z.string(),+ comment: z.string(),+});++export const updateCommentBody = z.object({+ activityId: z.string(),+ comment: z.string(),+});++export const deleteCommentBody = z.object({ activityId: z.string() });diff --git a/apps/api/src/auth-openapi.ts b/apps/api/src/auth-openapi.tsnew file mode 100644index 000000000..823775ada--- /dev/null+++ b/apps/api/src/auth-openapi.ts@@ -0,0 +1,1137 @@+import type { OpenAPIHono } from "@hono/zod-openapi";+import { z } from "./openapi";++// Better Auth serves /api/auth/* from its own handler, so these operations have+// no route of ours to hang documentation off. They are registered directly on+// the OpenAPI registry instead.+//+// This file is generated from Better Auth's own generateOpenAPISchema() output+// and then reviewed. Declaring it here replaced a runtime call to that+// generator plus ~200 lines of spec rewriting (operationId/summary/tag+// normalization, ref pruning, and a 3.1-to-3.0 downgrade). Regenerate and diff+// this file when upgrading Better Auth.+export function organizationRoutes(registry: OpenAPIHono["openAPIRegistry"]) {+ registry.registerPath({+ method: "post",+ path: "/auth/organization/accept-invitation",+ tags: ["Organization Management"],+ operationId: "acceptOrganizationInvitation",+ summary: "Accept Organization Invitation",+ description: "Accept an invitation to an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ invitationId: z+ .string()+ .openapi({ description: "The ID of the invitation to accept" }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ invitation: z.record(z.string(), z.unknown()).optional(),+ member: z.record(z.string(), z.unknown()).optional(),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/add-team-member",+ tags: ["Organization Management"],+ operationId: "addOrganizationTeamMember",+ summary: "Add Organization Team Member",+ description: "The newly created member",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ teamId: z.string().openapi({+ description: "The team the user should be a member of.",+ }),+ userId: z.string().openapi({+ description:+ "The user Id which represents the user to be added as a member.",+ }),+ organizationId: z.string().nullable().optional().openapi({+ description:+ "The organization ID which the team falls under. If not provided, it will default to the user's active organization.",+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ id: z.string().openapi({+ description: "Unique identifier of the team member",+ }),+ userId: z+ .string()+ .openapi({ description: "The user ID of the team member" }),+ teamId: z.string().openapi({+ description: "The team ID of the team the team member is in",+ }),+ createdAt: z.string().openapi({+ description: "Timestamp when the team member was created",+ }),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/cancel-invitation",+ tags: ["Organization Management"],+ operationId: "cancelOrganizationInvitation",+ summary: "Cancel Organization Invitation",+ description: "Cancel Organization Invitation",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ invitationId: z+ .string()+ .openapi({ description: "The ID of the invitation to cancel" }),+ }),+ },+ },+ },+ },+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/check-slug",+ tags: ["Organization Management"],+ operationId: "checkOrganizationSlug",+ summary: "Check Organization Slug",+ description: "Check Organization Slug",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ slug: z.string().openapi({+ description: 'The organization slug to check. Eg: "my-org"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/create",+ tags: ["Organization Management"],+ operationId: "createOrganization",+ summary: "Create Organization",+ description: "Create an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ name: z+ .string()+ .openapi({ description: "The name of the organization" }),+ slug: z+ .string()+ .openapi({ description: "The slug of the organization" }),+ userId: z.string().nullable().optional().openapi({+ description:+ 'The user id of the organization creator. If not provided, the current user will be used. Should only be used by admins or when called by the server. server-only. Eg: "user-id"',+ }),+ logo: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: "The logo of the organization" }),+ metadata: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: "The metadata of the organization" }),+ keepCurrentActiveOrganization: z+ .boolean()+ .nullable()+ .optional()+ .openapi({+ description:+ "Whether to keep the current active organization active after creating a new one. Eg: true",+ }),+ description: z.string().nullable().optional(),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": { schema: z.record(z.string(), z.unknown()) },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/create-role",+ tags: ["Organization Management"],+ operationId: "createOrganizationRole",+ summary: "Create Organization Role",+ description: "Create Organization Role",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ organizationId: z.string().nullable().optional(),+ role: z+ .string()+ .openapi({ description: "The name of the role to create" }),+ permission: z.string().openapi({+ description: "The permission to assign to the role",+ }),+ additionalFields: z+ .record(z.string(), z.unknown())+ .nullable()+ .optional(),+ }),+ },+ },+ },+ },+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/create-team",+ tags: ["Organization Management"],+ operationId: "createOrganizationTeam",+ summary: "Create Organization Team",+ description: "Create a new team within an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ name: z.string().openapi({+ description: 'The name of the team. Eg: "my-team"',+ }),+ organizationId: z.string().nullable().optional().openapi({+ description:+ 'The organization ID which the team will be created in. Defaults to the active organization. Eg: "organization-id"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ id: z.string().openapi({+ description: "Unique identifier of the created team",+ }),+ name: z.string().openapi({ description: "Name of the team" }),+ organizationId: z.string().openapi({+ description: "ID of the organization the team belongs to",+ }),+ createdAt: z.string().openapi({+ description: "Timestamp when the team was created",+ }),+ updatedAt: z.string().openapi({+ description: "Timestamp when the team was last updated",+ }),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/delete",+ tags: ["Organization Management"],+ operationId: "deleteOrganization",+ summary: "Delete Organization",+ description: "Delete an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ organizationId: z+ .string()+ .openapi({ description: "The organization id to delete" }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: { "application/json": { schema: z.string() } },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/delete-role",+ tags: ["Organization Management"],+ operationId: "deleteOrganizationRole",+ summary: "Delete Organization Role",+ description: "Delete Organization Role",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/get-active-member",+ tags: ["Organization Management"],+ operationId: "getOrganizationActiveMember",+ summary: "Get Organization Active Member",+ description: "Get the member details of the active organization",+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ id: z.string(),+ userId: z.string(),+ organizationId: z.string(),+ role: z.string(),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/get-active-member-role",+ tags: ["Organization Management"],+ operationId: "getOrganizationActiveMemberRole",+ summary: "Get Organization Active Member Role",+ description: "Get Organization Active Member Role",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/get-full-organization",+ tags: ["Organization Management"],+ operationId: "getOrganizationFullOrganization",+ summary: "Get Organization Full Organization",+ description: "Get the full organization",+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": { schema: z.record(z.string(), z.unknown()) },+ },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/get-invitation",+ tags: ["Organization Management"],+ operationId: "getOrganizationInvitation",+ summary: "Get Organization Invitation",+ description: "Get an invitation by ID",+ request: {+ query: z.object({+ id: z.string(),+ }),+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ id: z.string(),+ email: z.string(),+ role: z.string(),+ organizationId: z.string(),+ inviterId: z.string(),+ status: z.string(),+ expiresAt: z.string(),+ organizationName: z.string(),+ organizationSlug: z.string(),+ inviterEmail: z.string(),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/get-role",+ tags: ["Organization Management"],+ operationId: "getOrganizationRole",+ summary: "Get Organization Role",+ description: "Get Organization Role",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/has-permission",+ tags: ["Organization Management"],+ operationId: "hasOrganizationPermission",+ summary: "Has Organization Permission",+ description: "Check if the user has permission",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ permission: z+ .record(z.string(), z.unknown())+ .optional()+ .openapi({ description: "The permission to check" }),+ permissions: z+ .record(z.string(), z.unknown())+ .openapi({ description: "The permission to check" }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ error: z.string().optional(),+ success: z.boolean(),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/invite-member",+ tags: ["Organization Management"],+ operationId: "inviteOrganizationMember",+ summary: "Invite Organization Member",+ description: "Create an invitation to an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ email: z.string().openapi({+ description: "The email address of the user to invite",+ }),+ role: z.string().openapi({+ description:+ 'The role(s) to assign to the user. It can be `admin`, `member`, owner. Eg: "member"',+ }),+ organizationId: z.string().nullable().optional().openapi({+ description: "The organization ID to invite the user to",+ }),+ resend: z.boolean().nullable().optional().openapi({+ description:+ "Resend the invitation email, if the user is already invited. Eg: true",+ }),+ teamId: z.string(),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ id: z.string(),+ email: z.string(),+ role: z.string(),+ organizationId: z.string(),+ inviterId: z.string(),+ status: z.string(),+ expiresAt: z.string(),+ createdAt: z.string(),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/leave",+ tags: ["Organization Management"],+ operationId: "leaveOrganization",+ summary: "Leave Organization",+ description: "Leave Organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ organizationId: z.string().openapi({+ description:+ 'The organization Id for the member to leave. Eg: "organization-id"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list",+ tags: ["Organization Management"],+ operationId: "listOrganization",+ summary: "List Organization",+ description: "List all organizations",+ responses: {+ 200: {+ description: "Success",+ content: { "application/json": { schema: z.array(z.unknown()) } },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-invitations",+ tags: ["Organization Management"],+ operationId: "listOrganizationInvitations",+ summary: "List Organization Invitations",+ description: "List Organization Invitations",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-members",+ tags: ["Organization Management"],+ operationId: "listOrganizationMembers",+ summary: "List Organization Members",+ description: "List Organization Members",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-roles",+ tags: ["Organization Management"],+ operationId: "listOrganizationRoles",+ summary: "List Organization Roles",+ description: "List Organization Roles",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-team-members",+ tags: ["Organization Management"],+ operationId: "listOrganizationTeamMembers",+ summary: "List Organization Team Members",+ description: "List the members of the given team.",+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.array(+ z.object({+ id: z.string().openapi({+ description: "Unique identifier of the team member",+ }),+ userId: z+ .string()+ .openapi({ description: "The user ID of the team member" }),+ teamId: z.string().openapi({+ description: "The team ID of the team the team member is in",+ }),+ createdAt: z.string().openapi({+ description: "Timestamp when the team member was created",+ }),+ }),+ ),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-teams",+ tags: ["Organization Management"],+ operationId: "listOrganizationTeams",+ summary: "List Organization Teams",+ description: "List all teams in an organization",+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.array(+ z.object({+ id: z+ .string()+ .openapi({ description: "Unique identifier of the team" }),+ name: z.string().openapi({ description: "Name of the team" }),+ organizationId: z.string().openapi({+ description: "ID of the organization the team belongs to",+ }),+ createdAt: z.string().openapi({+ description: "Timestamp when the team was created",+ }),+ updatedAt: z.string().openapi({+ description: "Timestamp when the team was last updated",+ }),+ }),+ ),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-user-invitations",+ tags: ["Organization Management"],+ operationId: "listOrganizationUserInvitations",+ summary: "List Organization User Invitations",+ description: "List all invitations a user has received",+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.array(+ z.object({+ id: z.string(),+ email: z.string(),+ role: z.string(),+ organizationId: z.string(),+ organizationName: z.string(),+ inviterId: z.string().openapi({+ description: "The ID of the user who created the invitation",+ }),+ teamId: z.string().nullable().optional().openapi({+ description:+ "The ID of the team associated with the invitation",+ }),+ status: z.string(),+ expiresAt: z.string(),+ createdAt: z.string(),+ }),+ ),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "get",+ path: "/auth/organization/list-user-teams",+ tags: ["Organization Management"],+ operationId: "listOrganizationUserTeams",+ summary: "List Organization User Teams",+ description: "List all teams that the current user is a part of.",+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.array(z.record(z.string(), z.unknown())),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/reject-invitation",+ tags: ["Organization Management"],+ operationId: "rejectOrganizationInvitation",+ summary: "Reject Organization Invitation",+ description: "Reject an invitation to an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ invitationId: z+ .string()+ .openapi({ description: "The ID of the invitation to reject" }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ invitation: z.record(z.string(), z.unknown()).optional(),+ member: z.record(z.string(), z.unknown()).nullable().optional(),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/remove-member",+ tags: ["Organization Management"],+ operationId: "removeOrganizationMember",+ summary: "Remove Organization Member",+ description: "Remove a member from an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ memberIdOrEmail: z.string().openapi({+ description: "The ID or email of the member to remove",+ }),+ organizationId: z.string().nullable().optional().openapi({+ description:+ 'The ID of the organization to remove the member from. If not provided, the active organization will be used. Eg: "org-id"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ member: z.object({+ id: z.string(),+ userId: z.string(),+ organizationId: z.string(),+ role: z.string(),+ }),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/remove-team",+ tags: ["Organization Management"],+ operationId: "removeOrganizationTeam",+ summary: "Remove Organization Team",+ description: "Remove a team from an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ teamId: z.string().openapi({+ description: 'The team ID of the team to remove. Eg: "team-id"',+ }),+ organizationId: z.string().nullable().optional().openapi({+ description:+ 'The organization ID which the team falls under. If not provided, it will default to the user\'s active organization. Eg: "organization-id"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ message: z.enum(["Team removed successfully."]).openapi({+ description:+ "Confirmation message indicating successful removal",+ }),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/remove-team-member",+ tags: ["Organization Management"],+ operationId: "removeOrganizationTeamMember",+ summary: "Remove Organization Team Member",+ description: "Remove a member from a team",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ teamId: z.string().openapi({+ description: "The team the user should be removed from.",+ }),+ userId: z.string().openapi({+ description: "The user which should be removed from the team.",+ }),+ organizationId: z.string().nullable().optional().openapi({+ description:+ "The organization ID which the team falls under. If not provided, it will default to the user's active organization.",+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ message: z.enum(["Team member removed successfully."]).openapi({+ description:+ "Confirmation message indicating successful removal",+ }),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/set-active",+ tags: ["Organization Management"],+ operationId: "setOrganizationActive",+ summary: "Set Organization Active",+ description: "Set the active organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ organizationId: z.string().nullable().optional(),+ organizationSlug: z.string().nullable().optional().openapi({+ description:+ 'The organization slug to set as active. It can be null to unset the active organization if organizationId is not provided. Eg: "org-slug"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": { schema: z.record(z.string(), z.unknown()) },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/set-active-team",+ tags: ["Organization Management"],+ operationId: "setOrganizationActiveTeam",+ summary: "Set Organization Active Team",+ description: "Set the active team for the current active organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ teamId: z.string().nullable().optional(),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": { schema: z.record(z.string(), z.unknown()) },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/update",+ tags: ["Organization Management"],+ operationId: "updateOrganization",+ summary: "Update Organization",+ description: "Update an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ data: z.object({+ description: z.string().nullable().optional(),+ name: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: "The name of the organization" }),+ slug: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: "The slug of the organization" }),+ logo: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: "The logo of the organization" }),+ metadata: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: "The metadata of the organization" }),+ }),+ organizationId: z+ .string()+ .nullable()+ .optional()+ .openapi({ description: 'The organization ID. Eg: "org-id"' }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": { schema: z.record(z.string(), z.unknown()) },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/update-member-role",+ tags: ["Organization Management"],+ operationId: "updateOrganizationMemberRole",+ summary: "Update Organization Member Role",+ description: "Update the role of a member in an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ role: z.string().openapi({+ description:+ 'The new role to be applied. This can be a string or array of strings representing the roles. Eg: ["admin", "sale"]',+ }),+ memberId: z.string().openapi({+ description:+ 'The member id to apply the role update to. Eg: "member-id"',+ }),+ organizationId: z.string().nullable().optional().openapi({+ description:+ 'An optional organization ID which the member is a part of to apply the role update. If not provided, you must provide session headers to get the active organization. Eg: "organization-id"',+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ member: z.object({+ id: z.string(),+ userId: z.string(),+ organizationId: z.string(),+ role: z.string(),+ }),+ }),+ },+ },+ },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/update-role",+ tags: ["Organization Management"],+ operationId: "updateOrganizationRole",+ summary: "Update Organization Role",+ description: "Update Organization Role",+ responses: {+ 200: { description: "Success" },+ },+ });++ registry.registerPath({+ method: "post",+ path: "/auth/organization/update-team",+ tags: ["Organization Management"],+ operationId: "updateOrganizationTeam",+ summary: "Update Organization Team",+ description: "Update an existing team in an organization",+ request: {+ body: {+ required: true,+ content: {+ "application/json": {+ schema: z.object({+ teamId: z.string().openapi({+ description: 'The ID of the team to be updated. Eg: "team-id"',+ }),+ data: z.object({+ id: z.string().nullable().optional(),+ name: z.string().nullable().optional(),+ organizationId: z.string().nullable().optional(),+ createdAt: z.string().nullable().optional(),+ updatedAt: z.string().nullable().optional(),+ }),+ }),+ },+ },+ },+ },+ responses: {+ 200: {+ description: "Success",+ content: {+ "application/json": {+ schema: z.object({+ id: z.string().openapi({+ description: "Unique identifier of the updated team",+ }),+ name: z+ .string()+ .openapi({ description: "Updated name of the team" }),+ organizationId: z.string().openapi({+ description: "ID of the organization the team belongs to",+ }),+ createdAt: z.string().openapi({+ description: "Timestamp when the team was created",+ }),+ updatedAt: z.string().openapi({+ description: "Timestamp when the team was last updated",+ }),+ }),+ },+ },+ },+ },+ });+}diff --git a/apps/api/src/billing/index.ts b/apps/api/src/billing/index.tsindex 25974afc4..44b33a9a8 100644--- a/apps/api/src/billing/index.ts+++ b/apps/api/src/billing/index.ts@@ -1,11 +1,15 @@import { constructWebhookEvent } from "creem/webhooks.js";import { and, eq, inArray } from "drizzle-orm";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { workspaceUserTable } from "../database/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { validateWorkspaceAccess } from "../utils/validate-workspace-access";import { creemWebhookSecret, isBillingEnabled } from "./config";import createCheckout from "./controllers/create-checkout";@@ -16,11 +20,13 @@ import handleWebhook, {type BillingWebhookEvent,} from "./controllers/handle-webhook";import { createCustomerPortalLink } from "./creem-client";--type Variables = {- userId: string;- userEmail: string;-};+import {+ checkoutSchema,+ portalSchema,+ webhookResultSchema,+ workspaceBillingSchema,+} from "./response";+import { createCheckoutBody, workspaceIdParam } from "./schema";async function requireBillingManager(userId: string, workspaceId: string) {await validateWorkspaceAccess(userId, workspaceId);@@ -43,8 +49,82 @@ async function requireBillingManager(userId: string, workspaceId: string) {}}-const billing = new Hono<{ Variables: Variables }>()- .post("/webhook", async (c) => {+// Excluded from the app-wide auth middleware: authenticity comes from the+// provider's webhook signature instead of a session.+const webhookRoute = createRoute({+ method: "post",+ operationId: "handleBillingWebhook",+ path: "/webhook",+ tags: ["Billing"],+ summary: "Billing webhook",+ description:+ "Receive a Creem subscription event. Authenticated by signature, not by session, and idempotent per event id.",+ security: [],+ responses: {+ 200: jsonResponse("The event was accepted", webhookResultSchema),+ 400: errorResponse("Signature verification failed"),+ 404: errorResponse("Billing is not enabled on this instance"),+ },+});++const getWorkspaceBillingRoute = createRoute({+ method: "get",+ operationId: "getWorkspaceBilling",+ path: "/{workspaceId}",+ tags: ["Billing"],+ summary: "Get workspace billing",+ description:+ "Get the billing state and entitlement for a workspace. When the instance has no billing configured this reports billingEnabled: false and an always-active entitlement.",+ request: { params: workspaceIdParam },+ responses: {+ 200: jsonResponse(+ "Billing state for the workspace",+ workspaceBillingSchema,+ ),+ 403: errorResponse("No access to the workspace"),+ },+});++const createCheckoutRoute = createRoute({+ method: "post",+ operationId: "createBillingCheckout",+ path: "/{workspaceId}/checkout",+ tags: ["Billing"],+ summary: "Create checkout",+ description:+ "Create a Creem checkout session for a workspace plan and return the URL to redirect the browser to. Workspace owners and admins only.",+ request: {+ params: workspaceIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createCheckoutBody } },+ },+ },+ responses: {+ 200: jsonResponse("The checkout session", checkoutSchema),+ 400: errorResponse("Invalid plan or interval"),+ 403: errorResponse("Not a workspace owner or admin"),+ },+});++const createPortalRoute = createRoute({+ method: "post",+ operationId: "createBillingPortalSession",+ path: "/{workspaceId}/portal",+ tags: ["Billing"],+ summary: "Create portal session",+ description:+ "Generate a Creem customer portal link for the workspace subscription. Workspace owners and admins only, and only once a billing customer exists.",+ request: { params: workspaceIdParam },+ responses: {+ 200: jsonResponse("The portal link", portalSchema),+ 400: errorResponse("No billing customer exists for this workspace yet"),+ 403: errorResponse("Not a workspace owner or admin"),+ },+});++const billing = apiRouter<BaseVariables>()+ .openapi(webhookRoute, async (c) => {if (!isBillingEnabled()) {throw new HTTPException(404, { message: "Not found" });}@@ -67,79 +147,43 @@ const billing = new Hono<{ Variables: Variables }>()throw new HTTPException(400, { message: "Invalid signature" });}- const result = await handleWebhook(event);- return c.json(result);+ return c.json(await handleWebhook(event), 200);})- .get(- "/:workspaceId",- describeRoute({- operationId: "getWorkspaceBilling",- tags: ["Billing"],- description:- "Get the billing state and entitlement for a workspace. Returns billingEnabled: false everywhere when billing is not configured.",- }),- validator("param", v.object({ workspaceId: v.string() })),- async (c) => {- const { workspaceId } = c.req.valid("param");- await validateWorkspaceAccess(c.get("userId"), workspaceId);- return c.json(await getWorkspaceBilling(workspaceId));- },- )- .post(- "/:workspaceId/checkout",- describeRoute({- operationId: "createBillingCheckout",- tags: ["Billing"],- description:- "Create a Creem checkout session for a workspace plan. Owner/admin only. Returns the checkout URL to redirect the browser to.",- }),- validator("param", v.object({ workspaceId: v.string() })),- validator(- "json",- v.object({- plan: v.picklist(["personal", "team"]),- interval: v.picklist(["monthly", "annual"]),- }),- ),- async (c) => {- const { workspaceId } = c.req.valid("param");- const { plan, interval } = c.req.valid("json");- await requireBillingManager(c.get("userId"), workspaceId);+ .openapi(getWorkspaceBillingRoute, async (c) => {+ const { workspaceId } = c.req.valid("param");+ await validateWorkspaceAccess(c.get("userId"), workspaceId);+ return c.json(await getWorkspaceBilling(workspaceId), 200);+ })+ .openapi(createCheckoutRoute, async (c) => {+ const { workspaceId } = c.req.valid("param");+ const { plan, interval } = c.req.valid("json");+ await requireBillingManager(c.get("userId"), workspaceId);- const result = await createCheckout({+ return c.json(+ await createCheckout({workspaceId,plan,interval,userEmail: c.get("userEmail") ?? "",- });- return c.json(result);- },- )- .post(- "/:workspaceId/portal",- describeRoute({- operationId: "createBillingPortalSession",- tags: ["Billing"],- description:- "Generate a Creem customer portal link for the workspace subscription. Owner/admin only.",- }),- validator("param", v.object({ workspaceId: v.string() })),- async (c) => {- const { workspaceId } = c.req.valid("param");- await requireBillingManager(c.get("userId"), workspaceId);+ }),+ 200,+ );+ })+ .openapi(createPortalRoute, async (c) => {+ const { workspaceId } = c.req.valid("param");+ await requireBillingManager(c.get("userId"), workspaceId);- const billingRow = await getOrCreateWorkspaceBilling(workspaceId);- if (!billingRow.creemCustomerId) {- throw new HTTPException(400, {- message: "No billing customer exists for this workspace yet",- });- }+ const billingRow = await getOrCreateWorkspaceBilling(workspaceId);+ if (!billingRow.creemCustomerId) {+ throw new HTTPException(400, {+ message: "No billing customer exists for this workspace yet",+ });+ }- const { portalUrl } = await createCustomerPortalLink(- billingRow.creemCustomerId,- );- return c.json({ portalUrl });- },- );+ return c.json(+ await createCustomerPortalLink(billingRow.creemCustomerId),+ 200,+ );+ });export default billing;diff --git a/apps/api/src/billing/response.ts b/apps/api/src/billing/response.tsnew file mode 100644index 000000000..e4e8c61ee--- /dev/null+++ b/apps/api/src/billing/response.ts@@ -0,0 +1,77 @@+import { nullableResponseTimestamp, z } from "../openapi";++export const billingEntitlementSchema = z+ .object({+ active: z.boolean().openapi({+ description: "Whether the workspace currently has paid-tier access.",+ }),+ reason: z+ .enum([+ "billing_disabled",+ "founding_free",+ "subscription",+ "trial",+ "expired",+ ])+ .openapi({+ description:+ "Why access is granted or denied. `billing_disabled` means the instance is not running billing at all, so everything is unlocked.",+ }),+ })+ .openapi("BillingEntitlement");++export const workspaceBillingSchema = z+ .object({+ billingEnabled: z.boolean().openapi({+ description: "False when the instance has no billing configured.",+ }),+ entitlement: billingEntitlementSchema,+ foundingFree: z.boolean(),+ trialEndsAt: nullableResponseTimestamp,+ plan: z+ .string()+ .nullable()+ .openapi({ description: "`personal` or `team`." }),+ billingInterval: z+ .string()+ .nullable()+ .openapi({ description: "`monthly` or `annual`." }),+ status: z+ .string()+ .nullable()+ .openapi({ description: "The provider's subscription status." }),+ seats: z.number(),+ currentPeriodEnd: nullableResponseTimestamp,+ canceledAt: nullableResponseTimestamp,+ hasCustomer: z.boolean().openapi({+ description:+ "Whether a billing customer exists yet. The portal link requires one.",+ }),+ })+ .openapi("WorkspaceBilling");++export const checkoutSchema = z+ .object({+ checkoutUrl: z.string().openapi({+ description: "Redirect the browser here to complete payment.",+ }),+ })+ .openapi("BillingCheckout");++export const portalSchema = z+ .object({+ portalUrl: z.string().openapi({+ description: "A short-lived link to the provider's customer portal.",+ }),+ })+ .openapi("BillingPortal");++export const webhookResultSchema = z+ .object({+ processed: z.boolean(),+ duplicate: z.boolean().openapi({+ description:+ "True when this event id was already applied, so the delivery was a safe no-op.",+ }),+ })+ .openapi("BillingWebhookResult");diff --git a/apps/api/src/billing/schema.ts b/apps/api/src/billing/schema.tsnew file mode 100644index 000000000..43524c0ca--- /dev/null+++ b/apps/api/src/billing/schema.ts@@ -0,0 +1,8 @@+import { z } from "../openapi";++export const workspaceIdParam = z.object({ workspaceId: z.string() });++export const createCheckoutBody = z.object({+ plan: z.enum(["personal", "team"]),+ interval: z.enum(["monthly", "annual"]),+});diff --git a/apps/api/src/column/index.ts b/apps/api/src/column/index.tsindex 6faf1213e..08857f27a 100644--- a/apps/api/src/column/index.ts+++ b/apps/api/src/column/index.ts@@ -1,6 +1,9 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import createColumn from "./controllers/create-column";@@ -8,168 +11,167 @@ import deleteColumn from "./controllers/delete-column";import getColumns from "./controllers/get-columns";import reorderColumns from "./controllers/reorder-columns";import updateColumn from "./controllers/update-column";+import { columnListSchema, columnSchema } from "./response";+import {+ columnParam,+ createColumnBody,+ projectIdParam,+ reorderColumnsBody,+ updateColumnBody,+} from "./schema";-const column = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/:projectId",- describeRoute({- operationId: "getColumns",- tags: ["Columns"],- description: "Get all columns for a project",- responses: {- 200: {- description: "List of columns ordered by position",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const columns = await getColumns(projectId);- return c.json(columns);- },- )- .post(- "/:projectId",- describeRoute({- operationId: "createColumn",- tags: ["Columns"],- description: "Create a new column in a project",- responses: {- 200: {- description: "Column created successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- name: v.string(),- icon: v.optional(v.string()),- color: v.optional(v.string()),- isFinal: v.optional(v.boolean()),- }),+const getColumnsRoute = createRoute({+ method: "get",+ operationId: "getColumns",+ path: "/{projectId}",+ tags: ["Columns"],+ summary: "Get columns",+ description: "Get a project's board columns, ordered by position.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("List of columns ordered by position", columnListSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const createColumnRoute = createRoute({+ method: "post",+ operationId: "createColumn",+ path: "/{projectId}",+ tags: ["Columns"],+ summary: "Create column",+ description:+ "Add a column to the end of a project's board. The slug is derived from the name.",+ middleware: [workspaceAccess.fromProject("projectId"),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const { name, icon, color, isFinal } = c.req.valid("json");- const result = await createColumn({- projectId,- name,- icon,- color,- isFinal,- });- return c.json(result);+ ] as const,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createColumnBody } },},- )- .put(- "/reorder/:projectId",- describeRoute({- operationId: "reorderColumns",- tags: ["Columns"],- description: "Reorder columns in a project",- responses: {- 200: {- description: "Columns reordered successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- columns: v.array(- v.object({- id: v.string(),- position: v.number(),- }),- ),- }),+ },+ responses: {+ 200: jsonResponse("The created column", columnSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",),+ },+});++const reorderColumnsRoute = createRoute({+ method: "put",+ operationId: "reorderColumns",+ path: "/reorder/{projectId}",+ tags: ["Columns"],+ summary: "Reorder columns",+ description:+ "Set new positions for a project's columns and return the whole board in its new order.",+ middleware: [workspaceAccess.fromProject("projectId"),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const { columns } = c.req.valid("json");- const result = await reorderColumns(projectId, columns);- return c.json(result);+ ] as const,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: reorderColumnsBody } },},- )- .put(- "/:id",- describeRoute({- operationId: "updateColumn",- tags: ["Columns"],- description: "Update a column",- responses: {- 200: {- description: "Column updated successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- name: v.optional(v.string()),- icon: v.optional(v.nullable(v.string())),- color: v.optional(v.nullable(v.string())),- isFinal: v.optional(v.boolean()),- }),+ },+ responses: {+ 200: jsonResponse("The reordered columns", columnListSchema),+ 400: errorResponse("A column does not belong to this project"),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",),+ },+});++const updateColumnRoute = createRoute({+ method: "put",+ operationId: "updateColumn",+ path: "/{id}",+ tags: ["Columns"],+ summary: "Update column",+ description:+ "Update a column. Omitted fields are left unchanged; icon and color accept null to clear them.",+ middleware: [workspaceAccess.fromColumn("id"),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const data = c.req.valid("json");- const result = await updateColumn(id, data);- return c.json(result);+ ] as const,+ request: {+ params: columnParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateColumnBody } },},- )- .delete(- "/:id",- describeRoute({- operationId: "deleteColumn",- tags: ["Columns"],- description: "Delete a column",- responses: {- 200: {- description: "Column deleted successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("The updated column", columnSchema),+ 400: errorResponse("Invalid body, or unknown column"),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",+ ),+ },+});++const deleteColumnRoute = createRoute({+ method: "delete",+ operationId: "deleteColumn",+ path: "/{id}",+ tags: ["Columns"],+ summary: "Delete column",+ description:+ "Delete an empty column. A column holding tasks is refused until they are moved or deleted.",+ middleware: [workspaceAccess.fromColumn("id"),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const result = await deleteColumn(id);- return c.json(result);- },+ ] as const,+ request: { params: columnParam },+ responses: {+ 200: jsonResponse("The deleted column", columnSchema),+ 400: errorResponse(+ "Unknown column, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",+ ),+ 409: errorResponse("The column still contains tasks"),+ },+});++const column = apiRouter()+ .openapi(getColumnsRoute, async (c) =>+ c.json(await getColumns(c.req.valid("param").projectId), 200),+ )+ .openapi(createColumnRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const { name, icon, color, isFinal } = c.req.valid("json");+ return c.json(+ await createColumn({ projectId, name, icon, color, isFinal }),+ 200,+ );+ })+ .openapi(reorderColumnsRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const { columns } = c.req.valid("json");+ return c.json(await reorderColumns(projectId, columns), 200);+ })+ .openapi(updateColumnRoute, async (c) =>+ c.json(+ await updateColumn(c.req.valid("param").id, c.req.valid("json")),+ 200,+ ),+ )+ .openapi(deleteColumnRoute, async (c) =>+ c.json(await deleteColumn(c.req.valid("param").id), 200),);export default column;diff --git a/apps/api/src/column/response.ts b/apps/api/src/column/response.tsnew file mode 100644index 000000000..923e77209--- /dev/null+++ b/apps/api/src/column/response.ts@@ -0,0 +1,27 @@+import { responseTimestamp, z } from "../openapi";++export const columnSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ name: z.string(),+ slug: z.string().openapi({+ description:+ "Stable identifier derived from the name; tasks store this as their status.",+ }),+ position: z.number().openapi({+ description:+ "Board order, ascending. Columns are always returned sorted by it.",+ }),+ icon: z.string().nullable(),+ color: z.string().nullable(),+ isFinal: z.boolean().openapi({+ description:+ "Marks the column as a done state, which stops overdue reminders for tasks in it.",+ }),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("Column");++export const columnListSchema = z.array(columnSchema);diff --git a/apps/api/src/column/schema.ts b/apps/api/src/column/schema.tsnew file mode 100644index 000000000..30f32466c--- /dev/null+++ b/apps/api/src/column/schema.ts@@ -0,0 +1,28 @@+import { z } from "../openapi";++export const projectIdParam = z.object({ projectId: z.string() });++export const columnParam = z.object({ id: z.string() });++export const createColumnBody = z.object({+ name: z.string(),+ icon: z.string().optional(),+ color: z.string().optional(),+ isFinal: z.boolean().optional(),+});++// Every field is optional: omitting one leaves it unchanged, and icon and color+// accept null to clear them.+export const updateColumnBody = z.object({+ name: z.string().optional(),+ icon: z.string().nullable().optional(),+ color: z.string().nullable().optional(),+ isFinal: z.boolean().optional(),+});++export const reorderColumnsBody = z.object({+ columns: z.array(z.object({ id: z.string(), position: z.number() })).openapi({+ description:+ "Every column keeps its new position. Columns from another project are rejected.",+ }),+});diff --git a/apps/api/src/comment/index.ts b/apps/api/src/comment/index.tsindex ca917a3e2..d517d5e95 100644--- a/apps/api/src/comment/index.ts+++ b/apps/api/src/comment/index.ts@@ -1,138 +1,144 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";-import { commentSchema } from "../schemas";+import { activitySchema } from "../activity/response";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import createComment from "./controllers/create-comment";import deleteComment from "./controllers/delete-comment";import getComments from "./controllers/get-comments";import updateComment from "./controllers/update-comment";+import { commentListSchema } from "./response";+import {+ commentParam,+ createCommentBody,+ taskIdParam,+ updateCommentBody,+} from "./schema";-const comment = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/:taskId",- describeRoute({- operationId: "getTaskComments",- tags: ["Comments"],- description: "Get all comments for a specific task",- responses: {- 200: {- description: "List of comments for the task",- content: {- "application/json": {- schema: resolver(v.array(commentSchema)),- },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),- workspaceAccess.fromTaskId(),- async (c) => {- const { taskId } = c.req.valid("param");- const comments = await getComments(taskId);- return c.json(comments);- },- )- .post(- "/:taskId",- describeRoute({- operationId: "createTaskComment",- tags: ["Comments"],- description: "Create a new comment on a task",- responses: {- 200: {- description: "Comment created successfully",- content: {- "application/json": { schema: resolver(commentSchema) },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),- validator(- "json",- v.object({- content: v.pipe(v.string(), v.minLength(1)),- externalUserName: v.optional(v.pipe(v.string(), v.maxLength(120))),- externalSource: v.optional(v.picklist(["planka", "trello", "jira"])),- }),+const getTaskCommentsRoute = createRoute({+ method: "get",+ operationId: "getTaskComments",+ path: "/{taskId}",+ tags: ["Comments"],+ summary: "Get task comments",+ description:+ "Get every comment on a task, oldest first, each with its author's name and avatar.",+ middleware: [workspaceAccess.fromTaskId()] as const,+ request: { params: taskIdParam },+ responses: {+ 200: jsonResponse("List of comments for the task", commentListSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",),+ 403: errorResponse("No access to the task's workspace"),+ },+});++const createTaskCommentRoute = createRoute({+ method: "post",+ operationId: "createTaskComment",+ path: "/{taskId}",+ tags: ["Comments"],+ summary: "Create task comment",+ description:+ "Add a comment to a task. Mentions in the content notify the mentioned users, and the assignee is notified too. Returns the stored activity row, which carries no author object -- read the list route for that.",+ middleware: [workspaceAccess.fromTaskId(),requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { taskId } = c.req.valid("param");- const { content, externalUserName, externalSource } = c.req.valid("json");- const userId = c.get("userId");- // Both or neither: a name without a source would render as an- // unattributed impersonation of a real account.- const external =- externalUserName && externalSource- ? { userName: externalUserName, source: externalSource }- : undefined;- const newComment = await createComment(taskId, userId, content, external);- return c.json(newComment);+ ] as const,+ request: {+ params: taskIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createCommentBody } },},- )- .put(- "/:id",- describeRoute({- operationId: "updateTaskComment",- tags: ["Comments"],- description: "Update an existing comment (author only)",- responses: {- 200: {- description: "Comment updated successfully",- content: {- "application/json": { schema: resolver(commentSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({ content: v.pipe(v.string(), v.minLength(1)) }),+ },+ responses: {+ 200: jsonResponse("The created comment", activitySchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),+ },+});++const updateTaskCommentRoute = createRoute({+ method: "put",+ operationId: "updateTaskComment",+ path: "/{id}",+ tags: ["Comments"],+ summary: "Update task comment",+ description: "Edit a comment. Only the comment's author may do this.",+ middleware: [workspaceAccess.fromComment(),requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const { content } = c.req.valid("json");- const userId = c.get("userId");- const updated = await updateComment(userId, id, content);- return c.json(updated);+ ] as const,+ request: {+ params: commentParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateCommentBody } },},- )- .delete(- "/:id",- describeRoute({- operationId: "deleteTaskComment",- tags: ["Comments"],- description: "Delete a comment (author only)",- responses: {- 200: {- description: "Comment deleted successfully",- content: {- "application/json": { schema: resolver(commentSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("The updated comment", activitySchema),+ 400: errorResponse("Invalid body, or unknown comment"),+ 403: errorResponse("Not the author, or missing task:update permission"),+ 404: errorResponse("Comment not found"),+ },+});++const deleteTaskCommentRoute = createRoute({+ method: "delete",+ operationId: "deleteTaskComment",+ path: "/{id}",+ tags: ["Comments"],+ summary: "Delete task comment",+ description: "Delete a comment. Only the comment's author may do this.",+ middleware: [workspaceAccess.fromComment(),requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const userId = c.get("userId");- const deleted = await deleteComment(userId, id);- return c.json(deleted);- },+ ] as const,+ request: { params: commentParam },+ responses: {+ 200: jsonResponse("The deleted comment", activitySchema),+ 400: errorResponse(+ "Unknown comment, or its workspace could not be determined",+ ),+ 403: errorResponse("Not the author, or missing task:update permission"),+ 404: errorResponse("Comment not found"),+ },+});++const comment = apiRouter()+ .openapi(getTaskCommentsRoute, async (c) =>+ c.json(await getComments(c.req.valid("param").taskId), 200),+ )+ .openapi(createTaskCommentRoute, async (c) => {+ const { taskId } = c.req.valid("param");+ const { content, externalUserName, externalSource } = c.req.valid("json");+ // Both or neither: a name without a source would render as an+ // unattributed impersonation of a real account.+ const external =+ externalUserName && externalSource+ ? { userName: externalUserName, source: externalSource }+ : undefined;+ return c.json(+ await createComment(taskId, c.get("userId"), content, external),+ 200,+ );+ })+ .openapi(updateTaskCommentRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { content } = c.req.valid("json");+ return c.json(await updateComment(c.get("userId"), id, content), 200);+ })+ .openapi(deleteTaskCommentRoute, async (c) =>+ c.json(await deleteComment(c.get("userId"), c.req.valid("param").id), 200),);export default comment;diff --git a/apps/api/src/comment/response.ts b/apps/api/src/comment/response.tsnew file mode 100644index 000000000..01c2cb547--- /dev/null+++ b/apps/api/src/comment/response.ts@@ -0,0 +1,19 @@+import { responseTimestamp, z } from "../openapi";++// The list route joins the author; the mutation routes return the raw activity+// row, which carries no author object. See activity/response.ts.+export const commentSchema = z+ .object({+ id: z.string(),+ taskId: z.string(),+ userId: z.string(),+ content: z.string(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ user: z+ .object({ name: z.string(), image: z.string().nullable() })+ .openapi("CommentAuthor"),+ })+ .openapi("Comment");++export const commentListSchema = z.array(commentSchema);diff --git a/apps/api/src/comment/schema.ts b/apps/api/src/comment/schema.tsnew file mode 100644index 000000000..fa24b297a--- /dev/null+++ b/apps/api/src/comment/schema.ts@@ -0,0 +1,20 @@+import { z } from "../openapi";++export const taskIdParam = z.object({ taskId: z.string() });++export const commentParam = z.object({ id: z.string() });++export const createCommentBody = z.object({+ content: z.string().min(1),+ // Both or neither: a name without a source would render as an unattributed+ // impersonation of a real account.+ externalUserName: z.string().max(120).optional().openapi({+ description:+ "Attribution for an imported comment. Ignored unless externalSource is also given.",+ }),+ externalSource: z.enum(["planka", "trello", "jira"]).optional().openapi({+ description: "The tool the comment was imported from.",+ }),+});++export const updateCommentBody = z.object({ content: z.string().min(1) });diff --git a/apps/api/src/config/index.ts b/apps/api/src/config/index.tsindex ca30827da..19a756c08 100644--- a/apps/api/src/config/index.ts+++ b/apps/api/src/config/index.ts@@ -1,27 +1,25 @@-import { Hono } from "hono";-import { describeRoute, resolver } from "hono-openapi";-import { configSchema } from "../schemas";+import { apiRouter, createRoute, jsonResponse } from "../openapi";import getSettings from "../utils/get-settings";+import { configSchema } from "./response";-const config = new Hono().get(- "/",- describeRoute({- operationId: "getConfig",- tags: ["Config"],- description: "Get application settings and configuration",- responses: {- 200: {- description: "Application settings",- content: {- "application/json": { schema: resolver(configSchema) },- },- },- },- }),- async (c) => {- const settings = getSettings();- return c.json(settings);+// Mounted before the app-wide authenticateApiRequest middleware: the login+// screen reads it to decide which sign-in methods to render.+const getConfigRoute = createRoute({+ method: "get",+ operationId: "getConfig",+ path: "/",+ tags: ["Config"],+ summary: "Get config",+ description:+ "Public instance settings: which sign-in methods, registration paths, and features are enabled.",+ security: [],+ responses: {+ 200: jsonResponse("Application settings", configSchema),},+});++const config = apiRouter().openapi(getConfigRoute, (c) =>+ c.json(getSettings(), 200),);export default config;diff --git a/apps/api/src/config/response.ts b/apps/api/src/config/response.tsnew file mode 100644index 000000000..bd7b8bf2c--- /dev/null+++ b/apps/api/src/config/response.ts@@ -0,0 +1,23 @@+import { z } from "../openapi";++// getSettings() derives every flag from process.env with a boolean fallback, so+// none of these are nullable despite the previous schema saying so.+export const configSchema = z+ .object({+ disableRegistration: z.boolean(),+ disablePasswordRegistration: z.boolean(),+ disableEmailOtpSignIn: z.boolean(),+ disableWorkspaceCreation: z.boolean(),+ isDemoMode: z.boolean(),+ hasSmtp: z.boolean(),+ hasGithubSignIn: z.boolean(),+ hasGoogleSignIn: z.boolean(),+ hasDiscordSignIn: z.boolean(),+ hasCustomOAuth: z.boolean(),+ hasGuestAccess: z.boolean(),+ disableLoginForm: z.boolean(),+ customOAuthAutoLogin: z.boolean(),+ customOAuthLogoutUrl: z.string().nullable(),+ billingEnabled: z.boolean(),+ })+ .openapi("Config");diff --git a/apps/api/src/discord-integration/index.ts b/apps/api/src/discord-integration/index.tsindex 55ab4807f..bd3e51e93 100644--- a/apps/api/src/discord-integration/index.ts+++ b/apps/api/src/discord-integration/index.ts@@ -1,31 +1,29 @@import { and, eq } from "drizzle-orm";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { integrationTable } from "../database/schema";+import {+ deletedSchema,+ integrationEventToggles,+ projectIdParam,+} from "../integrations/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+ z,+} from "../openapi";import {type DiscordConfig,defaultDiscordEvents,normalizeDiscordConfig,validateDiscordConfig,} from "../plugins/discord/config";-import { discordIntegrationSchema } from "../schemas";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";--const discordIntegration = new Hono<{- Variables: {- userId: string;- workspaceId: string;- apiKey?: {- id: string;- userId: string;- enabled: boolean;- };- };-}>();+import { discordIntegrationSchema } from "./response";function maskWebhookUrl(value: string): string {try {@@ -85,232 +83,241 @@ async function getDiscordIntegration(projectId: string) {return toResponse(integration);}-const discordEventsSchema = v.object({- taskCreated: v.optional(v.boolean()),- taskStatusChanged: v.optional(v.boolean()),- taskPriorityChanged: v.optional(v.boolean()),- taskTitleChanged: v.optional(v.boolean()),- taskDescriptionChanged: v.optional(v.boolean()),- taskCommentCreated: v.optional(v.boolean()),+const createBody = z.object({+ webhookUrl: z.string().min(1),+ channelName: z.string().optional(),+ events: integrationEventToggles.optional(),});-const nullableDiscordIntegrationSchema = v.nullable(discordIntegrationSchema);+const updateBody = z.object({+ webhookUrl: z.string().optional(),+ channelName: z.string().nullable().optional(),+ isActive: z.boolean().optional(),+ events: integrationEventToggles.optional(),+});-discordIntegration- .get(- "/project/:projectId",- describeRoute({- operationId: "getDiscordIntegration",- tags: ["Discord"],- description: "Get Discord integration for a project",- responses: {- 200: {- description: "Discord integration details",- content: {- "application/json": {- schema: resolver(nullableDiscordIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const integration = await getDiscordIntegration(projectId);- return c.json(integration);+const manageAccess = [+ workspaceAccess.fromProject("projectId"),+ requireWorkspacePermission({ workspace: ["manage_settings"] }),+];++const getDiscordIntegrationRoute = createRoute({+ method: "get",+ operationId: "getDiscordIntegration",+ path: "/project/{projectId}",+ tags: ["Discord"],+ summary: "Get Discord integration",+ description:+ "Get the Discord integration for a project, or null when none is configured.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "Discord integration details, or null",+ discordIntegrationSchema.nullable(),+ ),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const createDiscordIntegrationRoute = createRoute({+ method: "post",+ operationId: "createDiscordIntegration",+ path: "/project/{projectId}",+ tags: ["Discord"],+ summary: "Create Discord integration",+ description:+ "Create or replace the Discord integration for a project. The webhook URL is verified before it is stored.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createBody } },},- )- .post(- "/project/:projectId",- describeRoute({- operationId: "createDiscordIntegration",- tags: ["Discord"],- description: "Create or replace a Discord integration for a project",- responses: {- 200: {- description: "Discord integration created successfully",- content: {- "application/json": {- schema: resolver(discordIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- webhookUrl: v.pipe(v.string(), v.minLength(1)),- channelName: v.optional(v.string()),- events: v.optional(discordEventsSchema),- }),+ },+ responses: {+ 200: jsonResponse(+ "The stored integration",+ discordIntegrationSchema.nullable(),+ ),+ 400: errorResponse("The webhook URL failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+ },+});- const config = normalizeDiscordConfig({- webhookUrl: body.webhookUrl,- channelName: body.channelName,- events: body.events,- });+const updateDiscordIntegrationRoute = createRoute({+ method: "patch",+ operationId: "updateDiscordIntegration",+ path: "/project/{projectId}",+ tags: ["Discord"],+ summary: "Update Discord integration",+ description:+ "Update the Discord integration. Omitted fields keep their current value, and event toggles are merged into the existing set.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateBody } },+ },+ },+ responses: {+ 200: jsonResponse(+ "The updated integration",+ discordIntegrationSchema.nullable(),+ ),+ 400: errorResponse("The resulting config failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Discord integration not found"),+ },+});++const deleteDiscordIntegrationRoute = createRoute({+ method: "delete",+ operationId: "deleteDiscordIntegration",+ path: "/project/{projectId}",+ tags: ["Discord"],+ summary: "Delete Discord integration",+ description: "Remove the Discord integration from a project.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The integration was removed", deletedSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Discord integration not found"),+ },+});++const discordIntegration = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(getDiscordIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const integration = await getDiscordIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(createDiscordIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- const validation = await validateDiscordConfig(config);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+ const config = normalizeDiscordConfig({+ webhookUrl: body.webhookUrl,+ channelName: body.channelName,+ events: body.events,+ });- await db- .insert(integrationTable)- .values({- projectId,- type: "discord",+ const validation = await validateDiscordConfig(config);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",+ });+ }++ await db+ .insert(integrationTable)+ .values({+ projectId,+ type: "discord",+ config: JSON.stringify(config),+ isActive: true,+ })+ .onConflictDoUpdate({+ target: [integrationTable.projectId, integrationTable.type],+ set: {config: JSON.stringify(config),isActive: true,- })- .onConflictDoUpdate({- target: [integrationTable.projectId, integrationTable.type],- set: {- config: JSON.stringify(config),- isActive: true,- updatedAt: new Date(),- },- });-- const integration = await getDiscordIntegration(projectId);- return c.json(integration);- },- )- .patch(- "/project/:projectId",- describeRoute({- operationId: "updateDiscordIntegration",- tags: ["Discord"],- description: "Update Discord integration settings",- responses: {- 200: {- description: "Discord integration updated successfully",- content: {- "application/json": { schema: resolver(discordIntegrationSchema) },- },+ updatedAt: new Date(),},- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- webhookUrl: v.optional(v.string()),- channelName: v.optional(v.nullable(v.string())),- isActive: v.optional(v.boolean()),- events: v.optional(discordEventsSchema),- }),- ),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+ });++ const integration = await getDiscordIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(updateDiscordIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "discord"),- ),+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "discord"),+ ),+ });++ if (!existing) {+ throw new HTTPException(404, {+ message: "Discord integration not found",});+ }- if (!existing) {- throw new HTTPException(404, {- message: "Discord integration not found",- });- }+ const currentConfig = normalizeDiscordConfig(+ JSON.parse(existing.config) as DiscordConfig,+ );+ const nextConfig = normalizeDiscordConfig({+ webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,+ channelName:+ body.channelName === undefined+ ? currentConfig.channelName+ : (body.channelName ?? undefined),+ events: {+ ...(currentConfig.events ?? {}),+ ...(body.events ?? {}),+ },+ });- const currentConfig = normalizeDiscordConfig(- JSON.parse(existing.config) as DiscordConfig,- );- const nextConfig = normalizeDiscordConfig({- webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,- channelName:- body.channelName === undefined- ? currentConfig.channelName- : (body.channelName ?? undefined),- events: {- ...(currentConfig.events ?? {}),- ...(body.events ?? {}),- },+ const validation = await validateDiscordConfig(nextConfig);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",});+ }- const validation = await validateDiscordConfig(nextConfig);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+ await db+ .update(integrationTable)+ .set({+ config: JSON.stringify(nextConfig),+ isActive:+ body.isActive !== undefined+ ? body.isActive+ : (existing.isActive ?? true),+ updatedAt: new Date(),+ })+ .where(eq(integrationTable.id, existing.id));- await db- .update(integrationTable)- .set({- config: JSON.stringify(nextConfig),- isActive:- body.isActive !== undefined- ? body.isActive- : (existing.isActive ?? true),- updatedAt: new Date(),- })- .where(eq(integrationTable.id, existing.id));+ const integration = await getDiscordIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(deleteDiscordIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");- const integration = await getDiscordIntegration(projectId);- return c.json(integration);- },- )- .delete(- "/project/:projectId",- describeRoute({- operationId: "deleteDiscordIntegration",- tags: ["Discord"],- description: "Delete Discord integration for a project",- responses: {- 200: {- description: "Discord integration deleted successfully",- content: {- "application/json": {- schema: resolver(v.object({ success: v.boolean() })),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "discord"),+ ),+ });- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "discord"),- ),+ if (!existing) {+ throw new HTTPException(404, {+ message: "Discord integration not found",});+ }- if (!existing) {- throw new HTTPException(404, {- message: "Discord integration not found",- });- }-- await db- .delete(integrationTable)- .where(eq(integrationTable.id, existing.id));- return c.json({ success: true });- },- );+ await db+ .delete(integrationTable)+ .where(eq(integrationTable.id, existing.id));+ return c.json({ success: true }, 200);+ });export default discordIntegration;diff --git a/apps/api/src/discord-integration/response.ts b/apps/api/src/discord-integration/response.tsnew file mode 100644index 000000000..7dfe928e0--- /dev/null+++ b/apps/api/src/discord-integration/response.ts@@ -0,0 +1,20 @@+import { integrationEventsSchema } from "../integrations/response";+import { responseTimestamp, z } from "../openapi";++// The webhook URL is a bearer credential, so only a masked form is returned.+export const discordIntegrationSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ channelName: z.string().nullable(),+ webhookConfigured: z.boolean(),+ maskedWebhookUrl: z.string().openapi({+ description:+ "The webhook URL with its secret path segment masked, or an empty string when none is set.",+ }),+ events: integrationEventsSchema,+ isActive: z.boolean().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("DiscordIntegration");diff --git a/apps/api/src/external-link/index.ts b/apps/api/src/external-link/index.tsindex 95c496404..8db5b1597 100644--- a/apps/api/src/external-link/index.ts+++ b/apps/api/src/external-link/index.ts@@ -1,67 +1,57 @@import { eq } from "drizzle-orm";-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { externalLinkTable } from "../database/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { workspaceAccess } from "../utils/workspace-access-middleware";+import { externalLinkListSchema } from "./response";+import { taskIdParam } from "./schema";-const externalLinkSchema = v.object({- id: v.string(),- taskId: v.string(),- integrationId: v.string(),- resourceType: v.string(),- externalId: v.string(),- url: v.string(),- title: v.nullable(v.string()),- metadata: v.any(),- createdAt: v.date(),- updatedAt: v.date(),+const getExternalLinksByTaskRoute = createRoute({+ method: "get",+ operationId: "getExternalLinksByTask",+ path: "/task/{taskId}",+ tags: ["External Links"],+ summary: "Get task external links",+ description:+ "Get all links from a task to resources in connected integrations, such as GitHub or Gitea issues.",+ middleware: [workspaceAccess.fromTaskId("taskId")] as const,+ request: { params: taskIdParam },+ responses: {+ 200: jsonResponse("External links for the task", externalLinkListSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the task's workspace"),+ },});-const externalLink = new Hono<{- Variables: {- userId: string;- workspaceId: string;- };-}>().get(- "/task/:taskId",- describeRoute({- operationId: "getExternalLinksByTask",- tags: ["External Links"],- description: "Get all external links for a task",- responses: {- 200: {- description: "External links for the task",- content: {- "application/json": {- schema: resolver(v.array(externalLinkSchema)),- },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),- workspaceAccess.fromTaskId("taskId"),- async (c) => {- const { taskId } = c.req.valid("param");+const externalLink = apiRouter<+ BaseVariables & { workspaceId: string }+>().openapi(getExternalLinksByTaskRoute, async (c) => {+ const { taskId } = c.req.valid("param");- const links = await db.query.externalLinkTable.findMany({- where: eq(externalLinkTable.taskId, taskId),- with: {- // Never widen this: integration.config holds plaintext provider- // secrets and this route is reachable by any workspace member.- integration: { columns: { id: true, type: true } },- },- });+ const links = await db.query.externalLinkTable.findMany({+ where: eq(externalLinkTable.taskId, taskId),+ with: {+ // Never widen this: integration.config holds plaintext provider+ // secrets and this route is reachable by any workspace member.+ integration: { columns: { id: true, type: true } },+ },+ });- const formattedLinks = links.map((link) => ({+ return c.json(+ links.map((link) => ({...link,metadata: link.metadata ? JSON.parse(link.metadata) : null,- }));-- return c.json(formattedLinks);- },-);+ })),+ 200,+ );+});export default externalLink;diff --git a/apps/api/src/external-link/response.ts b/apps/api/src/external-link/response.tsnew file mode 100644index 000000000..56613f0ca--- /dev/null+++ b/apps/api/src/external-link/response.ts@@ -0,0 +1,31 @@+import { responseTimestamp, z } from "../openapi";++export const externalLinkSchema = z+ .object({+ id: z.string(),+ taskId: z.string(),+ integrationId: z.string(),+ resourceType: z.string().openapi({+ description:+ "The kind of remote resource, e.g. `issue` or `pull_request`.",+ }),+ externalId: z.string().openapi({+ description: "The provider's own identifier for the linked resource.",+ }),+ url: z.string(),+ title: z.string().nullable(),+ metadata: z.unknown().nullable().openapi({+ description:+ "Provider-specific payload, parsed from the stored JSON string. Null when the link has no metadata.",+ }),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ // The route selects only id/type here on purpose: integration.config holds+ // plaintext provider secrets and any workspace member can read this route.+ integration: z+ .object({ id: z.string(), type: z.string() })+ .openapi("ExternalLinkIntegration"),+ })+ .openapi("ExternalLink");++export const externalLinkListSchema = z.array(externalLinkSchema);diff --git a/apps/api/src/external-link/schema.ts b/apps/api/src/external-link/schema.tsnew file mode 100644index 000000000..a7f80ace2--- /dev/null+++ b/apps/api/src/external-link/schema.ts@@ -0,0 +1,3 @@+import { z } from "../openapi";++export const taskIdParam = z.object({ taskId: z.string() });diff --git a/apps/api/src/generic-webhook-integration/index.ts b/apps/api/src/generic-webhook-integration/index.tsindex 36c798bfa..ac2866e92 100644--- a/apps/api/src/generic-webhook-integration/index.ts+++ b/apps/api/src/generic-webhook-integration/index.ts@@ -1,31 +1,29 @@import { and, eq } from "drizzle-orm";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { integrationTable } from "../database/schema";+import {+ deletedSchema,+ genericWebhookEventToggles,+ projectIdParam,+} from "../integrations/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+ z,+} from "../openapi";import {defaultGenericWebhookEvents,type GenericWebhookConfig,normalizeGenericWebhookConfig,validateGenericWebhookConfig,} from "../plugins/generic-webhook/config";-import { genericWebhookIntegrationSchema } from "../schemas";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";--const genericWebhookIntegration = new Hono<{- Variables: {- userId: string;- workspaceId: string;- apiKey?: {- id: string;- userId: string;- enabled: boolean;- };- };-}>();+import { genericWebhookIntegrationSchema } from "./response";function maskValue(value: string | undefined): string | null {if (!value) return null;@@ -78,258 +76,266 @@ async function getGenericWebhookIntegration(projectId: string) {return toResponse(integration);}-const genericWebhookEventsSchema = v.object({- taskCreated: v.optional(v.boolean()),- taskStatusChanged: v.optional(v.boolean()),- taskPriorityChanged: v.optional(v.boolean()),- taskTitleChanged: v.optional(v.boolean()),- taskDescriptionChanged: v.optional(v.boolean()),- taskCommentCreated: v.optional(v.boolean()),- taskDeleted: v.optional(v.boolean()),- taskMoved: v.optional(v.boolean()),- taskDueDateChanged: v.optional(v.boolean()),- taskAssigneeChanged: v.optional(v.boolean()),- taskUnassigned: v.optional(v.boolean()),- dueDateReminder: v.optional(v.boolean()),-});--const nullableGenericWebhookIntegrationSchema = v.nullable(- genericWebhookIntegrationSchema,-);+const leadTimeMinutes = z+ .number()+ .int()+ .min(5)+ .max(43_200)+ .openapi({ description: "Between 5 minutes and 30 days." });-genericWebhookIntegration- .get(- "/project/:projectId",- describeRoute({- operationId: "getGenericWebhookIntegration",- tags: ["Generic Webhook"],- description: "Get generic outgoing webhook integration for a project",- responses: {- 200: {- description: "Generic webhook integration details",- content: {- "application/json": {- schema: resolver(nullableGenericWebhookIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- return c.json(await getGenericWebhookIntegration(projectId));- },- )- .post(- "/project/:projectId",- describeRoute({- operationId: "createGenericWebhookIntegration",- tags: ["Generic Webhook"],- description: "Create or replace a generic outgoing webhook integration",- responses: {- 200: {- description: "Generic webhook integration created successfully",- content: {- "application/json": {- schema: resolver(genericWebhookIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- webhookUrl: v.pipe(v.string(), v.minLength(1)),- secret: v.optional(v.string()),- events: v.optional(genericWebhookEventsSchema),- dueDateReminderLeadTimeMinutes: v.optional(- v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),- ),- }),- ),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+const createBody = z.object({+ webhookUrl: z.string().min(1),+ secret: z.string().optional().openapi({+ description: "Optional HMAC secret used to sign outgoing deliveries.",+ }),+ events: genericWebhookEventToggles.optional(),+ dueDateReminderLeadTimeMinutes: leadTimeMinutes.optional(),+});- const config = normalizeGenericWebhookConfig({- webhookUrl: body.webhookUrl,- secret: body.secret,- events: body.events,- dueDateReminderLeadTimeMinutes: body.dueDateReminderLeadTimeMinutes,- });+const updateBody = z.object({+ webhookUrl: z.string().optional(),+ secret: z.string().nullable().optional().openapi({+ description: "Send null to remove the signing secret.",+ }),+ isActive: z.boolean().optional(),+ events: genericWebhookEventToggles.optional(),+ dueDateReminderLeadTimeMinutes: leadTimeMinutes.optional(),+});- const validation = await validateGenericWebhookConfig(config);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+const manageAccess = [+ workspaceAccess.fromProject("projectId"),+ requireWorkspacePermission({ workspace: ["manage_settings"] }),+];- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "generic-webhook"),- ),- });+const getGenericWebhookIntegrationRoute = createRoute({+ method: "get",+ operationId: "getGenericWebhookIntegration",+ path: "/project/{projectId}",+ tags: ["Generic Webhook"],+ summary: "Get webhook integration",+ description:+ "Get the outgoing webhook integration for a project, or null when none is configured.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "Webhook integration details, or null",+ genericWebhookIntegrationSchema.nullable(),+ ),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});- if (existing) {- await db- .update(integrationTable)- .set({- config: JSON.stringify(config),- isActive: true,- updatedAt: new Date(),- })- .where(eq(integrationTable.id, existing.id));- } else {- await db.insert(integrationTable).values({- projectId,- type: "generic-webhook",- config: JSON.stringify(config),- isActive: true,- });- }+const createGenericWebhookIntegrationRoute = createRoute({+ method: "post",+ operationId: "createGenericWebhookIntegration",+ path: "/project/{projectId}",+ tags: ["Generic Webhook"],+ summary: "Create webhook integration",+ description:+ "Create or replace the outgoing webhook for a project. Kaneo POSTs the selected task events to this URL, signed with the secret when one is set.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createBody } },+ },+ },+ responses: {+ 200: jsonResponse(+ "The stored integration",+ genericWebhookIntegrationSchema.nullable(),+ ),+ 400: errorResponse("The webhook URL failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ },+});- return c.json(await getGenericWebhookIntegration(projectId));+const updateGenericWebhookIntegrationRoute = createRoute({+ method: "patch",+ operationId: "updateGenericWebhookIntegration",+ path: "/project/{projectId}",+ tags: ["Generic Webhook"],+ summary: "Update webhook integration",+ description:+ "Update the outgoing webhook. Omitted fields keep their current value, event toggles merge into the existing set, and a null secret clears it.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateBody } },},- )- .patch(- "/project/:projectId",- describeRoute({- operationId: "updateGenericWebhookIntegration",- tags: ["Generic Webhook"],- description: "Update generic outgoing webhook settings",- responses: {- 200: {- description: "Generic webhook integration updated successfully",- content: {- "application/json": {- schema: resolver(genericWebhookIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- webhookUrl: v.optional(v.string()),- secret: v.optional(v.nullable(v.string())),- isActive: v.optional(v.boolean()),- events: v.optional(genericWebhookEventsSchema),- dueDateReminderLeadTimeMinutes: v.optional(- v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),- ),- }),+ },+ responses: {+ 200: jsonResponse(+ "The updated integration",+ genericWebhookIntegrationSchema.nullable(),),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+ 400: errorResponse("The resulting config failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Webhook integration not found"),+ },+});- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "generic-webhook"),- ),- });+const deleteGenericWebhookIntegrationRoute = createRoute({+ method: "delete",+ operationId: "deleteGenericWebhookIntegration",+ path: "/project/{projectId}",+ tags: ["Generic Webhook"],+ summary: "Delete webhook integration",+ description: "Remove the outgoing webhook from a project.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The integration was removed", deletedSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Webhook integration not found"),+ },+});- if (!existing) {- throw new HTTPException(404, {- message: "Generic webhook integration not found",- });- }+const genericWebhookIntegration = apiRouter<+ BaseVariables & { workspaceId: string }+>()+ .openapi(getGenericWebhookIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ return c.json(await getGenericWebhookIntegration(projectId), 200);+ })+ .openapi(createGenericWebhookIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- const currentConfig = normalizeGenericWebhookConfig(- JSON.parse(existing.config) as GenericWebhookConfig,- );- const nextConfig = normalizeGenericWebhookConfig({- webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,- secret:- body.secret === undefined- ? currentConfig.secret- : (body.secret ?? undefined),- events: {- ...(currentConfig.events ?? {}),- ...(body.events ?? {}),- },- dueDateReminderLeadTimeMinutes:- body.dueDateReminderLeadTimeMinutes ??- currentConfig.dueDateReminderLeadTimeMinutes,+ const config = normalizeGenericWebhookConfig({+ webhookUrl: body.webhookUrl,+ secret: body.secret,+ events: body.events,+ dueDateReminderLeadTimeMinutes: body.dueDateReminderLeadTimeMinutes,+ });++ const validation = await validateGenericWebhookConfig(config);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",});+ }- const validation = await validateGenericWebhookConfig(nextConfig);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "generic-webhook"),+ ),+ });+ if (existing) {await db.update(integrationTable).set({- config: JSON.stringify(nextConfig),- isActive:- body.isActive !== undefined- ? body.isActive- : (existing.isActive ?? true),+ config: JSON.stringify(config),+ isActive: true,updatedAt: new Date(),}).where(eq(integrationTable.id, existing.id));+ } else {+ await db.insert(integrationTable).values({+ projectId,+ type: "generic-webhook",+ config: JSON.stringify(config),+ isActive: true,+ });+ }- return c.json(await getGenericWebhookIntegration(projectId));- },- )- .delete(- "/project/:projectId",- describeRoute({- operationId: "deleteGenericWebhookIntegration",- tags: ["Generic Webhook"],- description: "Delete generic outgoing webhook integration for a project",- responses: {- 200: {- description: "Generic webhook integration deleted successfully",- content: {- "application/json": {- schema: resolver(v.object({ success: v.boolean() })),- },- },- },+ return c.json(await getGenericWebhookIntegration(projectId), 200);+ })+ .openapi(updateGenericWebhookIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");++ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "generic-webhook"),+ ),+ });++ if (!existing) {+ throw new HTTPException(404, {+ message: "Generic webhook integration not found",+ });+ }++ const currentConfig = normalizeGenericWebhookConfig(+ JSON.parse(existing.config) as GenericWebhookConfig,+ );+ const nextConfig = normalizeGenericWebhookConfig({+ webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,+ secret:+ body.secret === undefined+ ? currentConfig.secret+ : (body.secret ?? undefined),+ events: {+ ...(currentConfig.events ?? {}),+ ...(body.events ?? {}),},- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");+ dueDateReminderLeadTimeMinutes:+ body.dueDateReminderLeadTimeMinutes ??+ currentConfig.dueDateReminderLeadTimeMinutes,+ });- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "generic-webhook"),- ),+ const validation = await validateGenericWebhookConfig(nextConfig);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",});+ }- if (!existing) {- throw new HTTPException(404, {- message: "Generic webhook integration not found",- });- }+ await db+ .update(integrationTable)+ .set({+ config: JSON.stringify(nextConfig),+ isActive:+ body.isActive !== undefined+ ? body.isActive+ : (existing.isActive ?? true),+ updatedAt: new Date(),+ })+ .where(eq(integrationTable.id, existing.id));- await db- .delete(integrationTable)- .where(eq(integrationTable.id, existing.id));+ return c.json(await getGenericWebhookIntegration(projectId), 200);+ })+ .openapi(deleteGenericWebhookIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");- return c.json({ success: true });- },- );+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "generic-webhook"),+ ),+ });++ if (!existing) {+ throw new HTTPException(404, {+ message: "Generic webhook integration not found",+ });+ }++ await db+ .delete(integrationTable)+ .where(eq(integrationTable.id, existing.id));++ return c.json({ success: true }, 200);+ });export default genericWebhookIntegration;diff --git a/apps/api/src/generic-webhook-integration/response.ts b/apps/api/src/generic-webhook-integration/response.tsnew file mode 100644index 000000000..8617eeb45--- /dev/null+++ b/apps/api/src/generic-webhook-integration/response.ts@@ -0,0 +1,26 @@+import { genericWebhookEventsSchema } from "../integrations/response";+import { responseTimestamp, z } from "../openapi";++// Both the URL and the signing secret are credentials, so only masked forms+// are returned alongside a boolean saying whether each is set.+export const genericWebhookIntegrationSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ webhookConfigured: z.boolean(),+ maskedWebhookUrl: z.string().nullable(),+ secretConfigured: z.boolean(),+ maskedSecret: z.string().nullable().openapi({+ description:+ "A preview of the HMAC signing secret used to sign outgoing deliveries.",+ }),+ events: genericWebhookEventsSchema,+ dueDateReminderLeadTimeMinutes: z.number().openapi({+ description:+ "How long before a due date the dueDateReminder event fires, in minutes.",+ }),+ isActive: z.boolean().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("GenericWebhookIntegration");diff --git a/apps/api/src/gitea-integration/controllers/verify-gitea-access.ts b/apps/api/src/gitea-integration/controllers/verify-gitea-access.tsindex ce5f2822b..8e51b6689 100644--- a/apps/api/src/gitea-integration/controllers/verify-gitea-access.ts+++ b/apps/api/src/gitea-integration/controllers/verify-gitea-access.ts@@ -33,7 +33,7 @@ async function verifyGiteaAccess({repositoryPrivate: null,missingPermissions: [] as string[],message: "The URL does not point to a Gitea instance.",- failureReason: "not_a_gitea_instance",+ failureReason: "not_a_gitea_instance" as const,};}throw error;@@ -72,7 +72,7 @@ async function verifyGiteaAccess({repositoryPrivate: null,missingPermissions: [] as string[],message: `The Gitea URL redirected (HTTP ${error.status}). This usually means the server forces HTTPS. Please use the final URL directly.`,- failureReason: "redirected",+ failureReason: "redirected" as const,};}@@ -84,7 +84,7 @@ async function verifyGiteaAccess({repositoryPrivate: null,missingPermissions: [] as string[],message: "The URL does not point to a Gitea instance.",- failureReason: "not_a_gitea_instance",+ failureReason: "not_a_gitea_instance" as const,};}}@@ -97,7 +97,7 @@ async function verifyGiteaAccess({repositoryPrivate: null,missingPermissions: [] as string[],message: "Repository not found or not accessible with this token.",- failureReason: "repository_not_found",+ failureReason: "repository_not_found" as const,};}diff --git a/apps/api/src/gitea-integration/index.ts b/apps/api/src/gitea-integration/index.tsindex e15d2dec3..8d00b12f9 100644--- a/apps/api/src/gitea-integration/index.ts+++ b/apps/api/src/gitea-integration/index.ts@@ -1,401 +1,350 @@import { and, eq } from "drizzle-orm";import type { Context } from "hono";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";-import { integrationTable, projectTable } from "../database/schema";+import { integrationTable } from "../database/schema";+import { scopeToProjectFromBody } from "../integrations/middleware";+import { projectIdBody, projectIdParam } from "../integrations/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+ z,+} from "../openapi";import { type GiteaConfig, validateGiteaConfig } from "../plugins/gitea/config";import { handleGiteaWebhookRequest } from "../plugins/gitea/webhook-handler";-import { giteaIntegrationSchema } from "../schemas";import {hasWorkspacePermission,requireWorkspacePermission,} from "../utils/require-workspace-permission";-import { validateWorkspaceAccess } from "../utils/validate-workspace-access";-import {- workspaceAccess,- workspaceAccessMiddleware,-} from "../utils/workspace-access-middleware";+import { workspaceAccess } from "../utils/workspace-access-middleware";import createGiteaIntegration from "./controllers/create-gitea-integration";import deleteGiteaIntegration from "./controllers/delete-gitea-integration";import getGiteaIntegration from "./controllers/get-gitea-integration";import { importGiteaIssues } from "./controllers/import-gitea-issues";import listGiteaRepositories from "./controllers/list-gitea-repositories";import verifyGiteaAccess from "./controllers/verify-gitea-access";+import {+ giteaDeleteResultSchema,+ giteaImportResultSchema,+ giteaIntegrationSchema,+ giteaRepositoryListSchema,+ giteaVerificationResultSchema,+} from "./response";++const manageAccess = [+ workspaceAccess.fromProject("projectId"),+ requireWorkspacePermission({ workspace: ["manage_settings"] }),+];-const giteaRepositorySchema = v.object({- id: v.number(),- name: v.string(),- full_name: v.string(),- owner: v.object({- login: v.string(),+const giteaCredentials = {+ projectId: z.string().min(1),+ baseUrl: z.url(),+ accessToken: z.string().min(1),+};++const listRepositoriesBody = z.object(giteaCredentials);++const verifyBody = z.object({+ ...giteaCredentials,+ repositoryOwner: z.string().min(1),+ repositoryName: z.string().min(1),+});++const createBody = z.object({+ baseUrl: z.string().min(1),+ accessToken: z.string().optional().openapi({+ description: "Omit to keep the token already stored for this project.",}),- private: v.boolean(),- html_url: v.string(),+ repositoryOwner: z.string().min(1),+ repositoryName: z.string().min(1),});-const verificationResultSchema = v.object({- isInstalled: v.boolean(),- hasRequiredPermissions: v.boolean(),- repositoryExists: v.boolean(),- repositoryPrivate: v.nullable(v.boolean()),- missingPermissions: v.array(v.string()),- message: v.string(),- failureReason: v.nullable(- v.picklist(["not_a_gitea_instance", "redirected", "repository_not_found"]),- ),+const updateBody = z.object({+ isActive: z.boolean().optional(),+ commentTaskLinkOnGiteaIssue: z.boolean().optional(),});-const importResultSchema = v.object({- imported: v.number(),- updated: v.number(),- skipped: v.number(),- errors: v.optional(v.array(v.string())),+const listRepositoriesRoute = createRoute({+ method: "post",+ operationId: "listGiteaRepositories",+ path: "/repositories",+ tags: ["Gitea"],+ summary: "List Gitea repositories",+ description:+ "List the repositories a Gitea token can reach, for picking one to link. Sent as a POST because the token travels in the body rather than the URL.",+ middleware: manageAccess,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: listRepositoriesBody } },+ },+ },+ responses: {+ 200: jsonResponse("Accessible repositories", giteaRepositoryListSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ },});-const nullableGiteaIntegrationSchema = v.nullable(giteaIntegrationSchema);+const verifyRoute = createRoute({+ method: "post",+ operationId: "verifyGiteaAccess",+ path: "/verify",+ tags: ["Gitea"],+ summary: "Verify Gitea access",+ description:+ "Check that the base URL is a Gitea instance and that the token can reach the repository with the permissions Kaneo needs. Always 200 -- problems are reported in the body.",+ middleware: manageAccess,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: verifyBody } },+ },+ },+ responses: {+ 200: jsonResponse("Verification result", giteaVerificationResultSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ },+});-const giteaIntegration = new Hono<{- Variables: {- userId: string;- workspaceId: string;- apiKey?: {- id: string;- userId: string;- enabled: boolean;- };- };-}>()- .post(- "/repositories",- describeRoute({- operationId: "listGiteaRepositories",- tags: ["Gitea"],- description: "List repositories accessible with a Gitea token",- responses: {- 200: {- description: "Repositories",- content: {- "application/json": {- schema: resolver(- v.object({- repositories: v.array(giteaRepositorySchema),- }),- ),- },- },- },- },- }),- validator(- "json",- v.object({- projectId: v.pipe(v.string(), v.minLength(1)),- baseUrl: v.pipe(v.string(), v.url()),- accessToken: v.pipe(v.string(), v.minLength(1)),- }),+const getIntegrationRoute = createRoute({+ method: "get",+ operationId: "getGiteaIntegration",+ path: "/project/{projectId}",+ tags: ["Gitea"],+ summary: "Get Gitea integration",+ description:+ "Get the Gitea integration for a project, or null when none is configured. The webhook secret is included only for callers with workspace:manage_settings.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "Gitea integration details, or null",+ giteaIntegrationSchema.nullable(),),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { baseUrl, accessToken } = c.req.valid("json");- const result = await listGiteaRepositories({ baseUrl, accessToken });- return c.json(result);- },- )- .post(- "/verify",- describeRoute({- operationId: "verifyGiteaAccess",- tags: ["Gitea"],- description: "Verify Gitea token and repository access",- responses: {- 200: {- description: "Verification result",- content: {- "application/json": {- schema: resolver(verificationResultSchema),- },- },- },- },- }),- validator(- "json",- v.object({- projectId: v.pipe(v.string(), v.minLength(1)),- baseUrl: v.pipe(v.string(), v.url()),- accessToken: v.pipe(v.string(), v.minLength(1)),- repositoryOwner: v.pipe(v.string(), v.minLength(1)),- repositoryName: v.pipe(v.string(), v.minLength(1)),- }),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const body = c.req.valid("json");- const result = await verifyGiteaAccess(body);- return c.json(result);- },- )- .get(- "/project/:projectId",- describeRoute({- operationId: "getGiteaIntegration",- tags: ["Gitea"],- description: "Get Gitea integration for a project",- responses: {- 200: {- description: "Gitea integration details",- content: {- "application/json": {- schema: resolver(nullableGiteaIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccessMiddleware({- sources: [{ type: "lookup", resource: "project", idKey: "projectId" }],- }),- async (c) => {- const { projectId } = c.req.valid("param");- const includeWebhookSecret = await hasWorkspacePermission(c, {- workspace: ["manage_settings"],- });- const integration = await getGiteaIntegration(- projectId,- includeWebhookSecret,- );- if (!integration) {- return c.json(null, 200);- }- return c.json(integration);+ 403: errorResponse("No access to the project's workspace"),+ },+});++const createIntegrationRoute = createRoute({+ method: "post",+ operationId: "createGiteaIntegration",+ path: "/project/{projectId}",+ tags: ["Gitea"],+ summary: "Create Gitea integration",+ description:+ "Link a project to a Gitea repository, creating the webhook Gitea will post events to.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createBody } },},- )- .post(- "/project/:projectId",- describeRoute({- operationId: "createGiteaIntegration",- tags: ["Gitea"],- description: "Create or update Gitea integration for a project",- responses: {- 200: {- description: "Integration saved",- content: {- "application/json": {- schema: resolver(giteaIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- baseUrl: v.pipe(v.string(), v.minLength(1)),- accessToken: v.optional(v.string()),- repositoryOwner: v.pipe(v.string(), v.minLength(1)),- repositoryName: v.pipe(v.string(), v.minLength(1)),- }),+ },+ responses: {+ 200: jsonResponse("The stored integration", giteaIntegrationSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");- await createGiteaIntegration({- projectId,- baseUrl: body.baseUrl,- accessToken: body.accessToken,- repositoryOwner: body.repositoryOwner,- repositoryName: body.repositoryName,- });- const integration = await getGiteaIntegration(projectId, true);- if (!integration) {- throw new HTTPException(500, { message: "Failed to load integration" });- }- return c.json(integration);+ },+});++const updateIntegrationRoute = createRoute({+ method: "patch",+ operationId: "updateGiteaIntegration",+ path: "/project/{projectId}",+ tags: ["Gitea"],+ summary: "Update Gitea integration",+ description:+ "Update the Gitea integration. Omitted fields keep their current value.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateBody } },},- )- .patch(- "/project/:projectId",- describeRoute({- operationId: "updateGiteaIntegration",- tags: ["Gitea"],- description: "Update Gitea integration settings",- responses: {- 200: {- description: "Updated",- content: {- "application/json": {- schema: resolver(giteaIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- isActive: v.optional(v.boolean()),- commentTaskLinkOnGiteaIssue: v.optional(v.boolean()),- }),+ },+ responses: {+ 200: jsonResponse("The updated integration", giteaIntegrationSchema),+ 400: errorResponse("The resulting config failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");-- const row = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "gitea"),- ),- });-- if (!row) {- return c.json({ error: "Integration not found" }, 404);- }-- let config: GiteaConfig;- try {- config = JSON.parse(row.config) as GiteaConfig;- } catch {- throw new HTTPException(500, { message: "Invalid integration config" });- }-- if (body.commentTaskLinkOnGiteaIssue !== undefined) {- config = {- ...config,- commentTaskLinkOnGiteaIssue: body.commentTaskLinkOnGiteaIssue,- };- }-- const validation = await validateGiteaConfig(config);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+ 404: jsonResponse("Integration not found", z.object({ error: z.string() })),+ },+});- await db- .update(integrationTable)- .set({- config: JSON.stringify(config),- isActive:- body.isActive !== undefined- ? body.isActive- : (row.isActive ?? true),- updatedAt: new Date(),- })- .where(- and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "gitea"),- ),- );+const deleteIntegrationRoute = createRoute({+ method: "delete",+ operationId: "deleteGiteaIntegration",+ path: "/project/{projectId}",+ tags: ["Gitea"],+ summary: "Delete Gitea integration",+ description: "Unlink a project from its Gitea repository.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The integration was removed", giteaDeleteResultSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Gitea integration not found"),+ },+});- const updated = await getGiteaIntegration(projectId, true);- if (!updated) {- throw new HTTPException(500, { message: "Failed to load integration" });- }- return c.json(updated, 200);- },- )- .delete(- "/project/:projectId",- describeRoute({- operationId: "deleteGiteaIntegration",- tags: ["Gitea"],- description: "Delete Gitea integration for a project",- responses: {- 200: {- description: "Deleted",- content: {- "application/json": {- schema: resolver(- v.object({- success: v.boolean(),- message: v.string(),- }),- ),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const result = await deleteGiteaIntegration(projectId);- return c.json(result);+const importIssuesRoute = createRoute({+ method: "post",+ operationId: "importGiteaIssues",+ path: "/import-issues",+ tags: ["Gitea"],+ summary: "Import Gitea issues",+ description:+ "Import the linked repository's issues as tasks. Issues that already have a task are refreshed rather than duplicated.",+ middleware: [+ scopeToProjectFromBody,+ requireWorkspacePermission({ task: ["create"] }),+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: projectIdBody } },},- )- .post(- "/import-issues",- describeRoute({- operationId: "importGiteaIssues",- tags: ["Gitea"],- description: "Import Gitea issues as tasks",- responses: {- 200: {- description: "Import result",- content: {- "application/json": {- schema: resolver(importResultSchema),- },- },- },- },- }),- validator(- "json",- v.object({- projectId: v.string(),- }),+ },+ responses: {+ 200: jsonResponse("Import summary", giteaImportResultSchema),+ 400: errorResponse("projectId is required"),+ 403: errorResponse(+ "No workspace access, or missing task:create permission",),- async (c, next) => {- const userId = c.get("userId");- if (!userId) {- throw new HTTPException(401, { message: "Unauthorized" });- }+ 404: errorResponse("Project not found"),+ },+});- const { projectId } = c.req.valid("json");+const giteaIntegration = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(listRepositoriesRoute, async (c) => {+ const { baseUrl, accessToken } = c.req.valid("json");+ const result = await listGiteaRepositories({ baseUrl, accessToken });+ return c.json(result, 200);+ })+ .openapi(verifyRoute, async (c) => {+ const body = c.req.valid("json");+ const result = await verifyGiteaAccess(body);+ return c.json(result, 200);+ })+ .openapi(getIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const includeWebhookSecret = await hasWorkspacePermission(c, {+ workspace: ["manage_settings"],+ });+ const integration = await getGiteaIntegration(+ projectId,+ includeWebhookSecret,+ );+ if (!integration) {+ return c.json(null, 200);+ }+ return c.json(integration, 200);+ })+ .openapi(createIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");+ await createGiteaIntegration({+ projectId,+ baseUrl: body.baseUrl,+ accessToken: body.accessToken,+ repositoryOwner: body.repositoryOwner,+ repositoryName: body.repositoryName,+ });+ const integration = await getGiteaIntegration(projectId, true);+ if (!integration) {+ throw new HTTPException(500, { message: "Failed to load integration" });+ }+ return c.json(integration, 200);+ })+ .openapi(updateIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- const [project] = await db- .select({ workspaceId: projectTable.workspaceId })- .from(projectTable)- .where(eq(projectTable.id, projectId))- .limit(1);+ const row = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "gitea"),+ ),+ });- if (!project) {- throw new HTTPException(404, { message: "Project not found" });- }+ if (!row) {+ return c.json({ error: "Integration not found" }, 404);+ }- const apiKey = c.get("apiKey");- const apiKeyId = apiKey?.id;+ let config: GiteaConfig;+ try {+ config = JSON.parse(row.config) as GiteaConfig;+ } catch {+ throw new HTTPException(500, { message: "Invalid integration config" });+ }- await validateWorkspaceAccess(userId, project.workspaceId, apiKeyId);- c.set("workspaceId", project.workspaceId);+ if (body.commentTaskLinkOnGiteaIssue !== undefined) {+ config = {+ ...config,+ commentTaskLinkOnGiteaIssue: body.commentTaskLinkOnGiteaIssue,+ };+ }- return next();- },- requireWorkspacePermission({ task: ["create"] }),- async (c) => {- const { projectId } = c.req.valid("json");- const result = await importGiteaIssues(projectId);- return c.json(result);- },- );+ const validation = await validateGiteaConfig(config);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",+ });+ }++ await db+ .update(integrationTable)+ .set({+ config: JSON.stringify(config),+ isActive:+ body.isActive !== undefined ? body.isActive : (row.isActive ?? true),+ updatedAt: new Date(),+ })+ .where(+ and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "gitea"),+ ),+ );++ const updated = await getGiteaIntegration(projectId, true);+ if (!updated) {+ throw new HTTPException(500, { message: "Failed to load integration" });+ }+ return c.json(updated, 200);+ })+ .openapi(deleteIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const result = await deleteGiteaIntegration(projectId);+ return c.json(result, 200);+ })+ .openapi(importIssuesRoute, async (c) => {+ const { projectId } = c.req.valid("json");+ const result = await importGiteaIssues(projectId);+ return c.json(result, 200);+ });export async function handleGiteaWebhookRoute(c: Context) {const integrationId = c.req.param("integrationId");diff --git a/apps/api/src/gitea-integration/response.ts b/apps/api/src/gitea-integration/response.tsnew file mode 100644index 000000000..1cba1afdb--- /dev/null+++ b/apps/api/src/gitea-integration/response.ts@@ -0,0 +1,81 @@+import { responseTimestamp, z } from "../openapi";++// The access token is a credential, so only a masked form is returned. The+// webhook secret is included only for callers holding workspace:manage_settings.+export const giteaIntegrationSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ baseUrl: z+ .string()+ .openapi({ description: "Root URL of the Gitea instance." }),+ repositoryOwner: z.string(),+ repositoryName: z.string(),+ maskedAccessToken: z.string(),+ webhookUrl: z.string().optional().openapi({+ description: "Where Gitea should POST events for this project.",+ }),+ webhookSecret: z.string().optional().openapi({+ description:+ "Only returned to callers with workspace:manage_settings, so the value can be pasted into Gitea.",+ }),+ branchPattern: z.string().optional(),+ commentTaskLinkOnGiteaIssue: z.boolean().optional().openapi({+ description:+ "When on, Kaneo comments a link back to the task on the linked Gitea issue.",+ }),+ isActive: z.boolean().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("GiteaIntegration");++export const giteaRepositorySchema = z+ .object({+ id: z.number(),+ name: z.string(),+ full_name: z.string(),+ owner: z.object({ login: z.string() }).openapi("GiteaRepositoryOwner"),+ private: z.boolean(),+ html_url: z.string(),+ })+ .openapi("GiteaRepository");++export const giteaRepositoryListSchema = z+ .object({ repositories: z.array(giteaRepositorySchema) })+ .openapi("GiteaRepositoryList");++export const giteaVerificationResultSchema = z+ .object({+ isInstalled: z.boolean(),+ hasRequiredPermissions: z.boolean(),+ repositoryExists: z.boolean(),+ repositoryPrivate: z.boolean().nullable(),+ missingPermissions: z.array(z.string()),+ message: z.string().openapi({+ description: "A human-readable summary to show the user.",+ }),+ failureReason: z+ .enum(["not_a_gitea_instance", "redirected", "repository_not_found"])+ .nullable()+ .openapi({+ description:+ "Why verification failed, when it did. `redirected` usually means the base URL is behind a proxy that rewrites it.",+ }),+ })+ .openapi("GiteaVerificationResult");++export const giteaImportResultSchema = z+ .object({+ imported: z.number(),+ updated: z.number().openapi({+ description: "Existing tasks that were refreshed from their issue.",+ }),+ skipped: z.number(),+ errors: z.array(z.string()).optional(),+ })+ .openapi("GiteaImportResult");++export const giteaDeleteResultSchema = z+ .object({ success: z.boolean(), message: z.string() })+ .openapi("GiteaDeleteResult");diff --git a/apps/api/src/github-integration/index.ts b/apps/api/src/github-integration/index.tsindex 6b2bf7318..f7c90d99a 100644--- a/apps/api/src/github-integration/index.ts+++ b/apps/api/src/github-integration/index.ts@@ -1,19 +1,24 @@import { and, eq } from "drizzle-orm";import type { Context } from "hono";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";-import { integrationTable, projectTable } from "../database/schema";+import { integrationTable } from "../database/schema";+import { scopeToProjectFromBody } from "../integrations/middleware";+import { projectIdBody, projectIdParam } from "../integrations/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+ z,+} from "../openapi";import {type GitHubConfig,validateGitHubConfig,} from "../plugins/github/config";import { handleGitHubWebhook } from "../plugins/github/webhook-handler";-import { githubIntegrationSchema } from "../schemas";import { requireWorkspacePermission } from "../utils/require-workspace-permission";-import { validateWorkspaceAccess } from "../utils/validate-workspace-access";import { workspaceAccess } from "../utils/workspace-access-middleware";import createGithubIntegration from "./controllers/create-github-integration";import deleteGithubIntegration from "./controllers/delete-github-integration";@@ -21,363 +26,327 @@ import getGithubIntegration from "./controllers/get-github-integration";import { importIssues } from "./controllers/import-issues";import listUserRepositories from "./controllers/list-user-repositories";import verifyGithubInstallation from "./controllers/verify-github-installation";+import {+ createdGithubIntegrationSchema,+ deleteResultSchema,+ githubAppInfoSchema,+ githubIntegrationSchema,+ githubRepositoryListSchema,+ importResultSchema,+ verificationResultSchema,+} from "./response";++const manageAccess = [+ workspaceAccess.fromProject("projectId"),+ requireWorkspacePermission({ workspace: ["manage_settings"] }),+];++const repositoryRef = {+ repositoryOwner: z.string().min(1),+ repositoryName: z.string().min(1),+};-const githubAppInfoSchema = v.object({- appName: v.nullable(v.string()),+const verifyBody = z.object({+ projectId: z.string().min(1),+ ...repositoryRef,});-const githubRepositorySchema = v.object({- id: v.number(),- name: v.string(),- full_name: v.string(),- owner: v.object({- login: v.string(),- }),- private: v.boolean(),- html_url: v.string(),+const createBody = z.object(repositoryRef);++const updateBody = z.object({+ isActive: z.boolean().optional(),+ commentTaskLinkOnGitHubIssue: z.boolean().optional(),});-const verificationResultSchema = v.object({- isInstalled: v.boolean(),- installationId: v.nullable(v.number()),- repositoryExists: v.nullable(v.boolean()),- repositoryPrivate: v.nullable(v.boolean()),- permissions: v.nullable(v.record(v.string(), v.string())),- hasRequiredPermissions: v.boolean(),- missingPermissions: v.array(v.string()),- message: v.string(),- settingsUrl: v.optional(v.string()),- installationUrl: v.optional(v.string()),+const getAppInfoRoute = createRoute({+ method: "get",+ operationId: "getGitHubAppInfo",+ path: "/app-info",+ tags: ["GitHub"],+ summary: "Get GitHub app info",+ description:+ "Get the GitHub App this instance is configured with, so the client can build an install link.",+ responses: {+ 200: jsonResponse("GitHub app information", githubAppInfoSchema),+ },});-const importResultSchema = v.object({- imported: v.number(),- skipped: v.number(),- errors: v.optional(v.array(v.string())),+const listRepositoriesRoute = createRoute({+ method: "get",+ operationId: "listGitHubRepositories",+ path: "/repositories/{projectId}",+ tags: ["GitHub"],+ summary: "List GitHub repositories",+ description:+ "List the repositories reachable through the installed GitHub App, for picking one to link.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "Repositories reachable through the installed App",+ githubRepositoryListSchema,+ ),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ },});-const githubIntegration = new Hono<{- Variables: {- userId: string;- workspaceId: string;- apiKey?: {- id: string;- userId: string;- enabled: boolean;- };- };-}>()- .get(- "/app-info",- describeRoute({- operationId: "getGitHubAppInfo",- tags: ["GitHub"],- description: "Get GitHub app configuration information",- responses: {- 200: {- description: "GitHub app information",- content: {- "application/json": { schema: resolver(githubAppInfoSchema) },- },- },- },- }),- async (c) => {- return c.json({- appName: process.env.GITHUB_APP_NAME || null,- });+const verifyRoute = createRoute({+ method: "post",+ operationId: "verifyGitHubInstallation",+ path: "/verify",+ tags: ["GitHub"],+ summary: "Verify GitHub installation",+ description:+ "Check that the GitHub App is installed on a repository and holds the permissions Kaneo needs. Always 200 -- problems are reported in the body so the client can guide the user.",+ middleware: manageAccess,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: verifyBody } },},- )- .get(- "/repositories/:projectId",- describeRoute({- operationId: "listGitHubRepositories",- tags: ["GitHub"],- description: "List all accessible GitHub repositories",- responses: {- 200: {- description: "List of repositories",- content: {- "application/json": {- schema: resolver(v.array(githubRepositorySchema)),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const repositories = await listUserRepositories();- return c.json(repositories);- },- )- .post(- "/verify",- describeRoute({- operationId: "verifyGitHubInstallation",- tags: ["GitHub"],- description: "Verify GitHub app installation for a repository",- responses: {- 200: {- description: "Verification result",- content: {- "application/json": { schema: resolver(verificationResultSchema) },- },- },- },- }),- validator(- "json",- v.object({- projectId: v.pipe(v.string(), v.minLength(1)),- repositoryOwner: v.pipe(v.string(), v.minLength(1)),- repositoryName: v.pipe(v.string(), v.minLength(1)),- }),+ },+ responses: {+ 200: jsonResponse("Verification result", verificationResultSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { repositoryOwner, repositoryName } = c.req.valid("json");-- const verification = await verifyGithubInstallation({- repositoryOwner,- repositoryName,- });+ },+});- return c.json(verification);- },- )- .get(- "/project/:projectId",- describeRoute({- operationId: "getGitHubIntegration",- tags: ["GitHub"],- description: "Get GitHub integration for a project",- responses: {- 200: {- description: "GitHub integration details",- content: {- "application/json": { schema: resolver(githubIntegrationSchema) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const integration = await getGithubIntegration(projectId);- return c.json(integration);- },- )- .post(- "/project/:projectId",- describeRoute({- operationId: "createGitHubIntegration",- tags: ["GitHub"],- description: "Create a new GitHub integration for a project",- responses: {- 200: {- description: "Integration created successfully",- content: {- "application/json": { schema: resolver(githubIntegrationSchema) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- repositoryOwner: v.pipe(v.string(), v.minLength(1)),- repositoryName: v.pipe(v.string(), v.minLength(1)),- }),+const getIntegrationRoute = createRoute({+ method: "get",+ operationId: "getGitHubIntegration",+ path: "/project/{projectId}",+ tags: ["GitHub"],+ summary: "Get GitHub integration",+ description:+ "Get the GitHub integration for a project, or null when none is configured.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "GitHub integration details, or null",+ githubIntegrationSchema.nullable(),),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const { repositoryOwner, repositoryName } = c.req.valid("json");-- const integration = await createGithubIntegration({- projectId,- repositoryOwner,- repositoryName,- });+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});- return c.json(integration);+const createIntegrationRoute = createRoute({+ method: "post",+ operationId: "createGitHubIntegration",+ path: "/project/{projectId}",+ tags: ["GitHub"],+ summary: "Create GitHub integration",+ description: "Link a project to a GitHub repository.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createBody } },},- )- .patch(- "/project/:projectId",- describeRoute({- operationId: "updateGitHubIntegration",- tags: ["GitHub"],- description: "Update GitHub integration settings",- responses: {- 200: {- description: "Integration updated successfully",- content: {- "application/json": { schema: resolver(githubIntegrationSchema) },- },- },- 404: {- description: "Integration not found",- content: {- "application/json": {- schema: resolver(v.object({ error: v.string() })),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- isActive: v.optional(v.boolean()),- commentTaskLinkOnGitHubIssue: v.optional(v.boolean()),- }),+ },+ responses: {+ 200: jsonResponse("The stored integration", createdGithubIntegrationSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");-- const row = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "github"),- ),- });+ },+});- if (!row) {- return c.json({ error: "Integration not found" }, 404);- }-- let config: GitHubConfig;- try {- config = JSON.parse(row.config) as GitHubConfig;- } catch {- throw new HTTPException(500, { message: "Invalid integration config" });- }-- if (body.commentTaskLinkOnGitHubIssue !== undefined) {- config = {- ...config,- commentTaskLinkOnGitHubIssue: body.commentTaskLinkOnGitHubIssue,- };- }-- const validation = await validateGitHubConfig(config);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }-- await db- .update(integrationTable)- .set({- config: JSON.stringify(config),- isActive:- body.isActive !== undefined- ? body.isActive- : (row.isActive ?? true),- updatedAt: new Date(),- })- .where(- and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "github"),- ),- );-- const updated = await getGithubIntegration(projectId);- return c.json(updated, 200);+const updateIntegrationRoute = createRoute({+ method: "patch",+ operationId: "updateGitHubIntegration",+ path: "/project/{projectId}",+ tags: ["GitHub"],+ summary: "Update GitHub integration",+ description:+ "Update the GitHub integration. Omitted fields keep their current value.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateBody } },},- )- .delete(- "/project/:projectId",- describeRoute({- operationId: "deleteGitHubIntegration",- tags: ["GitHub"],- description: "Delete GitHub integration for a project",- responses: {- 200: {- description: "Integration deleted successfully",- content: {- "application/json": { schema: resolver(githubIntegrationSchema) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const result = await deleteGithubIntegration(projectId);- return c.json(result);+ },+ responses: {+ 200: jsonResponse(+ "The updated integration",+ githubIntegrationSchema.nullable(),+ ),+ 400: errorResponse("The resulting config failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: jsonResponse("Integration not found", z.object({ error: z.string() })),+ },+});++const deleteIntegrationRoute = createRoute({+ method: "delete",+ operationId: "deleteGitHubIntegration",+ path: "/project/{projectId}",+ tags: ["GitHub"],+ summary: "Delete GitHub integration",+ description: "Unlink a project from its GitHub repository.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The integration was removed", deleteResultSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("GitHub integration not found"),+ },+});++const importIssuesRoute = createRoute({+ method: "post",+ operationId: "importGitHubIssues",+ path: "/import-issues",+ tags: ["GitHub"],+ summary: "Import GitHub issues",+ description:+ "Import the linked repository's issues as tasks. Issues that already have a task are skipped.",+ middleware: [+ scopeToProjectFromBody,+ requireWorkspacePermission({ task: ["create"] }),+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: projectIdBody } },},- )- .post(- "/import-issues",- describeRoute({- operationId: "importGitHubIssues",- tags: ["GitHub"],- description: "Import GitHub issues as tasks",- responses: {- 200: {- description: "Issues imported successfully",- content: {- "application/json": { schema: resolver(importResultSchema) },- },- },- },- }),- validator(- "json",- v.object({- projectId: v.string(),- }),+ },+ responses: {+ 200: jsonResponse("Import summary", importResultSchema),+ 400: errorResponse("projectId is required"),+ 403: errorResponse(+ "No workspace access, or missing task:create permission",),- async (c, next) => {- const userId = c.get("userId");- if (!userId) {- throw new HTTPException(401, { message: "Unauthorized" });- }+ 404: errorResponse("Project not found"),+ },+});- const { projectId } = c.req.valid("json");+const githubIntegration = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(getAppInfoRoute, async (c) => {+ return c.json(+ {+ appName: process.env.GITHUB_APP_NAME || null,+ },+ 200,+ );+ })+ .openapi(listRepositoriesRoute, async (c) => {+ const repositories = await listUserRepositories();+ return c.json(repositories, 200);+ })+ .openapi(verifyRoute, async (c) => {+ const { repositoryOwner, repositoryName } = c.req.valid("json");- const [project] = await db- .select({ workspaceId: projectTable.workspaceId })- .from(projectTable)- .where(eq(projectTable.id, projectId))- .limit(1);+ const verification = await verifyGithubInstallation({+ repositoryOwner,+ repositoryName,+ });- if (!project) {- throw new HTTPException(404, { message: "Project not found" });- }+ return c.json(verification, 200);+ })+ .openapi(getIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const integration = await getGithubIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(createIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const { repositoryOwner, repositoryName } = c.req.valid("json");- const apiKey = c.get("apiKey");- const apiKeyId = apiKey?.id;+ const integration = await createGithubIntegration({+ projectId,+ repositoryOwner,+ repositoryName,+ });- await validateWorkspaceAccess(userId, project.workspaceId, apiKeyId);- c.set("workspaceId", project.workspaceId);+ return c.json(integration, 200);+ })+ .openapi(updateIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- return next();- },- requireWorkspacePermission({ task: ["create"] }),- async (c) => {- const { projectId } = c.req.valid("json");- const result = await importIssues(projectId);- return c.json(result);- },- );+ const row = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "github"),+ ),+ });++ if (!row) {+ return c.json({ error: "Integration not found" }, 404);+ }++ let config: GitHubConfig;+ try {+ config = JSON.parse(row.config) as GitHubConfig;+ } catch {+ throw new HTTPException(500, { message: "Invalid integration config" });+ }++ if (body.commentTaskLinkOnGitHubIssue !== undefined) {+ config = {+ ...config,+ commentTaskLinkOnGitHubIssue: body.commentTaskLinkOnGitHubIssue,+ };+ }++ const validation = await validateGitHubConfig(config);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",+ });+ }++ await db+ .update(integrationTable)+ .set({+ config: JSON.stringify(config),+ isActive:+ body.isActive !== undefined ? body.isActive : (row.isActive ?? true),+ updatedAt: new Date(),+ })+ .where(+ and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "github"),+ ),+ );++ const updated = await getGithubIntegration(projectId);+ return c.json(updated, 200);+ })+ .openapi(deleteIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const result = await deleteGithubIntegration(projectId);+ return c.json(result, 200);+ })+ .openapi(importIssuesRoute, async (c) => {+ const { projectId } = c.req.valid("json");+ const result = await importIssues(projectId);+ return c.json(result, 200);+ });export async function handleGithubWebhookRoute(c: Context) {const arrayBuffer = await c.req.arrayBuffer();@@ -408,4 +377,5 @@ export async function handleGithubWebhookRoute(c: Context) {return c.json({ status: "success" });}+export default githubIntegration;diff --git a/apps/api/src/github-integration/response.ts b/apps/api/src/github-integration/response.tsnew file mode 100644index 000000000..8694ad5db--- /dev/null+++ b/apps/api/src/github-integration/response.ts@@ -0,0 +1,145 @@+import { responseTimestamp, z } from "../openapi";++export const githubIntegrationSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ repositoryOwner: z.string(),+ repositoryName: z.string(),+ installationId: z.number().nullable().openapi({+ description:+ "The GitHub App installation that grants access to the repository.",+ }),+ branchPattern: z.string().optional().openapi({+ description: "Template used to name branches created for a task.",+ }),+ commentTaskLinkOnGitHubIssue: z.boolean().optional().openapi({+ description:+ "When on, Kaneo comments a link back to the task on the linked GitHub issue.",+ }),+ isActive: z.boolean().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("GitHubIntegration");++export const githubAppInfoSchema = z+ .object({+ appName: z.string().nullable().openapi({+ description:+ "The configured GitHub App slug, or null when this instance has no App set up.",+ }),+ })+ .openapi("GitHubAppInfo");++export const githubRepositorySchema = z+ .object({+ id: z.number(),+ name: z.string(),+ full_name: z.string(),+ private: z.boolean(),+ owner: z+ .object({+ login: z.string(),+ avatar_url: z.string(),+ type: z.string(),+ })+ .openapi("GitHubRepositoryOwner"),+ description: z.string().nullable(),+ html_url: z.string(),+ permissions: z+ .object({+ admin: z.boolean(),+ push: z.boolean(),+ pull: z.boolean(),+ })+ .optional()+ .openapi("GitHubRepositoryPermissions"),+ updated_at: z.string().openapi({ format: "date-time" }),+ installation_id: z.number().openapi({+ description: "Which App installation this repository came through.",+ }),+ })+ .openapi("GitHubRepository");++export const githubInstallationSchema = z+ .object({+ id: z.number(),+ account: z+ .object({ login: z.string(), type: z.string() })+ .nullable()+ .openapi("GitHubInstallationAccount"),+ repositories: z.array(z.string()).openapi({+ description:+ "Full names of the repositories under this installation. Empty when listing them failed.",+ }),+ })+ .openapi("GitHubInstallation");++// The previous spec described this route as returning a bare repository array;+// it has always returned this envelope.+export const githubRepositoryListSchema = z+ .object({+ repositories: z.array(githubRepositorySchema).openapi({+ description:+ "Deduplicated across installations, most recently updated first.",+ }),+ installations: z.array(githubInstallationSchema),+ total: z.number(),+ })+ .openapi("GitHubRepositoryList");++export const verificationResultSchema = z+ .object({+ isInstalled: z.boolean(),+ installationId: z.number().nullable(),+ repositoryExists: z.boolean().nullable(),+ repositoryPrivate: z.boolean().nullable(),+ permissions: z.record(z.string(), z.string()).nullable().openapi({+ description: "The permissions the installation currently grants.",+ }),+ hasRequiredPermissions: z.boolean(),+ missingPermissions: z.array(z.string()).openapi({+ description:+ "Permissions that must be granted before the link will work.",+ }),+ message: z.string().openapi({+ description: "A human-readable summary to show the user.",+ }),+ settingsUrl: z.string().optional().openapi({+ description: "Where to adjust the installation, when one exists.",+ }),+ installationUrl: z.string().optional().openapi({+ description: "Where to install the App, when it is not installed yet.",+ }),+ })+ .openapi("GitHubVerificationResult");++export const importResultSchema = z+ .object({+ imported: z.number(),+ skipped: z.number().openapi({+ description: "Issues that already had a task, or were not importable.",+ }),+ errors: z.array(z.string()).optional(),+ })+ .openapi("IssueImportResult");++// createGithubIntegration assembles its result from the inserted row, whose+// fields TypeScript cannot prove are present, so the create route reports the+// looser shape rather than claiming a guarantee the code does not make.+export const createdGithubIntegrationSchema = githubIntegrationSchema+ .partial({+ id: true,+ projectId: true,+ isActive: true,+ createdAt: true,+ updatedAt: true,+ })+ .openapi("CreatedGitHubIntegration");++// The delete route returns a plain acknowledgement, not the removed row --+// the previous spec described it as returning the integration.+export const deleteResultSchema = z+ .object({ success: z.boolean(), message: z.string() })+ .openapi("GitHubDeleteResult");diff --git a/apps/api/src/index.ts b/apps/api/src/index.tsindex 93a00da7d..56fd48584 100644--- a/apps/api/src/index.ts+++ b/apps/api/src/index.ts@@ -4,6 +4,7 @@ import { dirname } from "node:path";import { fileURLToPath, pathToFileURL } from "node:url";import { serve } from "@hono/node-server";import { createNodeWebSocket } from "@hono/node-ws";+import { OpenAPIHono } from "@hono/zod-openapi";import * as Sentry from "@sentry/node";import type { Session, User } from "better-auth/types";import { eq, sql } from "drizzle-orm";@@ -12,15 +13,9 @@ import { Hono } from "hono";import { compress } from "hono/compress";import { cors } from "hono/cors";import { HTTPException } from "hono/http-exception";-import {- describeRoute,- openAPIRouteHandler,- resolver,- validator,-} from "hono-openapi";-import * as v from "valibot";import activity from "./activity";import { auth } from "./auth";+import { organizationRoutes } from "./auth-openapi";import billing from "./billing";import column from "./column";import comment from "./comment";@@ -44,6 +39,7 @@ import { migrateColumns } from "./migrations/column-migration";import notification from "./notification";import notificationPreferences from "./notification-preferences";import oauth from "./oauth";+import { createRoute, jsonResponse, z } from "./openapi";import { initializePlugins } from "./plugins";import { migrateGitHubIntegration } from "./plugins/github/migration";import project from "./project";@@ -65,18 +61,7 @@ import { migrateApiKeyReferenceId } from "./utils/migrate-apikey-reference-id";import { migrateNotificationPreferencesSchema } from "./utils/migrate-notification-preferences-schema";import { migrateSessionColumn } from "./utils/migrate-session-column";import { migrateWorkspaceUserEmail } from "./utils/migrate-workspace-user-email";-import {- dedupeOperationIds,- ensureOperationSummaries,- markOptionalSchemaFieldsNullable,- mergeOpenApiSpecs,- normalizeApiServerUrl,- normalizeEmptyAndEnumSchemas,- normalizeEmptyRequiredArrays,- normalizeMalformedPropertySchemas,- normalizeNullableSchemasForOpenApi30,- normalizeOrganizationAuthOperations,-} from "./utils/openapi-spec";+import { normalizeApiServerUrl } from "./utils/openapi-spec";import { seedDefaultWorkspaceRoles } from "./utils/seed-default-workspace-roles";import { validateWorkspaceAccess } from "./utils/validate-workspace-access";import workflowRule from "./workflow-rule";@@ -210,40 +195,32 @@ export function createApp() {// JSON with repeated keys compresses extremely well.app.use(compress());- const api = new Hono<ApiVariables>();+ const api = new OpenAPIHono<ApiVariables>();api.get("/health", (c) => {return c.json({ status: "ok" });});- api.get(- "/instance/status",- describeRoute({+ api.openapi(+ createRoute({+ method: "get",operationId: "getInstanceStatus",+ path: "/instance/status",tags: ["Instance"],+ summary: "Get instance status",description:"Public instance setup status. When hasUsers is false the next signup becomes the instance admin.",security: [],responses: {- 200: {- description: "Instance status",- content: {- "application/json": {- schema: resolver(- v.object({- hasUsers: v.boolean(),- hasAdmin: v.boolean(),- }),- ),- },- },- },+ 200: jsonResponse(+ "Instance status",+ z+ .object({ hasUsers: z.boolean(), hasAdmin: z.boolean() })+ .openapi("InstanceStatus"),+ ),},}),- async (c) => {- const status = await getInstanceStatus();- return c.json(status);- },+ async (c) => c.json(await getInstanceStatus(), 200),);const publicProjectApi = api.get("/public-project/:id", async (c) => {@@ -266,44 +243,46 @@ export function createApp() {return c.json(result);});- api.get(- "/auth/get-session",- describeRoute({+ api.openapi(+ createRoute({+ method: "get",operationId: "getSession",+ path: "/auth/get-session",tags: ["Authentication"],- description: "Get the current authenticated session",+ summary: "Get session",+ description:+ "Get the current authenticated session, or null when the caller is not signed in. Served by Better Auth.",security: [],responses: {200: {- description: "Current session details or null when unauthenticated",- content: {- "application/json": { schema: resolver(v.any()) },- },+ description: "Current session details, or null when unauthenticated",},},}),- async (c) => {- return auth.handler(c.req.raw);- },+ async (c) => auth.handler(c.req.raw),);- api.get(- "/asset/:id",- describeRoute({+ api.openapi(+ createRoute({+ method: "get",operationId: "getAsset",+ path: "/asset/{id}",tags: ["Assets"],- description: "Download an uploaded asset by ID",+ summary: "Download asset",+ description:+ "Download an uploaded asset. Readable without signing in only when it belongs to a public project; image types are served inline, everything else as an attachment.",security: [],+ request: { params: z.object({ id: z.string() }) },responses: {200: {description: "The requested asset binary stream",- content: {- "*/*": { schema: { type: "string", format: "binary" } },- },+ content: { "*/*": { schema: { type: "string", format: "binary" } } },},+ 304: { description: "Not modified" },+ 403: { description: "No access to this asset" },+ 404: { description: "Asset not found" },},}),- validator("param", v.object({ id: v.string() })),async (c) => {const { id } = c.req.param();const [asset] = await db@@ -363,13 +342,17 @@ export function createApp() {},);- api.get(- "/user/avatar/:id",- describeRoute({+ api.openapi(+ createRoute({+ method: "get",operationId: "getUserAvatar",+ path: "/user/avatar/{id}",tags: ["User"],- description: "Download a user avatar by its avatar ID",+ summary: "Download avatar",+ description:+ "Download a user avatar by its avatar ID. Public, immutable, and cache-friendly: the id changes whenever the avatar is replaced.",security: [],+ request: { params: z.object({ id: z.string() }) },responses: {200: {description: "The avatar image",@@ -377,12 +360,10 @@ export function createApp() {"image/*": { schema: { type: "string", format: "binary" } },},},- 404: {- description: "Avatar not found",- },+ 304: { description: "Not modified" },+ 404: { description: "Avatar not found" },},}),- validator("param", v.object({ id: v.string() })),async (c) => {const { id } = c.req.valid("param");const avatar = await getAvatar(id);@@ -411,9 +392,16 @@ export function createApp() {const configApi = api.route("/config", config);- const honoOpenApiHandler = openAPIRouteHandler(api, {- documentation: {- openapi: "3.0.3",+ api.openAPIRegistry.registerComponent("securitySchemes", "bearerAuth", {+ type: "http",+ scheme: "bearer",+ description: "API key or session token (Bearer)",+ });+ organizationRoutes(api.openAPIRegistry);++ api.get("/openapi", (c) => {+ const document = api.getOpenAPI31Document({+ openapi: "3.1.0",info: {title: "Kaneo API",version: "1.0.0",@@ -428,103 +416,78 @@ export function createApp() {description: "Kaneo API Server",},],- components: {- securitySchemes: {- bearerAuth: {- type: "http",- scheme: "bearer",- description: "API key or session token (Bearer)",- },- },- },security: [{ bearerAuth: [] }],- },- });-- api.get("/openapi", async (c) => {- const maybeResponse = await honoOpenApiHandler(c, async () => {});- const honoSpecResponse = maybeResponse ?? c.res;- const honoSpec = (await honoSpecResponse.json()) as Record<string, unknown>;+ });- let authSpec: Record<string, unknown> = {};- try {- authSpec = (await auth.api.generateOpenAPISchema()) as Record<+ // Every authenticated route sits behind the same app-wide+ // authenticateApiRequest middleware, so the shared 401 is injected here+ // rather than repeated on all ~120 route definitions. Routes that opt out+ // of auth declare `security: []` and are skipped.+ const httpMethods = [+ "get",+ "post",+ "put",+ "delete",+ "patch",+ "options",+ "head",+ "trace",+ ];+ const paths = (document.paths ?? {}) as Record<+ string,+ Record<string,- unknown- >;- } catch (error) {- console.error("Failed to generate Better Auth OpenAPI schema:", error);+ { responses?: Record<string, unknown>; security?: unknown[] }+ >+ >;+ for (const operations of Object.values(paths)) {+ for (const [method, operation] of Object.entries(operations)) {+ if (!httpMethods.includes(method) || !operation.responses) continue;+ if (+ Array.isArray(operation.security) &&+ operation.security.length === 0+ ) {+ continue;+ }+ operation.responses["401"] ??= {+ description: "Missing or invalid credentials",+ };+ }}- const normalizedAuthSpec = normalizeOrganizationAuthOperations(authSpec);- return c.json(- ensureOperationSummaries(- dedupeOperationIds(- markOptionalSchemaFieldsNullable(- normalizeNullableSchemasForOpenApi30(- normalizeEmptyAndEnumSchemas(- normalizeEmptyRequiredArrays(- normalizeMalformedPropertySchemas(- mergeOpenApiSpecs(honoSpec, normalizedAuthSpec),- ),- ),- ),- ),- ),- ),- ),- );+ return c.json(document);});// Better Auth serves GET /auth/device as JSON. Browsers that open the API URL// directly expect a page, so redirect full document navigations to the web app.- const authDeviceQuerySchema = v.object({- user_code: v.optional(v.string()),- ui: v.optional(v.picklist(["1"])),+ const authDeviceQuerySchema = z.object({+ user_code: z.string().optional().openapi({+ description: "The device authorization user code.",+ }),+ ui: z.enum(["1"]).optional().openapi({+ description:+ "Force a redirect to the web UI, for clients that do not send Sec-Fetch-* headers.",+ }),});- api.get(- "/auth/device",- describeRoute({+ api.openapi(+ createRoute({+ method: "get",operationId: "getDeviceAuthorizationPage",+ path: "/auth/device",tags: ["Authentication"],+ summary: "Device authorization page",description:- "Redirect browser-based device authorization requests to the web UI",+ "Better Auth serves this as JSON. A top-level browser navigation is redirected to the web app's device screen instead, so opening the URL by hand shows a page rather than a JSON blob.",security: [],- parameters: [- {- name: "user_code",- in: "query",- required: false,- schema: {- type: "string",- },- description: "The device authorization user code.",- },- {- name: "ui",- in: "query",- required: false,- schema: {- type: "string",- enum: ["1"],- },- description: "Force a redirect to the web UI.",- },- ],+ request: { query: authDeviceQuerySchema },responses: {302: {description: "Redirects the browser to the web app device screen",},- 200: {- description: "Device authorization payload from Better Auth",- content: {- "application/json": { schema: resolver(v.any()) },- },- },+ 200: { description: "Device authorization payload from Better Auth" },},}),- validator("query", authDeviceQuerySchema),async (c) => {const { user_code: userCode, ui } = c.req.valid("query");const secFetchDest = c.req.header("Sec-Fetch-Dest");diff --git a/apps/api/src/integrations/middleware.ts b/apps/api/src/integrations/middleware.tsnew file mode 100644index 000000000..fe356773f--- /dev/null+++ b/apps/api/src/integrations/middleware.ts@@ -0,0 +1,43 @@+import { eq } from "drizzle-orm";+import type { Context, Next } from "hono";+import { HTTPException } from "hono/http-exception";+import db from "../database";+import { projectTable } from "../database/schema";+import { validateWorkspaceAccess } from "../utils/validate-workspace-access";++// Scopes the request to the workspace owning the projectId in the JSON body.+// Route middleware runs before the request validators, so this reads the raw+// body rather than c.req.valid("json"), which is not populated yet.+export async function scopeToProjectFromBody(c: Context, next: Next) {+ const userId = c.get("userId");+ if (!userId) {+ throw new HTTPException(401, { message: "Unauthorized" });+ }++ const body = (await c.req.json().catch(() => ({}))) as {+ projectId?: unknown;+ };+ const projectId = typeof body?.projectId === "string" ? body.projectId : null;+ if (!projectId) {+ throw new HTTPException(400, { message: "projectId is required" });+ }++ const [project] = await db+ .select({ workspaceId: projectTable.workspaceId })+ .from(projectTable)+ .where(eq(projectTable.id, projectId))+ .limit(1);++ if (!project) {+ throw new HTTPException(404, { message: "Project not found" });+ }++ await validateWorkspaceAccess(+ userId,+ project.workspaceId,+ c.get("apiKey")?.id,+ );+ c.set("workspaceId", project.workspaceId);++ return next();+}diff --git a/apps/api/src/integrations/response.ts b/apps/api/src/integrations/response.tsnew file mode 100644index 000000000..bbe9a2dde--- /dev/null+++ b/apps/api/src/integrations/response.ts@@ -0,0 +1,26 @@+import { z } from "../openapi";++// Which task events a chat/webhook integration forwards. Every integration+// stores the full set with defaults applied, so none of these are optional on+// the way out.+export const integrationEventsSchema = z+ .object({+ taskCreated: z.boolean(),+ taskStatusChanged: z.boolean(),+ taskPriorityChanged: z.boolean(),+ taskTitleChanged: z.boolean(),+ taskDescriptionChanged: z.boolean(),+ taskCommentCreated: z.boolean(),+ })+ .openapi("IntegrationEvents");++export const genericWebhookEventsSchema = integrationEventsSchema+ .extend({+ taskDeleted: z.boolean(),+ taskMoved: z.boolean(),+ taskDueDateChanged: z.boolean(),+ taskAssigneeChanged: z.boolean(),+ taskUnassigned: z.boolean(),+ dueDateReminder: z.boolean(),+ })+ .openapi("GenericWebhookEvents");diff --git a/apps/api/src/integrations/schema.ts b/apps/api/src/integrations/schema.tsnew file mode 100644index 000000000..9fead5ed5--- /dev/null+++ b/apps/api/src/integrations/schema.ts@@ -0,0 +1,26 @@+import { z } from "../openapi";++export const projectIdParam = z.object({ projectId: z.string() });++// On the way in every toggle is optional: omitted ones keep their current value.+export const integrationEventToggles = z.object({+ taskCreated: z.boolean().optional(),+ taskStatusChanged: z.boolean().optional(),+ taskPriorityChanged: z.boolean().optional(),+ taskTitleChanged: z.boolean().optional(),+ taskDescriptionChanged: z.boolean().optional(),+ taskCommentCreated: z.boolean().optional(),+});++export const genericWebhookEventToggles = integrationEventToggles.extend({+ taskDeleted: z.boolean().optional(),+ taskMoved: z.boolean().optional(),+ taskDueDateChanged: z.boolean().optional(),+ taskAssigneeChanged: z.boolean().optional(),+ taskUnassigned: z.boolean().optional(),+ dueDateReminder: z.boolean().optional(),+});++export const deletedSchema = z.object({ success: z.boolean() });++export const projectIdBody = z.object({ projectId: z.string() });diff --git a/apps/api/src/invitation/index.ts b/apps/api/src/invitation/index.tsindex ce2d234d4..bfd4e8005 100644--- a/apps/api/src/invitation/index.ts+++ b/apps/api/src/invitation/index.ts@@ -1,97 +1,52 @@-import type { User } from "better-auth/types";-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";+import { apiRouter, createRoute, jsonResponse } from "../openapi";import getInvitationDetailsController from "./controllers/get-invitation-details";import getUserPendingInvitations from "./controllers/get-user-pending-invitations";+import {+ invitationDetailsSchema,+ pendingInvitationListSchema,+} from "./response";+import { invitationParam } from "./schema";-const invitation = new Hono<{- Variables: {- user: User | null;- userId: string;- userEmail: string;- };-}>()- .get(- "/pending",- describeRoute({- operationId: "getUserPendingInvitations",- tags: ["Invitations"],- description: "Get all pending invitations for the current user",- responses: {- 200: {- description: "List of pending invitations",- content: {- "application/json": {- schema: resolver(- v.array(- v.object({- id: v.string(),- email: v.string(),- workspaceId: v.string(),- workspaceName: v.string(),- inviterName: v.string(),- expiresAt: v.string(),- createdAt: v.string(),- status: v.string(),- }),- ),- ),- },- },- },- },- }),- async (c) => {- const user = c.get("user");- if (!user?.emailVerified) {- return c.json([]);- }+const getPendingRoute = createRoute({+ method: "get",+ operationId: "getUserPendingInvitations",+ path: "/pending",+ tags: ["Invitations"],+ summary: "Get pending invitations",+ description:+ "Get the current user's unexpired, unaccepted invitations. Returns an empty list until the user's email is verified.",+ responses: {+ 200: jsonResponse(+ "List of pending invitations",+ pendingInvitationListSchema,+ ),+ },+});- const userEmail = c.get("userEmail");- const invitations = await getUserPendingInvitations(userEmail);- return c.json(invitations);- },- )- .get(- "/:id",- describeRoute({- operationId: "getInvitationDetails",- tags: ["Invitations"],- description: "Get details of a specific invitation by ID",- responses: {- 200: {- description: "Invitation details",- content: {- "application/json": {- schema: resolver(- v.object({- valid: v.boolean(),- invitation: v.optional(- v.object({- id: v.string(),- email: v.string(),- workspaceName: v.string(),- inviterName: v.string(),- expiresAt: v.string(),- status: v.string(),- expired: v.boolean(),- }),- ),- error: v.optional(v.string()),- }),- ),- },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- async (c) => {- const { id } = c.req.valid("param");- const result = await getInvitationDetailsController(id);- return c.json(result);- },+const getInvitationRoute = createRoute({+ method: "get",+ operationId: "getInvitationDetails",+ path: "/{id}",+ tags: ["Invitations"],+ summary: "Get invitation details",+ description:+ "Look up an invitation by ID. Always 200 -- an unusable invitation is reported with valid: false and a reason rather than an error status.",+ request: { params: invitationParam },+ responses: {+ 200: jsonResponse("Invitation details", invitationDetailsSchema),+ },+});++const invitation = apiRouter()+ .openapi(getPendingRoute, async (c) => {+ const user = c.get("user");+ if (!user?.emailVerified) {+ return c.json([], 200);+ }+ return c.json(await getUserPendingInvitations(c.get("userEmail")), 200);+ })+ .openapi(getInvitationRoute, async (c) =>+ c.json(await getInvitationDetailsController(c.req.valid("param").id), 200),);export default invitation;diff --git a/apps/api/src/invitation/response.ts b/apps/api/src/invitation/response.tsnew file mode 100644index 000000000..caa23dd0d--- /dev/null+++ b/apps/api/src/invitation/response.ts@@ -0,0 +1,45 @@+import { responseTimestamp, z } from "../openapi";++export const pendingInvitationSchema = z+ .object({+ id: z.string(),+ email: z.string(),+ workspaceId: z.string(),+ workspaceName: z.string(),+ inviterName: z.string(),+ expiresAt: responseTimestamp,+ createdAt: responseTimestamp,+ status: z.string().openapi({+ description:+ "Always `pending` here; expired and accepted ones are filtered out.",+ }),+ })+ .openapi("PendingInvitation");++export const pendingInvitationListSchema = z.array(pendingInvitationSchema);++export const invitationDetailsSchema = z+ .object({+ valid: z.boolean().openapi({+ description: "True only when the invitation can still be accepted.",+ }),+ invitation: z+ .object({+ id: z.string(),+ email: z.string(),+ workspaceName: z.string(),+ inviterName: z.string(),+ expiresAt: responseTimestamp,+ status: z.string(),+ expired: z.boolean(),+ })+ .optional()+ .openapi({+ description:+ "Omitted when the invitation does not exist, was already accepted, or was canceled -- the details are withheld rather than leaked.",+ }),+ error: z.string().optional().openapi({+ description: "Why the invitation is unusable, when valid is false.",+ }),+ })+ .openapi("InvitationDetails");diff --git a/apps/api/src/invitation/schema.ts b/apps/api/src/invitation/schema.tsnew file mode 100644index 000000000..a24b630d4--- /dev/null+++ b/apps/api/src/invitation/schema.ts@@ -0,0 +1,3 @@+import { z } from "../openapi";++export const invitationParam = z.object({ id: z.string() });diff --git a/apps/api/src/label/index.ts b/apps/api/src/label/index.tsindex 331d6e974..f3dfc5a4a 100644--- a/apps/api/src/label/index.ts+++ b/apps/api/src/label/index.ts@@ -1,7 +1,9 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";-import { labelSchema } from "../schemas";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import assignLabelToTask from "./controllers/assign-label-to-task";@@ -12,222 +14,239 @@ import getLabelsByTaskId from "./controllers/get-labels-by-task-id";import getLabelsByWorkspaceId from "./controllers/get-labels-by-workspace-id";import unassignLabelFromTask from "./controllers/unassign-label-from-task";import updateLabel from "./controllers/update-label";+import { labelListSchema, labelSchema } from "./response";+import {+ attachLabelBody,+ createLabelBody,+ labelParam,+ taskIdParam,+ updateLabelBody,+ workspaceIdParam,+} from "./schema";-const label = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/task/:taskId",- describeRoute({- operationId: "getTaskLabels",- tags: ["Labels"],- description: "Get all labels assigned to a specific task",- responses: {- 200: {- description: "List of labels for the task",- content: {- "application/json": { schema: resolver(v.array(labelSchema)) },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),- workspaceAccess.fromTaskId(),- async (c) => {- const { taskId } = c.req.valid("param");- const labels = await getLabelsByTaskId(taskId);- return c.json(labels);- },- )- .get(- "/workspace/:workspaceId",- describeRoute({- operationId: "getWorkspaceLabels",- tags: ["Labels"],- description: "Get all labels for a specific workspace",- responses: {- 200: {- description: "List of labels in the workspace",- content: {- "application/json": { schema: resolver(v.array(labelSchema)) },- },- },- },- }),- validator("param", v.object({ workspaceId: v.string() })),- workspaceAccess.fromParam(),- async (c) => {- const { workspaceId } = c.req.valid("param");- const labels = await getLabelsByWorkspaceId(workspaceId);- return c.json(labels);- },- )- .post(- "/",- describeRoute({- operationId: "createLabel",- tags: ["Labels"],- description: "Create a new label in a workspace",- responses: {- 200: {- description: "Label created successfully",- content: {- "application/json": { schema: resolver(labelSchema) },- },- },- },- }),- validator(- "json",- v.object({- name: v.string(),- color: v.string(),- workspaceId: v.string(),- taskId: v.optional(v.string()),- }),+const getTaskLabelsRoute = createRoute({+ method: "get",+ operationId: "getTaskLabels",+ path: "/task/{taskId}",+ tags: ["Labels"],+ summary: "Get task labels",+ description: "Get all labels assigned to a specific task",+ middleware: [workspaceAccess.fromTaskId()] as const,+ request: { params: taskIdParam },+ responses: {+ 200: jsonResponse("List of labels for the task", labelListSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",),+ 403: errorResponse("No access to the task's workspace"),+ },+});++const getWorkspaceLabelsRoute = createRoute({+ method: "get",+ operationId: "getWorkspaceLabels",+ path: "/workspace/{workspaceId}",+ tags: ["Labels"],+ summary: "Get workspace labels",+ description: "Get all labels for a specific workspace",+ middleware: [workspaceAccess.fromParam()] as const,+ request: { params: workspaceIdParam },+ responses: {+ 200: jsonResponse("List of labels in the workspace", labelListSchema),+ 400: errorResponse("Workspace ID could not be determined"),+ 403: errorResponse("No access to the workspace"),+ },+});++const createLabelRoute = createRoute({+ method: "post",+ operationId: "createLabel",+ path: "/",+ tags: ["Labels"],+ summary: "Create label",+ description: "Create a new label in a workspace",+ middleware: [workspaceAccess.fromBody(),requireWorkspacePermission({ label: ["create"] }),- async (c) => {- const { name, color, workspaceId, taskId } = c.req.valid("json");- const userId = c.get("userId");- const label = await createLabel(name, color, taskId, workspaceId, userId);- return c.json(label);- },- )- .get(- "/:id",- describeRoute({- operationId: "getLabel",- tags: ["Labels"],- description: "Get a specific label by ID",- responses: {- 200: {- description: "Label details",- content: {- "application/json": { schema: resolver(labelSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- workspaceAccess.fromLabel(),- async (c) => {- const { id } = c.req.valid("param");- const label = await getLabel(id);- return c.json(label);+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createLabelBody } },},- )- .put(- "/:id/task",- describeRoute({- operationId: "attachLabelToTask",- tags: ["Labels"],- description: "Attach an existing label to a task",- responses: {- 200: {- description: "Label attached to task successfully",- content: {- "application/json": { schema: resolver(labelSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ taskId: v.string() })),+ },+ responses: {+ 200: jsonResponse("Label created successfully", labelSchema),+ 400: errorResponse("Invalid body, or workspace ID could not be determined"),+ 403: errorResponse(+ "No workspace access, or missing label:create permission",+ ),+ 404: errorResponse("Task not found"),+ },+});++const getLabelRoute = createRoute({+ method: "get",+ operationId: "getLabel",+ path: "/{id}",+ tags: ["Labels"],+ summary: "Get label",+ description: "Get a specific label by ID",+ middleware: [workspaceAccess.fromLabel()] as const,+ request: { params: labelParam },+ responses: {+ 200: jsonResponse("Label details", labelSchema),+ 400: errorResponse(+ "Unknown label, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the label's workspace"),+ },+});++const attachLabelToTaskRoute = createRoute({+ method: "put",+ operationId: "attachLabelToTask",+ path: "/{id}/task",+ tags: ["Labels"],+ summary: "Attach label to task",+ description: "Attach an existing label to a task",+ middleware: [workspaceAccess.fromLabel(),requireWorkspacePermission({ label: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const { taskId } = c.req.valid("json");- const userId = c.get("userId");- const label = await assignLabelToTask(id, taskId, userId);- return c.json(label);+ ] as const,+ request: {+ params: labelParam,+ body: {+ required: true,+ content: { "application/json": { schema: attachLabelBody } },},- )- .delete(- "/:id/task",- describeRoute({- operationId: "detachLabelFromTask",- tags: ["Labels"],- description: "Detach a label from its current task",- responses: {- 200: {- description: "Label detached from task successfully",- content: {- "application/json": { schema: resolver(labelSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("Label attached to task successfully", labelSchema),+ 400: errorResponse(+ "Unknown label, or label and task belong to different workspaces",+ ),+ 403: errorResponse(+ "No workspace access, or missing label:update permission",+ ),+ 404: errorResponse("Task not found"),+ },+});++const detachLabelFromTaskRoute = createRoute({+ method: "delete",+ operationId: "detachLabelFromTask",+ path: "/{id}/task",+ tags: ["Labels"],+ summary: "Detach label from task",+ description: "Detach a label from its current task",+ middleware: [workspaceAccess.fromLabel(),requireWorkspacePermission({ label: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const userId = c.get("userId");- const label = await unassignLabelFromTask(id, userId);- return c.json(label);- },- )- .put(- "/:id",- describeRoute({- operationId: "updateLabel",- tags: ["Labels"],- description: "Update an existing label",- responses: {- 200: {- description: "Label updated successfully",- content: {- "application/json": { schema: resolver(labelSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- name: v.string(),- color: v.string(),- }),+ ] as const,+ request: { params: labelParam },+ responses: {+ 200: jsonResponse("Label detached from task successfully", labelSchema),+ 400: errorResponse("Unknown label, or label is not assigned to a task"),+ 403: errorResponse(+ "No workspace access, or missing label:update permission",),+ 404: errorResponse("Task not found"),+ },+});++const updateLabelRoute = createRoute({+ method: "put",+ operationId: "updateLabel",+ path: "/{id}",+ tags: ["Labels"],+ summary: "Update label",+ description: "Update an existing label",+ middleware: [workspaceAccess.fromLabel(),requireWorkspacePermission({ label: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const { name, color } = c.req.valid("json");- const label = await updateLabel(id, name, color);- return c.json(label);+ ] as const,+ request: {+ params: labelParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateLabelBody } },},- )- .delete(- "/:id",- describeRoute({- operationId: "deleteLabel",- tags: ["Labels"],- description: "Delete a label by ID",- responses: {- 200: {- description: "Label deleted successfully",- content: {- "application/json": { schema: resolver(labelSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("Label updated successfully", labelSchema),+ 400: errorResponse("Invalid body, or unknown label"),+ 403: errorResponse(+ "No workspace access, or missing label:update permission",+ ),+ },+});++const deleteLabelRoute = createRoute({+ method: "delete",+ operationId: "deleteLabel",+ path: "/{id}",+ tags: ["Labels"],+ summary: "Delete label",+ description: "Delete a label by ID",+ middleware: [workspaceAccess.fromLabel(),requireWorkspacePermission({ label: ["delete"] }),- async (c) => {- const { id } = c.req.valid("param");- const userId = c.get("userId");- const label = await deleteLabel(id, userId);- return c.json(label);- },- );+ ] as const,+ request: { params: labelParam },+ responses: {+ 200: jsonResponse("Label deleted successfully", labelSchema),+ 400: errorResponse(+ "Unknown label, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing label:delete permission",+ ),+ 404: errorResponse("The label's task no longer exists"),+ },+});++const label = apiRouter()+ .openapi(getTaskLabelsRoute, async (c) => {+ const { taskId } = c.req.valid("param");+ return c.json(await getLabelsByTaskId(taskId), 200);+ })+ .openapi(getWorkspaceLabelsRoute, async (c) => {+ const { workspaceId } = c.req.valid("param");+ return c.json(await getLabelsByWorkspaceId(workspaceId), 200);+ })+ .openapi(createLabelRoute, async (c) => {+ const { name, color, workspaceId, taskId } = c.req.valid("json");+ const userId = c.get("userId");+ return c.json(+ await createLabel(name, color, taskId, workspaceId, userId),+ 200,+ );+ })+ .openapi(getLabelRoute, async (c) => {+ const { id } = c.req.valid("param");+ return c.json(await getLabel(id), 200);+ })+ .openapi(attachLabelToTaskRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { taskId } = c.req.valid("json");+ const userId = c.get("userId");+ return c.json(await assignLabelToTask(id, taskId, userId), 200);+ })+ .openapi(detachLabelFromTaskRoute, async (c) => {+ const { id } = c.req.valid("param");+ const userId = c.get("userId");+ return c.json(await unassignLabelFromTask(id, userId), 200);+ })+ .openapi(updateLabelRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { name, color } = c.req.valid("json");+ return c.json(await updateLabel(id, name, color), 200);+ })+ .openapi(deleteLabelRoute, async (c) => {+ const { id } = c.req.valid("param");+ const userId = c.get("userId");+ return c.json(await deleteLabel(id, userId), 200);+ });export default label;diff --git a/apps/api/src/label/response.ts b/apps/api/src/label/response.tsnew file mode 100644index 000000000..f8c87f1d3--- /dev/null+++ b/apps/api/src/label/response.ts@@ -0,0 +1,15 @@+import { responseTimestamp, z } from "../openapi";++export const labelSchema = z+ .object({+ id: z.string(),+ name: z.string(),+ color: z.string(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ taskId: z.string().nullable(),+ workspaceId: z.string().nullable(),+ })+ .openapi("Label");++export const labelListSchema = z.array(labelSchema);diff --git a/apps/api/src/label/schema.ts b/apps/api/src/label/schema.tsnew file mode 100644index 000000000..8ef68837e--- /dev/null+++ b/apps/api/src/label/schema.ts@@ -0,0 +1,21 @@+import { z } from "../openapi";++export const labelParam = z.object({ id: z.string() });++export const taskIdParam = z.object({ taskId: z.string() });++export const workspaceIdParam = z.object({ workspaceId: z.string() });++export const createLabelBody = z.object({+ name: z.string(),+ color: z.string(),+ workspaceId: z.string(),+ taskId: z.string().optional(),+});++export const updateLabelBody = z.object({+ name: z.string(),+ color: z.string(),+});++export const attachLabelBody = z.object({ taskId: z.string() });diff --git a/apps/api/src/mcp/controllers/oauth-consent.ts b/apps/api/src/mcp/controllers/oauth-consent.tsindex c9c51910a..310746428 100644--- a/apps/api/src/mcp/controllers/oauth-consent.ts+++ b/apps/api/src/mcp/controllers/oauth-consent.ts@@ -1,7 +1,7 @@import { HTTPException } from "hono/http-exception";-import type * as v from "valibot";import { auth } from "../../auth";import { publishEvent } from "../../events";+import type { z } from "../../openapi";import {consumeAuthorizationRequest,createAuthCode,@@ -18,11 +18,9 @@ import type {const clientUrl = process.env.KANEO_CLIENT_URL || "http://localhost:5173";-type ClientRegistrationInput = v.InferOutput<typeof clientRegistrationSchema>;-type AuthorizationInput = v.InferOutput<typeof authorizationQuerySchema>;-type AuthorizationDecisionInput = v.InferOutput<- typeof authorizationDecisionSchema->;+type ClientRegistrationInput = z.infer<typeof clientRegistrationSchema>;+type AuthorizationInput = z.infer<typeof authorizationQuerySchema>;+type AuthorizationDecisionInput = z.infer<typeof authorizationDecisionSchema>;type OAuthErrorStatus = 400 | 401 | 403 | 404;diff --git a/apps/api/src/mcp/index.ts b/apps/api/src/mcp/index.tsindex 897be3aa6..d8728624a 100644--- a/apps/api/src/mcp/index.ts+++ b/apps/api/src/mcp/index.ts@@ -6,8 +6,8 @@ import {isLegacyRequest,} from "@modelcontextprotocol/server";import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";import { auth } from "../auth";+import { apiRouter, createRoute, jsonResponse } from "../openapi";import {beginMcpAuthorization,decideMcpAuthorizationRequest,@@ -70,148 +70,183 @@ async function validateBearerToken(return { userId: session.user.id, token };}-const mcp = new Hono();--mcp.post(- "/mcp/register",- describeRoute({- operationId: "registerMcpOAuthClient",- tags: ["MCP"],- description: "Register a public OAuth client for the MCP endpoint",- security: [],- responses: {- 200: {- description: "Registered OAuth client",- content: {- "application/json": {- schema: resolver(clientRegistrationResponseSchema),- },- },- },- 400: {- description: "Invalid client metadata",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },+const mcp = apiRouter();++const jsonError = (description: string) =>+ jsonResponse(description, oauthErrorSchema);++const registerRoute = createRoute({+ method: "post",+ operationId: "registerMcpOAuthClient",+ path: "/mcp/register",+ tags: ["MCP"],+ summary: "Register MCP OAuth client",+ description:+ "Dynamically register a public OAuth client for the MCP endpoint. Public clients hold no secret, so authorization is protected by PKCE and an explicit consent step.",+ security: [],+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: clientRegistrationSchema } },},- }),- validator("json", clientRegistrationSchema),- async (c) => c.json(await registerMcpClient(c.req.valid("json"))),-);+ },+ responses: {+ 200: jsonResponse(+ "Registered OAuth client",+ clientRegistrationResponseSchema,+ ),+ 400: jsonError("Invalid client metadata"),+ },+});-mcp.get(- "/mcp/authorize",- describeRoute({- operationId: "authorizeMcpOAuthClient",- tags: ["MCP"],- description: "Start an explicit MCP OAuth consent request",- security: [],- responses: {- 302: { description: "Redirect to the Kaneo consent page" },- 400: {- description: "Invalid authorization request",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },- },- }),- validator("query", authorizationQuerySchema),- async (c) => c.redirect(await beginMcpAuthorization(c.req.valid("query"))),-);+const authorizeRoute = createRoute({+ method: "get",+ operationId: "authorizeMcpOAuthClient",+ path: "/mcp/authorize",+ tags: ["MCP"],+ summary: "Start MCP authorization",+ description:+ "Begin an MCP OAuth authorization. Redirects the browser to the Kaneo consent page, which then approves or denies the request.",+ security: [],+ request: { query: authorizationQuerySchema },+ responses: {+ 302: { description: "Redirect to the Kaneo consent page" },+ 400: jsonError("Invalid authorization request"),+ },+});-mcp.get(- "/mcp/authorize/request/:requestId",- describeRoute({- operationId: "getMcpAuthorizationRequest",- tags: ["MCP"],- description: "Get display details for an MCP OAuth consent request",- security: [],- responses: {- 200: {- description: "Authorization request details",- content: {- "application/json": {- schema: resolver(authorizationRequestResponseSchema),- },- },- },- 400: {- description: "Invalid OAuth client",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },- 404: {- description: "Unknown or expired authorization request",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },- },- }),- validator("param", authorizationRequestParamSchema),- async (c) => {- const { requestId } = c.req.valid("param");- return c.json(await getMcpAuthorizationRequest(requestId));+const getAuthorizationRequestRoute = createRoute({+ method: "get",+ operationId: "getMcpAuthorizationRequest",+ path: "/mcp/authorize/request/{requestId}",+ tags: ["MCP"],+ summary: "Get consent request",+ description:+ "Get the client name and redirect URI for a pending consent request, so the consent page can show who is asking.",+ security: [],+ request: { params: authorizationRequestParamSchema },+ responses: {+ 200: jsonResponse(+ "Authorization request details",+ authorizationRequestResponseSchema,+ ),+ 400: jsonError("Invalid OAuth client"),+ 404: jsonError("Unknown or expired authorization request"),},-);+});-mcp.post(- "/mcp/authorize/request/:requestId",- describeRoute({- operationId: "decideMcpAuthorizationRequest",- tags: ["MCP"],- description: "Approve or deny an MCP OAuth consent request",- responses: {- 200: {- description: "OAuth client redirect",- content: {- "application/json": {- schema: resolver(authorizationDecisionResponseSchema),- },- },- },- 400: {- description: "Invalid request or OAuth client",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },- 401: {- description: "Authentication required",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },- 403: {- description: "Untrusted request origin",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },- 404: {- description: "Unknown or expired authorization request",- content: {- "application/json": { schema: resolver(oauthErrorSchema) },- },- },+const decideAuthorizationRequestRoute = createRoute({+ method: "post",+ operationId: "decideMcpAuthorizationRequest",+ path: "/mcp/authorize/request/{requestId}",+ tags: ["MCP"],+ summary: "Decide consent request",+ description:+ "Approve or deny a pending consent request and get the URL to send the browser back to.",+ request: {+ params: authorizationRequestParamSchema,+ body: {+ required: true,+ content: { "application/json": { schema: authorizationDecisionSchema } },},- }),- validator("param", authorizationRequestParamSchema),- validator("json", authorizationDecisionSchema),- async (c) => {- const { requestId } = c.req.valid("param");+ },+ responses: {+ 200: jsonResponse(+ "OAuth client redirect",+ authorizationDecisionResponseSchema,+ ),+ 400: jsonError("Invalid request or OAuth client"),+ 401: jsonError("Authentication required"),+ 403: jsonError("Untrusted request origin"),+ 404: jsonError("Unknown or expired authorization request"),+ },+});++mcp+ .openapi(registerRoute, async (c) =>+ c.json(await registerMcpClient(c.req.valid("json")), 200),+ )+ .openapi(authorizeRoute, async (c) =>+ c.redirect(await beginMcpAuthorization(c.req.valid("query"))),+ )+ .openapi(getAuthorizationRequestRoute, async (c) =>+ c.json(+ await getMcpAuthorizationRequest(c.req.valid("param").requestId),+ 200,+ ),+ )+ .openapi(decideAuthorizationRequestRoute, async (c) => {const redirect = await decideMcpAuthorizationRequest({- requestId,+ requestId: c.req.valid("param").requestId,decision: c.req.valid("json"),headers: c.req.raw.headers,origin: c.req.header("origin"),});- return c.json({ redirect });- },-);+ return c.json({ redirect }, 200);+ });++mcp.all("/mcp", async (c) => {+ const authResult = await validateBearerToken(c.req.raw);+ if (!authResult) {+ const prmUrl = `${publicApiUrl}/api/.well-known/oauth-protected-resource/api/mcp`;+ c.header("WWW-Authenticate", `Bearer resource_metadata="${prmUrl}"`);+ return c.json(+ {+ error: "invalid_token",+ error_description: "Missing or invalid token",+ },+ 401,+ );+ }++ const sessionId = c.req.header("mcp-session-id");++ if (sessionId) {+ const existing = sessions.get(sessionId);+ // A mismatched owner is reported as missing rather than forbidden so the+ // response cannot confirm that someone else's session id is valid.+ if (existing && existing.userId === authResult.userId) {+ return existing.transport.handleRequest(c.req.raw);+ }+ return c.json({ error: "Session not found" }, 404);+ }++ if (c.req.method !== "POST") {+ return c.json({ error: "Method not allowed" }, 405);+ }++ if (!isJsonContentType(c.req.header("content-type"))) {+ return c.json({ error: "Unsupported Media Type" }, 415);+ }++ if (!(await isLegacyRequest(c.req.raw.clone()))) {+ const modern = createModernMcpHandler(authResult.token, internalApiUrl);+ return modern.fetch(c.req.raw);+ }++ const transport = new WebStandardStreamableHTTPServerTransport({+ sessionIdGenerator: () => randomUUID(),+ });++ transport.onclose = () => {+ if (transport.sessionId) {+ sessions.delete(transport.sessionId);+ }+ };++ const server = createMcpServerForUser(authResult.token);+ await server.connect(transport);+ const response = await transport.handleRequest(c.req.raw);++ if (transport.sessionId) {+ sessions.set(transport.sessionId, {+ transport,+ userId: authResult.userId,+ });+ }++ return response;+});mcp.post("/mcp/token", async (c) => {const contentType = c.req.header("content-type") || "";diff --git a/apps/api/src/mcp/schemas.ts b/apps/api/src/mcp/schemas.tsindex e8b70ac03..f5e7ae538 100644--- a/apps/api/src/mcp/schemas.ts+++ b/apps/api/src/mcp/schemas.ts@@ -1,5 +1,9 @@-import * as v from "valibot";+import { z } from "../openapi";+// Redirect URIs are attacker-supplied during dynamic client registration, so+// anything that could turn into script execution or credential leakage is+// rejected: fragments, embedded credentials, and script-bearing schemes.+// Plain http is allowed only for loopback, per OAuth 2.1 for native apps.function isValidRedirectUri(value: string): boolean {try {const url = new URL(value);@@ -18,56 +22,63 @@ function isValidRedirectUri(value: string): boolean {}}-const redirectUriSchema = v.pipe(- v.string(),- v.maxLength(2048),- v.check(isValidRedirectUri, "Invalid redirect URI"),-);+const redirectUriSchema = z+ .string()+ .max(2048)+ .refine(isValidRedirectUri, "Invalid redirect URI");-export const clientRegistrationSchema = v.object({- redirect_uris: v.pipe(v.array(redirectUriSchema), v.minLength(1)),- client_name: v.optional(v.pipe(v.string(), v.maxLength(100))),- token_endpoint_auth_method: v.optional(v.literal("none")),- grant_types: v.optional(v.tuple([v.literal("authorization_code")])),- response_types: v.optional(v.tuple([v.literal("code")])),+export const clientRegistrationSchema = z.object({+ redirect_uris: z.array(redirectUriSchema).min(1),+ client_name: z.string().max(100).optional(),+ token_endpoint_auth_method: z.literal("none").optional(),+ grant_types: z.tuple([z.literal("authorization_code")]).optional(),+ response_types: z.tuple([z.literal("code")]).optional(),});-export const authorizationQuerySchema = v.object({- response_type: v.literal("code"),- client_id: v.string(),+export const authorizationQuerySchema = z.object({+ response_type: z.literal("code"),+ client_id: z.string(),redirect_uri: redirectUriSchema,- code_challenge: v.pipe(v.string(), v.minLength(1)),- code_challenge_method: v.literal("S256"),- state: v.optional(v.string()),+ code_challenge: z.string().min(1).openapi({+ description: "PKCE challenge; only S256 is accepted.",+ }),+ code_challenge_method: z.literal("S256"),+ state: z.string().optional(),});-export const authorizationRequestParamSchema = v.object({- requestId: v.string(),+export const authorizationRequestParamSchema = z.object({+ requestId: z.string(),});-export const authorizationDecisionSchema = v.object({- approved: v.boolean(),+export const authorizationDecisionSchema = z.object({+ approved: z.boolean(),});-export const oauthErrorSchema = v.object({- error: v.string(),-});+export const oauthErrorSchema = z+ .object({ error: z.string() })+ .openapi("OAuthError");-export const clientRegistrationResponseSchema = v.object({- client_id: v.string(),- client_id_issued_at: v.number(),- redirect_uris: v.array(v.string()),- client_name: v.optional(v.string()),- token_endpoint_auth_method: v.literal("none"),- grant_types: v.array(v.literal("authorization_code")),- response_types: v.array(v.literal("code")),-});+export const clientRegistrationResponseSchema = z+ .object({+ client_id: z.string(),+ client_id_issued_at: z.number(),+ redirect_uris: z.array(z.string()),+ client_name: z.string().optional(),+ token_endpoint_auth_method: z.literal("none"),+ grant_types: z.array(z.literal("authorization_code")),+ response_types: z.array(z.literal("code")),+ })+ .openapi("McpClientRegistration");-export const authorizationRequestResponseSchema = v.object({- client_name: v.string(),- redirect_uri: v.string(),-});+export const authorizationRequestResponseSchema = z+ .object({ client_name: z.string(), redirect_uri: z.string() })+ .openapi("McpAuthorizationRequest");-export const authorizationDecisionResponseSchema = v.object({- redirect: v.string(),-});+export const authorizationDecisionResponseSchema = z+ .object({+ redirect: z.string().openapi({+ description:+ "Where to send the browser next: back to the client with a code on approval, or with an error on denial.",+ }),+ })+ .openapi("McpAuthorizationDecision");diff --git a/apps/api/src/notification-preferences/index.ts b/apps/api/src/notification-preferences/index.tsindex b3c49563d..249e7d9e6 100644--- a/apps/api/src/notification-preferences/index.ts+++ b/apps/api/src/notification-preferences/index.ts@@ -1,7 +1,15 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";-import { notificationPreferenceSchema } from "../schemas";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";+import { notificationPreferenceSchema } from "./response";+import {+ updatePreferencesBody,+ upsertWorkspaceRuleBody,+ workspaceIdParam,+} from "./schema";import {deleteWorkspaceRule,getNotificationPreferences,@@ -9,236 +17,122 @@ import {upsertWorkspaceRule,} from "./service";-const httpErrorSchema = v.object({ message: v.string() });+// Every route returns the full preference document, so a client never has to+// re-fetch after a write.+const preferencesResponse = (description: string) =>+ jsonResponse(description, notificationPreferenceSchema);-const workspaceRuleSchema = v.object({- isActive: v.boolean(),- emailEnabled: v.boolean(),- ntfyEnabled: v.boolean(),- gotifyEnabled: v.boolean(),- webhookEnabled: v.boolean(),- projectMode: v.picklist(["all", "selected"] as const),- selectedProjectIds: v.optional(v.array(v.string())),+const getPreferencesRoute = createRoute({+ method: "get",+ operationId: "getNotificationPreferences",+ path: "/",+ tags: ["Notification Preferences"],+ summary: "Get notification preferences",+ description:+ "Get how the current user is notified, globally and per workspace. Configured secrets are reported as booleans plus a masked preview, never in full.",+ responses: {+ 200: preferencesResponse("Notification preferences"),+ },});-const notificationPreferences = new Hono<{- Variables: {- userId: string;- userEmail: string;- };-}>();+const updatePreferencesRoute = createRoute({+ method: "put",+ operationId: "updateNotificationPreferences",+ path: "/",+ tags: ["Notification Preferences"],+ summary: "Update notification preferences",+ description:+ "Update the global delivery settings. Omitted fields are left unchanged; a secret sent as null is cleared.",+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: updatePreferencesBody } },+ },+ },+ responses: {+ 200: preferencesResponse("The updated preferences"),+ 400: errorResponse("Invalid request"),+ },+});-notificationPreferences- .get(- "/",- describeRoute({- operationId: "getNotificationPreferences",- tags: ["Notification Preferences"],- description: "Get notification delivery preferences for the current user",- responses: {- 200: {- description: "Notification preferences",- content: {- "application/json": {- schema: resolver(notificationPreferenceSchema),- },- },- },- 400: {- description: "Validation error",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 401: {- description: "Unauthorized",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 403: {- description: "Forbidden",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- },- }),- async (c) => {- const userId = c.get("userId");- const userEmail = c.get("userEmail");- return c.json(- await getNotificationPreferences(userId, userEmail || null),- );+const upsertWorkspaceRuleRoute = createRoute({+ method: "put",+ operationId: "upsertNotificationPreferenceWorkspaceRule",+ path: "/workspaces/{workspaceId}",+ tags: ["Notification Preferences"],+ summary: "Upsert workspace rule",+ description:+ "Create or replace the notification rule for one workspace, overriding the global settings there.",+ request: {+ params: workspaceIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: upsertWorkspaceRuleBody } },},+ },+ responses: {+ 200: preferencesResponse("The updated preferences"),+ 400: errorResponse("Invalid request"),+ 403: errorResponse("No access to the workspace"),+ },+});++const deleteWorkspaceRuleRoute = createRoute({+ method: "delete",+ operationId: "deleteNotificationPreferenceWorkspaceRule",+ path: "/workspaces/{workspaceId}",+ tags: ["Notification Preferences"],+ summary: "Delete workspace rule",+ description:+ "Remove a workspace's rule so the workspace falls back to the global settings.",+ request: { params: workspaceIdParam },+ responses: {+ 200: preferencesResponse("The updated preferences"),+ 403: errorResponse("No access to the workspace"),+ 404: errorResponse("Workspace rule not found"),+ },+});++const notificationPreferences = apiRouter()+ .openapi(getPreferencesRoute, async (c) =>+ c.json(+ await getNotificationPreferences(+ c.get("userId"),+ c.get("userEmail") || null,+ ),+ 200,+ ),)- .put(- "/",- describeRoute({- operationId: "updateNotificationPreferences",- tags: ["Notification Preferences"],- description: "Update global notification delivery preferences",- responses: {- 200: {- description: "Updated notification preferences",- content: {- "application/json": {- schema: resolver(notificationPreferenceSchema),- },- },- },- 400: {- description: "Validation error",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 401: {- description: "Unauthorized",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 403: {- description: "Forbidden",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- },- }),- validator(- "json",- v.object({- emailEnabled: v.optional(v.boolean()),- ntfyEnabled: v.optional(v.boolean()),- ntfyServerUrl: v.optional(v.nullable(v.string())),- ntfyTopic: v.optional(v.nullable(v.string())),- ntfyToken: v.optional(v.nullable(v.string())),- gotifyEnabled: v.optional(v.boolean()),- gotifyServerUrl: v.optional(v.nullable(v.string())),- gotifyToken: v.optional(v.nullable(v.string())),- webhookEnabled: v.optional(v.boolean()),- webhookUrl: v.optional(v.nullable(v.string())),- webhookSecret: v.optional(v.nullable(v.string())),- taskAssignmentEnabled: v.optional(v.boolean()),- taskCommentEnabled: v.optional(v.boolean()),- taskStatusChangeEnabled: v.optional(v.boolean()),- dueDateReminderEnabled: v.optional(v.boolean()),- dueDateReminderLeadTimeMinutes: v.optional(- v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),- ),- }),+ .openapi(updatePreferencesRoute, async (c) =>+ c.json(+ await updateNotificationPreferences(+ c.get("userId"),+ c.get("userEmail") || null,+ c.req.valid("json"),+ ),+ 200,),- async (c) => {- const userId = c.get("userId");- const userEmail = c.get("userEmail");- const body = c.req.valid("json");-- return c.json(- await updateNotificationPreferences(userId, userEmail || null, body),- );- },)- .put(- "/workspaces/:workspaceId",- describeRoute({- operationId: "upsertNotificationPreferenceWorkspaceRule",- tags: ["Notification Preferences"],- description: "Create or update a workspace notification rule",- responses: {- 200: {- description: "Updated notification preferences",- content: {- "application/json": {- schema: resolver(notificationPreferenceSchema),- },- },- },- 400: {- description: "Validation error",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 401: {- description: "Unauthorized",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 403: {- description: "Forbidden",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- },- }),- validator("param", v.object({ workspaceId: v.string() })),- validator("json", workspaceRuleSchema),- async (c) => {- const userId = c.get("userId");- const userEmail = c.get("userEmail");- const { workspaceId } = c.req.valid("param");- const body = c.req.valid("json");-- return c.json(- await upsertWorkspaceRule(userId, workspaceId, userEmail || null, body),- );- },+ .openapi(upsertWorkspaceRuleRoute, async (c) =>+ c.json(+ await upsertWorkspaceRule(+ c.get("userId"),+ c.req.valid("param").workspaceId,+ c.get("userEmail") || null,+ c.req.valid("json"),+ ),+ 200,+ ),)- .delete(- "/workspaces/:workspaceId",- describeRoute({- operationId: "deleteNotificationPreferenceWorkspaceRule",- tags: ["Notification Preferences"],- description: "Delete a workspace notification rule",- responses: {- 200: {- description: "Updated notification preferences",- content: {- "application/json": {- schema: resolver(notificationPreferenceSchema),- },- },- },- 400: {- description: "Validation error",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 401: {- description: "Unauthorized",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 403: {- description: "Forbidden",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 404: {- description: "Workspace rule not found",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- },- }),- validator("param", v.object({ workspaceId: v.string() })),- async (c) => {- const userId = c.get("userId");- const userEmail = c.get("userEmail");- const { workspaceId } = c.req.valid("param");-- return c.json(- await deleteWorkspaceRule(userId, workspaceId, userEmail || null),- );- },+ .openapi(deleteWorkspaceRuleRoute, async (c) =>+ c.json(+ await deleteWorkspaceRule(+ c.get("userId"),+ c.req.valid("param").workspaceId,+ c.get("userEmail") || null,+ ),+ 200,+ ),);export default notificationPreferences;diff --git a/apps/api/src/notification-preferences/response.ts b/apps/api/src/notification-preferences/response.tsnew file mode 100644index 000000000..8ce70d48f--- /dev/null+++ b/apps/api/src/notification-preferences/response.ts@@ -0,0 +1,62 @@+import { nullableResponseTimestamp, responseTimestamp, z } from "../openapi";++// Secrets are never returned. Each one is reported as a *Configured boolean+// plus a masked preview, so a client can show that a value is set without+// being able to read it.+export const workspaceRuleSchema = z+ .object({+ id: z.string(),+ workspaceId: z.string(),+ workspaceName: z.string(),+ isActive: z.boolean().openapi({+ description: "Turn all notifications for this workspace on or off.",+ }),+ emailEnabled: z.boolean(),+ ntfyEnabled: z.boolean(),+ gotifyEnabled: z.boolean(),+ webhookEnabled: z.boolean(),+ projectMode: z.enum(["all", "selected"]).openapi({+ description:+ "`all` notifies for every project in the workspace; `selected` restricts it to selectedProjectIds.",+ }),+ selectedProjectIds: z.array(z.string()),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("NotificationPreferenceWorkspaceRule");++export const notificationPreferenceSchema = z+ .object({+ emailAddress: z.string().nullable(),+ emailEnabled: z.boolean(),+ ntfyEnabled: z.boolean(),+ ntfyConfigured: z.boolean(),+ ntfyServerUrl: z.string().nullable(),+ ntfyTopic: z.string().nullable(),+ ntfyTokenConfigured: z.boolean(),+ maskedNtfyToken: z.string().nullable(),+ gotifyEnabled: z.boolean(),+ gotifyConfigured: z.boolean(),+ gotifyServerUrl: z.string().nullable(),+ gotifyTokenConfigured: z.boolean(),+ maskedGotifyToken: z.string().nullable(),+ webhookEnabled: z.boolean(),+ webhookConfigured: z.boolean(),+ webhookUrl: z.string().nullable(),+ webhookSecretConfigured: z.boolean(),+ maskedWebhookSecret: z.string().nullable(),+ taskAssignmentEnabled: z.boolean(),+ taskCommentEnabled: z.boolean(),+ taskStatusChangeEnabled: z.boolean(),+ dueDateReminderEnabled: z.boolean(),+ dueDateReminderLeadTimeMinutes: z.number().openapi({+ description: "How long before a due date the reminder fires, in minutes.",+ }),+ workspaces: z.array(workspaceRuleSchema).openapi({+ description:+ "Per-workspace overrides. A workspace with no rule follows the global settings.",+ }),+ createdAt: nullableResponseTimestamp,+ updatedAt: nullableResponseTimestamp,+ })+ .openapi("NotificationPreferences");diff --git a/apps/api/src/notification-preferences/schema.ts b/apps/api/src/notification-preferences/schema.tsnew file mode 100644index 000000000..27338146f--- /dev/null+++ b/apps/api/src/notification-preferences/schema.ts@@ -0,0 +1,42 @@+import { z } from "../openapi";++export const workspaceIdParam = z.object({ workspaceId: z.string() });++// Write-only secret fields: send a value to set it, null to clear it, omit to+// leave it untouched. They are never echoed back.+export const updatePreferencesBody = z.object({+ emailEnabled: z.boolean().optional(),+ ntfyEnabled: z.boolean().optional(),+ ntfyServerUrl: z.string().nullable().optional(),+ ntfyTopic: z.string().nullable().optional(),+ ntfyToken: z.string().nullable().optional(),+ gotifyEnabled: z.boolean().optional(),+ gotifyServerUrl: z.string().nullable().optional(),+ gotifyToken: z.string().nullable().optional(),+ webhookEnabled: z.boolean().optional(),+ webhookUrl: z.string().nullable().optional(),+ webhookSecret: z.string().nullable().optional(),+ taskAssignmentEnabled: z.boolean().optional(),+ taskCommentEnabled: z.boolean().optional(),+ taskStatusChangeEnabled: z.boolean().optional(),+ dueDateReminderEnabled: z.boolean().optional(),+ dueDateReminderLeadTimeMinutes: z+ .number()+ .int()+ .min(5)+ .max(43_200)+ .optional()+ .openapi({ description: "Between 5 minutes and 30 days." }),+});++export const upsertWorkspaceRuleBody = z.object({+ isActive: z.boolean(),+ emailEnabled: z.boolean(),+ ntfyEnabled: z.boolean(),+ gotifyEnabled: z.boolean(),+ webhookEnabled: z.boolean(),+ projectMode: z.enum(["all", "selected"]),+ selectedProjectIds: z.array(z.string()).optional().openapi({+ description: "Required in practice when projectMode is `selected`.",+ }),+});diff --git a/apps/api/src/notification/index.ts b/apps/api/src/notification/index.tsindex 51962f2a0..fad0333bb 100644--- a/apps/api/src/notification/index.ts+++ b/apps/api/src/notification/index.ts@@ -1,162 +1,134 @@import { eq } from "drizzle-orm";-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { projectTable, taskTable } from "../database/schema";import { subscribeToEvent } from "../events";-import { notificationSchema } from "../schemas";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import clearNotifications from "./controllers/clear-notifications";import createNotification from "./controllers/create-notification";import getNotifications from "./controllers/get-notifications";import markAllNotificationsAsRead from "./controllers/mark-all-notifications-as-read";import markAsRead from "./controllers/mark-notification-as-read";+import {+ bulkResultSchema,+ notificationListSchema,+ notificationSchema,+} from "./response";+import { createNotificationBody, notificationParam } from "./schema";-const bulkResultSchema = v.object({- success: v.boolean(),- count: v.optional(v.number()),+const listNotificationsRoute = createRoute({+ method: "get",+ operationId: "listNotifications",+ path: "/",+ tags: ["Notifications"],+ summary: "List notifications",+ description: "Get every notification for the current user, read and unread.",+ responses: {+ 200: jsonResponse("List of notifications", notificationListSchema),+ },});-const notification = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/",- describeRoute({- operationId: "listNotifications",- tags: ["Notifications"],- description: "Get all notifications for the current user",- responses: {- 200: {- description: "List of notifications",- content: {- "application/json": {- schema: resolver(v.array(notificationSchema)),- },- },- },- },- }),- async (c) => {- const userId = c.get("userId");- const notifications = await getNotifications(userId);- return c.json(notifications);+const createNotificationRoute = createRoute({+ method: "post",+ operationId: "createNotification",+ path: "/",+ tags: ["Notifications"],+ summary: "Create notification",+ description:+ "Create a notification for the current user. Most notifications are raised by the server from task and workspace events; this exists for integrations. Returns null when the user has turned off this notification category in their preferences.",+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createNotificationBody } },},- )- .post(- "/",- describeRoute({- operationId: "createNotification",- tags: ["Notifications"],- description: "Create a new notification for a user",- responses: {- 200: {- description: "Notification created successfully",- content: {- "application/json": { schema: resolver(notificationSchema) },- },- },- },- }),- validator(- "json",- v.object({- title: v.optional(v.nullable(v.string())),- message: v.optional(v.nullable(v.string())),- type: v.string(),- eventData: v.optional(v.nullable(v.record(v.string(), v.unknown()))),- relatedEntityId: v.optional(v.string()),- relatedEntityType: v.optional(v.string()),- }),+ },+ responses: {+ 200: jsonResponse(+ "The created notification, or null when the user has muted this notification type",+ notificationSchema.nullable(),),- async (c) => {- const {- title,- message,- type,- eventData,- relatedEntityId,- relatedEntityType,- } = c.req.valid("json");- const userId = c.get("userId");- const notification = await createNotification({- userId,+ 400: errorResponse("Invalid request"),+ },+});++const markAsReadRoute = createRoute({+ method: "patch",+ operationId: "markNotificationAsRead",+ path: "/{id}/read",+ tags: ["Notifications"],+ summary: "Mark notification read",+ description:+ "Mark one notification as read. Scoped to the current user, so another user's notification is not found.",+ request: { params: notificationParam },+ responses: {+ 200: jsonResponse("The updated notification", notificationSchema),+ 404: errorResponse("Notification not found"),+ },+});++const markAllAsReadRoute = createRoute({+ method: "patch",+ operationId: "markAllNotificationsAsRead",+ path: "/read-all",+ tags: ["Notifications"],+ summary: "Mark all read",+ description: "Mark every notification for the current user as read.",+ responses: {+ 200: jsonResponse("All notifications marked as read", bulkResultSchema),+ },+});++const clearAllRoute = createRoute({+ method: "delete",+ operationId: "clearAllNotifications",+ path: "/clear-all",+ tags: ["Notifications"],+ summary: "Clear all",+ description:+ "Permanently delete every notification for the current user. This cannot be undone.",+ responses: {+ 200: jsonResponse("All notifications cleared", bulkResultSchema),+ },+});++const notification = apiRouter()+ .openapi(listNotificationsRoute, async (c) =>+ c.json(await getNotifications(c.get("userId")), 200),+ )+ .openapi(createNotificationRoute, async (c) => {+ const {+ title,+ message,+ type,+ eventData,+ relatedEntityId,+ relatedEntityType,+ } = c.req.valid("json");+ return c.json(+ await createNotification({+ userId: c.get("userId"),title,content: message,type,eventData,resourceId: relatedEntityId,resourceType: relatedEntityType,- });- return c.json(notification);- },- )- .patch(- "/:id/read",- describeRoute({- operationId: "markNotificationAsRead",- tags: ["Notifications"],- description: "Mark a specific notification as read",- responses: {- 200: {- description: "Notification marked as read",- content: {- "application/json": { schema: resolver(notificationSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- async (c) => {- const { id } = c.req.valid("param");- const userId = c.get("userId");- const notification = await markAsRead(id, userId);- return c.json(notification);- },+ }),+ 200,+ );+ })+ .openapi(markAsReadRoute, async (c) =>+ c.json(await markAsRead(c.req.valid("param").id, c.get("userId")), 200),)- .patch(- "/read-all",- describeRoute({- operationId: "markAllNotificationsAsRead",- tags: ["Notifications"],- description: "Mark all notifications as read for the current user",- responses: {- 200: {- description: "All notifications marked as read",- content: {- "application/json": { schema: resolver(bulkResultSchema) },- },- },- },- }),- async (c) => {- const userId = c.get("userId");- const result = await markAllNotificationsAsRead(userId);- return c.json(result);- },+ .openapi(markAllAsReadRoute, async (c) =>+ c.json(await markAllNotificationsAsRead(c.get("userId")), 200),)- .delete(- "/clear-all",- describeRoute({- operationId: "clearAllNotifications",- tags: ["Notifications"],- description: "Clear all notifications for the current user",- responses: {- 200: {- description: "All notifications cleared",- content: {- "application/json": { schema: resolver(bulkResultSchema) },- },- },- },- }),- async (c) => {- const userId = c.get("userId");- const result = await clearNotifications(userId);- return c.json(result);- },+ .openapi(clearAllRoute, async (c) =>+ c.json(await clearNotifications(c.get("userId")), 200),);subscribeToEvent<{diff --git a/apps/api/src/notification/response.ts b/apps/api/src/notification/response.tsnew file mode 100644index 000000000..0578a29df--- /dev/null+++ b/apps/api/src/notification/response.ts@@ -0,0 +1,37 @@+import { responseTimestamp, z } from "../openapi";++export const notificationSchema = z+ .object({+ id: z.string(),+ userId: z.string(),+ title: z.string().nullable(),+ content: z.string().nullable().openapi({+ description:+ "Free-text body. Null for generated notifications, whose text the client renders from type and eventData.",+ }),+ type: z.string().openapi({+ description:+ "One of: info, task_created, workspace_created, task_status_changed, task_assignee_changed, time_entry_created, due_date_reminder, task_overdue, task_mention, task_comment.",+ }),+ eventData: z.unknown().openapi({+ description:+ "Type-specific payload, e.g. { taskTitle, oldStatus, newStatus, projectId, workspaceId }.",+ }),+ isRead: z.boolean().nullable(),+ resourceId: z.string().nullable().openapi({+ description:+ "The id of the task or workspace the notification points at.",+ }),+ resourceType: z.string().nullable().openapi({+ description: "`task` or `workspace`.",+ }),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("Notification");++export const notificationListSchema = z.array(notificationSchema);++export const bulkResultSchema = z+ .object({ success: z.boolean() })+ .openapi("NotificationBulkResult");diff --git a/apps/api/src/notification/schema.ts b/apps/api/src/notification/schema.tsnew file mode 100644index 000000000..381178c11--- /dev/null+++ b/apps/api/src/notification/schema.ts@@ -0,0 +1,19 @@+import { z } from "../openapi";++export const notificationParam = z.object({ id: z.string() });++export const createNotificationBody = z.object({+ title: z.string().nullable().optional(),+ message: z.string().nullable().optional().openapi({+ description: "Stored as the notification's content.",+ }),+ type: z.string(),+ eventData: z.record(z.string(), z.unknown()).nullable().optional(),+ relatedEntityId: z.string().optional().openapi({+ description:+ "Stored as resourceId: the task or workspace being pointed at.",+ }),+ relatedEntityType: z.string().optional().openapi({+ description: "Stored as resourceType: `task` or `workspace`.",+ }),+});diff --git a/apps/api/src/oauth/index.ts b/apps/api/src/oauth/index.tsindex bec38ff18..66bda2b4d 100644--- a/apps/api/src/oauth/index.ts+++ b/apps/api/src/oauth/index.ts@@ -1,30 +1,22 @@-import { Hono } from "hono";-import { describeRoute, resolver } from "hono-openapi";-import * as v from "valibot";+import { apiRouter, createRoute, jsonResponse } from "../openapi";import getIdToken from "./controllers/get-id-token";+import { idTokenSchema } from "./response";-const oauth = new Hono<{ Variables: { userId: string } }>().get(- "/id-token",- describeRoute({- operationId: "getOAuthIdToken",- tags: ["Authentication"],- description: "Get the id_token for the current user's custom OAuth account",- responses: {- 200: {- description: "The id_token if available",- content: {- "application/json": {- schema: resolver(v.object({ idToken: v.nullable(v.string()) })),- },- },- },- },- }),- async (c) => {- const userId = c.get("userId");- const result = await getIdToken(userId);- return c.json(result);+const getIdTokenRoute = createRoute({+ method: "get",+ operationId: "getOAuthIdToken",+ path: "/id-token",+ tags: ["Authentication"],+ summary: "Get OAuth id token",+ description:+ "Get the id_token for the current user's custom OAuth account. Returns null when the user signed in another way.",+ responses: {+ 200: jsonResponse("The id_token if available", idTokenSchema),},+});++const oauth = apiRouter().openapi(getIdTokenRoute, async (c) =>+ c.json(await getIdToken(c.get("userId")), 200),);export default oauth;diff --git a/apps/api/src/oauth/response.ts b/apps/api/src/oauth/response.tsnew file mode 100644index 000000000..42253be0d--- /dev/null+++ b/apps/api/src/oauth/response.ts@@ -0,0 +1,10 @@+import { z } from "../openapi";++export const idTokenSchema = z+ .object({+ idToken: z.string().nullable().openapi({+ description:+ "The stored id_token for the user's `custom` OAuth account, or null when they have no such account.",+ }),+ })+ .openapi("OAuthIdToken");diff --git a/apps/api/src/openapi.ts b/apps/api/src/openapi.tsnew file mode 100644index 000000000..b1832374e--- /dev/null+++ b/apps/api/src/openapi.ts@@ -0,0 +1,77 @@+import { OpenAPIHono, z } from "@hono/zod-openapi";+import type { Session, User } from "better-auth/types";+import { HTTPException } from "hono/http-exception";++export { createRoute } from "@hono/zod-openapi";+export { z };++export type ApiKey = {+ id: string;+ userId: string;+ enabled: boolean;+ permissions: Record<string, string[]> | null;+};++export type BaseVariables = {+ userId: string;+ userEmail: string;+ user: User | null;+ session: Session | null;+ apiKey?: ApiKey;+};++// NOTE: routes declare auth/access middleware via createRoute({ middleware }),+// which @hono/zod-openapi registers BEFORE the request validators (index.mjs:147+// -- `this.on(method, path, ...middleware, ...validators, handler)`). The+// hono-openapi routes this replaces listed validator() first, so a malformed+// body used to be rejected before any authorization ran. Order is now+// authorize-then-validate: an unauthorized caller gets 403 instead of 400 and+// no longer learns whether their body was well-formed.+export function apiRouter<V extends BaseVariables = BaseVariables>() {+ return new OpenAPIHono<{ Variables: V }>({+ defaultHook: (result) => {+ if (!result.success) {+ const issue = result.error.issues[0];+ const field = issue?.path.join(".");+ throw new HTTPException(400, {+ message: issue+ ? `${field || "request"}: ${issue.message}`+ : "Invalid request",+ });+ }+ },+ });+}++export const responseTimestamp = z+ .date()+ .openapi({ type: "string", format: "date-time" });++export const nullableResponseTimestamp = responseTimestamp+ .nullable()+ .openapi({ type: ["string", "null"], format: "date-time" });++// HTTPException bodies are the plain message string (Hono's default+// getResponse()), which every web fetcher reads with response.text().+//+// Declaring any non-2xx response puts it in the route's typed-response union,+// so an untagged InferResponseType<typeof client.x.$get> on the frontend widens+// from `Label` to `Label | string`. Tag the status instead --+// InferResponseType<typeof client.x.$get, 200> -- as src/types/project already+// does. Fetchers that narrow on `response.ok` before .json() are unaffected.+export function errorResponse(description: string) {+ return {+ description,+ content: { "text/plain": { schema: z.string() } },+ };+}++export function jsonResponse<T extends z.ZodType>(+ description: string,+ schema: T,+) {+ return {+ description,+ content: { "application/json": { schema } },+ };+}diff --git a/apps/api/src/project/index.ts b/apps/api/src/project/index.tsindex 3dd3c7642..d2e058834 100644--- a/apps/api/src/project/index.ts+++ b/apps/api/src/project/index.ts@@ -1,8 +1,11 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";-import { requireEntitlement } from "../billing/require-entitlement-middleware";-import { projectSchema } from "../schemas";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+ z,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import archiveProjectCtrl from "./controllers/archive-project";@@ -13,263 +16,267 @@ import getProjectsCtrl from "./controllers/get-projects";import reorderProjectsCtrl from "./controllers/reorder-projects";import unarchiveProjectCtrl from "./controllers/unarchive-project";import updateProjectCtrl from "./controllers/update-project";+import { projectListSchema, projectSchema } from "./response";+import {+ createProjectBody,+ listProjectsQuery,+ projectParam,+ reorderProjectsBody,+ updateProjectBody,+ workspaceIdQuery,+} from "./schema";-const project = new Hono<{- Variables: {- userId: string;- workspaceId: string;- };-}>()- .get(- "/",- describeRoute({- operationId: "listProjects",- tags: ["Projects"],- description: "Get all projects in a workspace",- responses: {- 200: {- description: "List of projects with statistics",- content: {- "application/json": { schema: resolver(v.array(projectSchema)) },- },- },- },- }),- validator(- "query",- v.object({- workspaceId: v.string(),- includeArchived: v.optional(v.string()),- }),- ),- workspaceAccess.fromQuery(),- async (c) => {- const workspaceId = c.get("workspaceId");- const { includeArchived } = c.req.valid("query");- const projects = await getProjectsCtrl(- workspaceId,- includeArchived === "true",- );- return c.json(projects);- },- )- .post(- "/",- describeRoute({- operationId: "createProject",- tags: ["Projects"],- description: "Create a new project in a workspace",- responses: {- 200: {- description: "Project created successfully",- content: {- "application/json": { schema: resolver(projectSchema) },- },- },- },- }),- validator(- "json",- v.object({- name: v.string(),- workspaceId: v.string(),- icon: v.string(),- slug: v.string(),- }),- ),+const listProjectsRoute = createRoute({+ method: "get",+ operationId: "listProjects",+ path: "/",+ tags: ["Projects"],+ summary: "List projects",+ description:+ "List a workspace's projects in sidebar order, each with rollup task statistics. Archived projects are excluded unless includeArchived is set.",+ middleware: [workspaceAccess.fromQuery()] as const,+ request: { query: listProjectsQuery },+ responses: {+ 200: jsonResponse("List of projects", projectListSchema),+ 400: errorResponse("Workspace ID could not be determined"),+ 403: errorResponse("No access to the workspace"),+ },+});++const createProjectRoute = createRoute({+ method: "post",+ operationId: "createProject",+ path: "/",+ tags: ["Projects"],+ summary: "Create project",+ description:+ "Create a project in a workspace. The slug becomes the prefix of its task identifiers.",+ middleware: [workspaceAccess.fromBody(),requireWorkspacePermission({ project: ["create"] }),- requireEntitlement,- async (c) => {- const { name, icon, slug } = c.req.valid("json");- const workspaceId = c.get("workspaceId");- const newProject = await createProjectCtrl(workspaceId, name, icon, slug);- return c.json(newProject);- },- )- .get(- "/:id",- describeRoute({- operationId: "getProject",- tags: ["Projects"],- description: "Get a specific project by ID",- responses: {- 200: {- description: "Project details",- content: {- "application/json": { schema: resolver(projectSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- workspaceAccess.fromProject(),- async (c) => {- const { id } = c.req.valid("param");- const workspaceId = c.get("workspaceId");- const projectData = await getProjectCtrl(id, workspaceId);- return c.json(projectData);+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createProjectBody } },},- )- .put(- "/reorder",- describeRoute({- operationId: "reorderProjects",- tags: ["Projects"],- description: "Reorder projects in a workspace",- responses: {- 200: {- description: "Projects reordered successfully",- content: {- "application/json": { schema: resolver(v.array(projectSchema)) },- },- },- },- }),- validator("query", v.object({ workspaceId: v.string() })),- validator(- "json",- v.object({- // Positions express a relative order only; the controller renumbers- // the workspace to 0..n-1, so the values just have to be sane.- projects: v.pipe(- v.array(- v.object({- id: v.string(),- position: v.pipe(v.number(), v.integer(), v.minValue(0)),- }),- ),- v.minLength(1),- ),- }),+ },+ responses: {+ 200: jsonResponse("The created project", projectSchema),+ 400: errorResponse("Invalid body, or workspace ID could not be determined"),+ 403: errorResponse(+ "No workspace access, or missing project:create permission",),+ },+});++const getProjectRoute = createRoute({+ method: "get",+ operationId: "getProject",+ path: "/{id}",+ tags: ["Projects"],+ summary: "Get project",+ description: "Get a single project by ID.",+ middleware: [workspaceAccess.fromProject()] as const,+ request: { params: projectParam },+ responses: {+ 200: jsonResponse("Project details", projectSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const reorderProjectsRoute = createRoute({+ method: "put",+ operationId: "reorderProjects",+ path: "/reorder",+ tags: ["Projects"],+ summary: "Reorder projects",+ description:+ "Set the sidebar order of a workspace's projects. The given positions express relative order only -- the workspace is renumbered to 0..n-1.",+ middleware: [workspaceAccess.fromQuery(),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const workspaceId = c.get("workspaceId");- const { projects } = c.req.valid("json");- const reordered = await reorderProjectsCtrl(workspaceId, projects);- return c.json(reordered);+ ] as const,+ request: {+ query: workspaceIdQuery,+ body: {+ required: true,+ content: { "application/json": { schema: reorderProjectsBody } },},- )- .put(- "/:id",- describeRoute({- operationId: "updateProject",- tags: ["Projects"],- description: "Update an existing project",- responses: {- 200: {- description: "Project updated successfully",- content: {- "application/json": { schema: resolver(projectSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- name: v.string(),- icon: v.string(),- slug: v.string(),- description: v.string(),- isPublic: v.boolean(),- }),+ },+ responses: {+ // Reorder returns the plain project rows, without the list route's+ // rollup statistics.+ 200: jsonResponse("The reordered projects", z.array(projectSchema)),+ 400: errorResponse("Invalid body, or workspace ID could not be determined"),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",),+ },+});++const updateProjectRoute = createRoute({+ method: "put",+ operationId: "updateProject",+ path: "/{id}",+ tags: ["Projects"],+ summary: "Update project",+ description:+ "Replace a project's name, icon, slug, description, and visibility.",+ middleware: [workspaceAccess.fromProject(),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const { name, icon, slug, description, isPublic } = c.req.valid("json");- const workspaceId = c.get("workspaceId");- const updatedProject = await updateProjectCtrl(- id,- name,- icon,- slug,- description,- isPublic,- workspaceId,- );- return c.json(updatedProject);+ ] as const,+ request: {+ params: projectParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateProjectBody } },},- )- .delete(- "/:id",- describeRoute({- operationId: "deleteProject",- tags: ["Projects"],- description: "Delete a project by ID",- responses: {- 200: {- description: "Project deleted successfully",- content: {- "application/json": { schema: resolver(projectSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("The updated project", projectSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",+ ),+ },+});++const deleteProjectRoute = createRoute({+ method: "delete",+ operationId: "deleteProject",+ path: "/{id}",+ tags: ["Projects"],+ summary: "Delete project",+ description:+ "Permanently delete a project and everything in it. Archive it instead to keep the data.",+ middleware: [workspaceAccess.fromProject(),requireWorkspacePermission({ project: ["delete"] }),- async (c) => {- const { id } = c.req.valid("param");- const workspaceId = c.get("workspaceId");- const deletedProject = await deleteProjectCtrl(id, workspaceId);- return c.json(deletedProject);- },- )- .put(- "/:id/archive",- describeRoute({- operationId: "archiveProject",- tags: ["Projects"],- description: "Archive a project by ID",- responses: {- 200: {- description: "Project archived successfully",- content: {- "application/json": { schema: resolver(projectSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ ] as const,+ request: { params: projectParam },+ responses: {+ 200: jsonResponse("The deleted project", projectSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing project:delete permission",+ ),+ },+});++const archiveProjectRoute = createRoute({+ method: "put",+ operationId: "archiveProject",+ path: "/{id}/archive",+ tags: ["Projects"],+ summary: "Archive project",+ description:+ "Hide a project from the default list without deleting it. Reversible with unarchive.",+ middleware: [workspaceAccess.fromProject(),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const workspaceId = c.get("workspaceId");- const archivedProject = await archiveProjectCtrl(id, workspaceId);- return c.json(archivedProject);- },- )- .put(- "/:id/unarchive",- describeRoute({- operationId: "unarchiveProject",- tags: ["Projects"],- description: "Unarchive a project by ID",- responses: {- 200: {- description: "Project unarchived successfully",- content: {- "application/json": { schema: resolver(projectSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ ] as const,+ request: { params: projectParam },+ responses: {+ 200: jsonResponse("The archived project", projectSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",+ ),+ },+});++const unarchiveProjectRoute = createRoute({+ method: "put",+ operationId: "unarchiveProject",+ path: "/{id}/unarchive",+ tags: ["Projects"],+ summary: "Unarchive project",+ description: "Return an archived project to the default list.",+ middleware: [workspaceAccess.fromProject(),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const workspaceId = c.get("workspaceId");- const unarchivedProject = await unarchiveProjectCtrl(id, workspaceId);- return c.json(unarchivedProject);- },- );+ ] as const,+ request: { params: projectParam },+ responses: {+ 200: jsonResponse("The restored project", projectSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",+ ),+ },+});++const project = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(listProjectsRoute, async (c) => {+ const workspaceId = c.get("workspaceId");+ const { includeArchived } = c.req.valid("query");+ const projects = await getProjectsCtrl(+ workspaceId,+ includeArchived === "true",+ );+ return c.json(projects, 200);+ })+ .openapi(createProjectRoute, async (c) => {+ const { name, icon, slug } = c.req.valid("json");+ const workspaceId = c.get("workspaceId");+ const newProject = await createProjectCtrl(workspaceId, name, icon, slug);+ return c.json(newProject, 200);+ })+ .openapi(getProjectRoute, async (c) => {+ const { id } = c.req.valid("param");+ const workspaceId = c.get("workspaceId");+ const projectData = await getProjectCtrl(id, workspaceId);+ return c.json(projectData, 200);+ })+ .openapi(reorderProjectsRoute, async (c) => {+ const workspaceId = c.get("workspaceId");+ const { projects } = c.req.valid("json");+ const reordered = await reorderProjectsCtrl(workspaceId, projects);+ return c.json(reordered, 200);+ })+ .openapi(updateProjectRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { name, icon, slug, description, isPublic } = c.req.valid("json");+ const workspaceId = c.get("workspaceId");+ const updatedProject = await updateProjectCtrl(+ id,+ name,+ icon,+ slug,+ description,+ isPublic,+ workspaceId,+ );+ return c.json(updatedProject, 200);+ })+ .openapi(deleteProjectRoute, async (c) => {+ const { id } = c.req.valid("param");+ const workspaceId = c.get("workspaceId");+ const deletedProject = await deleteProjectCtrl(id, workspaceId);+ return c.json(deletedProject, 200);+ })+ .openapi(archiveProjectRoute, async (c) => {+ const { id } = c.req.valid("param");+ const workspaceId = c.get("workspaceId");+ const archivedProject = await archiveProjectCtrl(id, workspaceId);+ return c.json(archivedProject, 200);+ })+ .openapi(unarchiveProjectRoute, async (c) => {+ const { id } = c.req.valid("param");+ const workspaceId = c.get("workspaceId");+ const unarchivedProject = await unarchiveProjectCtrl(id, workspaceId);+ return c.json(unarchivedProject, 200);+ });export default project;diff --git a/apps/api/src/project/response.ts b/apps/api/src/project/response.tsnew file mode 100644index 000000000..6d2920ae8--- /dev/null+++ b/apps/api/src/project/response.ts@@ -0,0 +1,60 @@+import { nullableResponseTimestamp, responseTimestamp, z } from "../openapi";+import { boardColumnSchema, boardTaskSchema } from "../task/response";++export const projectSchema = z+ .object({+ id: z.string(),+ workspaceId: z.string(),+ slug: z.string().openapi({+ description: "Short prefix used in task identifiers, e.g. KAN-12.",+ }),+ icon: z.string().nullable(),+ name: z.string(),+ description: z.string().nullable(),+ createdAt: responseTimestamp,+ isPublic: z.boolean().nullable().openapi({+ description:+ "When true the project's board is readable without signing in, via /api/public-project/{id}.",+ }),+ archivedAt: nullableResponseTimestamp.openapi({+ description:+ "Non-null once archived; archived projects are hidden by default.",+ }),+ position: z.number().openapi({ description: "Sidebar order, ascending." }),+ lastTaskNumber: z.number().openapi({+ description:+ "Highest task number issued in this project; the next task gets this plus one.",+ }),+ })+ .openapi("Project");++export const projectStatisticsSchema = z+ .object({+ completionPercentage: z.number(),+ totalTasks: z.number(),+ dueDate: nullableResponseTimestamp.openapi({+ description: "The soonest due date among the project's open tasks.",+ }),+ })+ .openapi("ProjectStatistics");++// The list route enriches each project with rollup statistics. The three empty+// arrays are retained for clients that still read them; they are never filled.+export const projectListItemSchema = projectSchema+ .extend({+ statistics: projectStatisticsSchema,+ // Legacy fields kept for clients that still read them. The list route+ // always returns them empty; fetch the board via GET /task/tasks/{id}.+ archivedTasks: z+ .array(boardTaskSchema)+ .openapi({ description: "Always empty." }),+ plannedTasks: z+ .array(boardTaskSchema)+ .openapi({ description: "Always empty." }),+ columns: z+ .array(boardColumnSchema)+ .openapi({ description: "Always empty." }),+ })+ .openapi("ProjectListItem");++export const projectListSchema = z.array(projectListItemSchema);diff --git a/apps/api/src/project/schema.ts b/apps/api/src/project/schema.tsnew file mode 100644index 000000000..9d0fff622--- /dev/null+++ b/apps/api/src/project/schema.ts@@ -0,0 +1,35 @@+import { z } from "../openapi";++export const projectParam = z.object({ id: z.string() });++export const workspaceIdQuery = z.object({ workspaceId: z.string() });++export const listProjectsQuery = z.object({+ workspaceId: z.string(),+ includeArchived: z.string().optional().openapi({+ description: 'Pass "true" to include archived projects in the list.',+ }),+});++export const createProjectBody = z.object({+ name: z.string(),+ workspaceId: z.string(),+ icon: z.string(),+ slug: z.string(),+});++export const updateProjectBody = z.object({+ name: z.string(),+ icon: z.string(),+ slug: z.string(),+ description: z.string(),+ isPublic: z.boolean(),+});++export const reorderProjectsBody = z.object({+ // Positions express a relative order only; the controller renumbers the+ // workspace to 0..n-1, so the values just have to be sane.+ projects: z+ .array(z.object({ id: z.string(), position: z.number().int().min(0) }))+ .min(1),+});diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.tsdeleted file mode 100644index 2cca95ffa..000000000--- a/apps/api/src/schemas.ts+++ /dev/null@@ -1,281 +0,0 @@-import * as v from "valibot";--export const labelSchema = v.object({- id: v.string(),- name: v.string(),- color: v.string(),- createdAt: v.date(),- taskId: v.nullable(v.string()),- workspaceId: v.nullable(v.string()),-});--export const projectSchema = v.object({- id: v.string(),- workspaceId: v.string(),- slug: v.string(),- icon: v.nullable(v.string()),- name: v.string(),- description: v.nullable(v.string()),- createdAt: v.date(),- isPublic: v.nullable(v.boolean()),- archivedAt: v.nullable(v.date()),- position: v.number(),-});--export const taskSchema = v.object({- id: v.string(),- projectId: v.string(),- position: v.nullable(v.number()),- number: v.nullable(v.number()),- userId: v.nullable(v.string()),- title: v.string(),- description: v.nullable(v.string()),- status: v.string(),- priority: v.picklist([- "no-priority",- "low",- "medium",- "high",- "urgent",- ] as const),- startDate: v.optional(v.date()),- dueDate: v.optional(v.date()),- createdAt: v.date(),-});--export const activitySchema = v.object({- id: v.string(),- taskId: v.string(),- type: v.picklist([- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create",- ] as const),- createdAt: v.date(),- userId: v.nullable(v.string()),- content: v.nullable(v.string()),- eventData: v.nullable(v.record(v.string(), v.unknown())),- externalUserName: v.nullable(v.string()),- externalUserAvatar: v.nullable(v.string()),- externalSource: v.nullable(v.string()),- externalUrl: v.nullable(v.string()),-});--export const timeEntrySchema = v.object({- id: v.string(),- taskId: v.string(),- userId: v.nullable(v.string()),- description: v.nullable(v.string()),- startTime: v.date(),- endTime: v.optional(v.date()),- duration: v.nullable(v.number()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const notificationSchema = v.object({- id: v.string(),- userId: v.string(),- title: v.nullable(v.string()),- content: v.nullable(v.string()),- type: v.picklist([- "info",- "task_created",- "workspace_created",- "task_status_changed",- "task_assignee_changed",- "time_entry_created",- "due_date_reminder",- "task_overdue",- "task_mention",- "task_comment",- ] as const),- eventData: v.nullable(v.record(v.string(), v.unknown())),- isRead: v.optional(v.boolean()),- resourceId: v.optional(v.string()),- resourceType: v.optional(v.picklist(["task", "workspace"] as const)),- createdAt: v.date(),- updatedAt: v.date(),-});--export const notificationPreferenceWorkspaceRuleSchema = v.object({- id: v.string(),- workspaceId: v.string(),- workspaceName: v.string(),- isActive: v.boolean(),- emailEnabled: v.boolean(),- ntfyEnabled: v.boolean(),- gotifyEnabled: v.boolean(),- webhookEnabled: v.boolean(),- projectMode: v.picklist(["all", "selected"] as const),- selectedProjectIds: v.array(v.string()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const notificationPreferenceSchema = v.object({- emailAddress: v.nullable(v.string()),- emailEnabled: v.boolean(),- ntfyEnabled: v.boolean(),- ntfyConfigured: v.boolean(),- ntfyServerUrl: v.nullable(v.string()),- ntfyTopic: v.nullable(v.string()),- ntfyTokenConfigured: v.boolean(),- maskedNtfyToken: v.nullable(v.string()),- gotifyEnabled: v.boolean(),- gotifyConfigured: v.boolean(),- gotifyServerUrl: v.nullable(v.string()),- gotifyTokenConfigured: v.boolean(),- maskedGotifyToken: v.nullable(v.string()),- webhookEnabled: v.boolean(),- webhookConfigured: v.boolean(),- webhookUrl: v.nullable(v.string()),- webhookSecretConfigured: v.boolean(),- maskedWebhookSecret: v.nullable(v.string()),- taskAssignmentEnabled: v.boolean(),- taskCommentEnabled: v.boolean(),- taskStatusChangeEnabled: v.boolean(),- dueDateReminderEnabled: v.boolean(),- dueDateReminderLeadTimeMinutes: v.number(),- workspaces: v.array(notificationPreferenceWorkspaceRuleSchema),- createdAt: v.nullable(v.date()),- updatedAt: v.nullable(v.date()),-});--export const githubIntegrationSchema = v.object({- id: v.string(),- projectId: v.string(),- repositoryOwner: v.string(),- repositoryName: v.string(),- installationId: v.nullable(v.number()),- branchPattern: v.optional(v.string()),- commentTaskLinkOnGitHubIssue: v.optional(v.boolean()),- isActive: v.nullable(v.boolean()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const giteaIntegrationSchema = v.object({- id: v.string(),- projectId: v.string(),- baseUrl: v.string(),- repositoryOwner: v.string(),- repositoryName: v.string(),- maskedAccessToken: v.string(),- webhookUrl: v.optional(v.string()),- webhookSecret: v.optional(v.string()),- branchPattern: v.optional(v.string()),- commentTaskLinkOnGiteaIssue: v.optional(v.boolean()),- isActive: v.nullable(v.boolean()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const integrationEventsSchema = v.object({- taskCreated: v.boolean(),- taskStatusChanged: v.boolean(),- taskPriorityChanged: v.boolean(),- taskTitleChanged: v.boolean(),- taskDescriptionChanged: v.boolean(),- taskCommentCreated: v.boolean(),-});--export const slackIntegrationSchema = v.object({- id: v.string(),- projectId: v.string(),- channelName: v.nullable(v.string()),- webhookConfigured: v.boolean(),- maskedWebhookUrl: v.string(),- events: integrationEventsSchema,- isActive: v.nullable(v.boolean()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const discordIntegrationSchema = v.object({- id: v.string(),- projectId: v.string(),- channelName: v.nullable(v.string()),- webhookConfigured: v.boolean(),- maskedWebhookUrl: v.string(),- events: integrationEventsSchema,- isActive: v.nullable(v.boolean()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const genericWebhookIntegrationSchema = v.object({- id: v.string(),- projectId: v.string(),- webhookConfigured: v.boolean(),- maskedWebhookUrl: v.nullable(v.string()),- secretConfigured: v.boolean(),- maskedSecret: v.nullable(v.string()),- events: v.object({- ...integrationEventsSchema.entries,- taskDeleted: v.boolean(),- taskMoved: v.boolean(),- taskDueDateChanged: v.boolean(),- taskAssigneeChanged: v.boolean(),- taskUnassigned: v.boolean(),- dueDateReminder: v.boolean(),- }),- dueDateReminderLeadTimeMinutes: v.number(),- isActive: v.nullable(v.boolean()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const telegramIntegrationSchema = v.object({- id: v.string(),- projectId: v.string(),- chatId: v.string(),- threadId: v.nullable(v.number()),- chatLabel: v.nullable(v.string()),- botTokenConfigured: v.boolean(),- maskedBotToken: v.string(),- events: integrationEventsSchema,- isActive: v.nullable(v.boolean()),- createdAt: v.date(),- updatedAt: v.date(),-});--export const commentSchema = v.object({- id: v.string(),- taskId: v.string(),- userId: v.string(),- content: v.string(),- createdAt: v.date(),- updatedAt: v.date(),- user: v.optional(- v.object({- name: v.string(),- image: v.nullable(v.string()),- }),- ),-});--export const configSchema = v.object({- disableRegistration: v.nullable(v.boolean()),- disablePasswordRegistration: v.nullable(v.boolean()),- disableEmailOtpSignIn: v.nullable(v.boolean()),- disableWorkspaceCreation: v.nullable(v.boolean()),- isDemoMode: v.boolean(),- hasSmtp: v.boolean(),- hasGithubSignIn: v.nullable(v.boolean()),- hasGoogleSignIn: v.nullable(v.boolean()),- hasDiscordSignIn: v.nullable(v.boolean()),- hasCustomOAuth: v.nullable(v.boolean()),- hasGuestAccess: v.nullable(v.boolean()),- disableLoginForm: v.nullable(v.boolean()),- customOAuthAutoLogin: v.nullable(v.boolean()),- customOAuthLogoutUrl: v.nullable(v.string()),- billingEnabled: v.boolean(),-});diff --git a/apps/api/src/search/index.ts b/apps/api/src/search/index.tsindex 4fe8b59ef..e6893e575 100644--- a/apps/api/src/search/index.ts+++ b/apps/api/src/search/index.ts@@ -1,100 +1,49 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";-import { activitySchema, projectSchema, taskSchema } from "../schemas";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { workspaceAccess } from "../utils/workspace-access-middleware";import globalSearch from "./controllers/global-search";+import { searchResponseSchema } from "./response";+import { searchQuery } from "./schema";-const workspaceSchema = v.object({- id: v.string(),- name: v.string(),- slug: v.string(),- logo: v.nullable(v.string()),- metadata: v.nullable(v.string()),- description: v.nullable(v.string()),- createdAt: v.date(),-});--const searchResultSchema = v.object({- tasks: v.optional(v.array(taskSchema)),- projects: v.optional(v.array(projectSchema)),- workspaces: v.optional(v.array(workspaceSchema)),- comments: v.optional(v.array(activitySchema)),- activities: v.optional(v.array(activitySchema)),+const globalSearchRoute = createRoute({+ method: "get",+ operationId: "globalSearch",+ path: "/",+ tags: ["Search"],+ summary: "Global search",+ description:+ "Search across tasks, projects, workspaces, comments, and activities in one workspace. Results are ranked by relevance and returned as a single flat list, each entry tagged with its `type`.",+ middleware: [workspaceAccess.fromQuery()] as const,+ request: { query: searchQuery },+ responses: {+ 200: jsonResponse("Ranked search results", searchResponseSchema),+ 400: errorResponse(+ "Invalid query, or workspace ID could not be determined",+ ),+ 403: errorResponse("No access to the workspace"),+ },});-const search = new Hono<{- Variables: {- userId: string;- };-}>().get(- "/",- describeRoute({- operationId: "globalSearch",- tags: ["Search"],- description:- "Search across tasks, projects, workspaces, comments, and activities",- responses: {- 200: {- description: "Search results",- content: {- "application/json": { schema: resolver(searchResultSchema) },- },- },- },- }),- validator(- "query",- v.object({- q: v.pipe(- v.string(),- v.minLength(1, "Query must be at least 1 character"),- ),- type: v.optional(- v.picklist([- "all",- "tasks",- "projects",- "workspaces",- "comments",- "activities",- ]),- "all",- ),- workspaceId: v.pipe(v.string(), v.minLength(1)),- projectId: v.optional(v.string()),- limit: v.optional(- v.pipe(- v.string(),- v.transform(Number),- v.number(),- v.integer("Limit must be an integer"),- v.minValue(1, "Limit must be at least 1"),- v.maxValue(50, "Limit must not exceed 50"),- ),- "20",- ),- userEmail: v.optional(v.pipe(v.string(), v.email())),- }),- ),- workspaceAccess.fromQuery(),- async (c) => {- const { q, type, workspaceId, projectId, limit, userEmail } =- c.req.valid("query");- const userId = c.get("userId");+const search = apiRouter().openapi(globalSearchRoute, async (c) => {+ const { q, type, workspaceId, projectId, limit, userEmail } =+ c.req.valid("query");- const results = await globalSearch({+ return c.json(+ await globalSearch({query: q,- userId,+ userId: c.get("userId"),userEmail,type,workspaceId,projectId,limit,- });-- return c.json(results);- },-);+ }),+ 200,+ );+});export default search;diff --git a/apps/api/src/search/response.ts b/apps/api/src/search/response.tsnew file mode 100644index 000000000..46e96c13c--- /dev/null+++ b/apps/api/src/search/response.ts@@ -0,0 +1,40 @@+import { responseTimestamp, z } from "../openapi";++export const searchResultSchema = z+ .object({+ id: z.string(),+ type: z.enum(["task", "project", "workspace", "comment", "activity"]),+ title: z.string(),+ description: z.string().optional(),+ content: z.string().optional().openapi({+ description:+ "Matched body text, for comment and activity results. Activities get a rendered summary such as `changed status from Todo to In Progress`.",+ }),+ projectId: z.string().optional(),+ projectName: z.string().optional(),+ projectSlug: z.string().optional(),+ workspaceId: z.string().optional(),+ workspaceName: z.string().optional(),+ userId: z.string().optional(),+ userName: z.string().optional(),+ createdAt: responseTimestamp,+ relevanceScore: z.number().openapi({+ description:+ "Higher is a better match. Results are sorted by score, then by createdAt descending.",+ }),+ taskNumber: z.number().optional(),+ priority: z.string().optional(),+ status: z.string().optional(),+ })+ .openapi("SearchResult");++export const searchResponseSchema = z+ .object({+ results: z.array(searchResultSchema),+ totalCount: z.number().openapi({+ description:+ "Total matches found before the `limit` slice, so a caller can tell that more exist.",+ }),+ searchQuery: z.string().openapi({ description: "The query that was run." }),+ })+ .openapi("SearchResponse");diff --git a/apps/api/src/search/schema.ts b/apps/api/src/search/schema.tsnew file mode 100644index 000000000..bf044c2fd--- /dev/null+++ b/apps/api/src/search/schema.ts@@ -0,0 +1,25 @@+import { z } from "../openapi";++export const searchQuery = z.object({+ q: z.string().min(1, "Query must be at least 1 character"),+ type: z+ .enum(["all", "tasks", "projects", "workspaces", "comments", "activities"])+ .optional()+ .default("all"),+ workspaceId: z.string().min(1),+ projectId: z.string().optional(),+ // Query strings arrive as text; keep the wire type honest and coerce after.+ limit: z+ .string()+ .optional()+ .default("20")+ .transform(Number)+ .pipe(+ z+ .number()+ .int("Limit must be an integer")+ .min(1, "Limit must be at least 1")+ .max(50, "Limit must not exceed 50"),+ ),+ userEmail: z.email().optional(),+});diff --git a/apps/api/src/slack-integration/index.ts b/apps/api/src/slack-integration/index.tsindex 2eeb9ade6..1e24e3ae8 100644--- a/apps/api/src/slack-integration/index.ts+++ b/apps/api/src/slack-integration/index.ts@@ -1,31 +1,29 @@import { and, eq } from "drizzle-orm";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { integrationTable } from "../database/schema";+import {+ deletedSchema,+ integrationEventToggles,+ projectIdParam,+} from "../integrations/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+ z,+} from "../openapi";import {defaultSlackEvents,normalizeSlackConfig,type SlackConfig,validateSlackConfig,} from "../plugins/slack/config";-import { slackIntegrationSchema } from "../schemas";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";--const slackIntegration = new Hono<{- Variables: {- userId: string;- workspaceId: string;- apiKey?: {- id: string;- userId: string;- enabled: boolean;- };- };-}>();+import { slackIntegrationSchema } from "./response";function maskWebhookUrl(value: string): string {try {@@ -83,247 +81,249 @@ async function getSlackIntegration(projectId: string) {return toResponse(integration);}-const nullableSlackIntegrationSchema = v.nullable(slackIntegrationSchema);+const createBody = z.object({+ webhookUrl: z.string().min(1),+ channelName: z.string().optional(),+ events: integrationEventToggles.optional(),+});-slackIntegration- .get(- "/project/:projectId",- describeRoute({- operationId: "getSlackIntegration",- tags: ["Slack"],- description: "Get Slack integration for a project",- responses: {- 200: {- description: "Slack integration details",- content: {- "application/json": {- schema: resolver(nullableSlackIntegrationSchema),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const integration = await getSlackIntegration(projectId);- return c.json(integration);- },- )- .post(- "/project/:projectId",- describeRoute({- operationId: "createSlackIntegration",- tags: ["Slack"],- description: "Create or replace a Slack integration for a project",- responses: {- 200: {- description: "Slack integration created successfully",- content: {- "application/json": { schema: resolver(slackIntegrationSchema) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- webhookUrl: v.pipe(v.string(), v.minLength(1)),- channelName: v.optional(v.string()),- events: v.optional(- v.object({- taskCreated: v.optional(v.boolean()),- taskStatusChanged: v.optional(v.boolean()),- taskPriorityChanged: v.optional(v.boolean()),- taskTitleChanged: v.optional(v.boolean()),- taskDescriptionChanged: v.optional(v.boolean()),- taskCommentCreated: v.optional(v.boolean()),- }),- ),- }),- ),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+const updateBody = z.object({+ webhookUrl: z.string().optional(),+ channelName: z.string().nullable().optional(),+ isActive: z.boolean().optional(),+ events: integrationEventToggles.optional(),+});- const config = normalizeSlackConfig({- webhookUrl: body.webhookUrl,- channelName: body.channelName,- events: body.events,- });+const manageAccess = [+ workspaceAccess.fromProject("projectId"),+ requireWorkspacePermission({ workspace: ["manage_settings"] }),+];- const validation = await validateSlackConfig(config);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }-- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "slack"),- ),- });+const getSlackIntegrationRoute = createRoute({+ method: "get",+ operationId: "getSlackIntegration",+ path: "/project/{projectId}",+ tags: ["Slack"],+ summary: "Get Slack integration",+ description:+ "Get the Slack integration for a project, or null when none is configured.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "Slack integration details, or null",+ slackIntegrationSchema.nullable(),+ ),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});- if (existing) {- await db- .update(integrationTable)- .set({- config: JSON.stringify(config),- isActive: true,- updatedAt: new Date(),- })- .where(eq(integrationTable.id, existing.id));- } else {- await db.insert(integrationTable).values({- projectId,- type: "slack",- config: JSON.stringify(config),- isActive: true,- });- }+const createSlackIntegrationRoute = createRoute({+ method: "post",+ operationId: "createSlackIntegration",+ path: "/project/{projectId}",+ tags: ["Slack"],+ summary: "Create Slack integration",+ description:+ "Create or replace the Slack integration for a project. The webhook URL is verified before it is stored.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createBody } },+ },+ },+ responses: {+ 200: jsonResponse(+ "The stored integration",+ slackIntegrationSchema.nullable(),+ ),+ 400: errorResponse("The webhook URL failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ },+});- const integration = await getSlackIntegration(projectId);- return c.json(integration);+const updateSlackIntegrationRoute = createRoute({+ method: "patch",+ operationId: "updateSlackIntegration",+ path: "/project/{projectId}",+ tags: ["Slack"],+ summary: "Update Slack integration",+ description:+ "Update the Slack integration. Omitted fields keep their current value, and event toggles are merged into the existing set.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateBody } },},- )- .patch(- "/project/:projectId",- describeRoute({- operationId: "updateSlackIntegration",- tags: ["Slack"],- description: "Update Slack integration settings",- responses: {- 200: {- description: "Slack integration updated successfully",- content: {- "application/json": { schema: resolver(slackIntegrationSchema) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- webhookUrl: v.optional(v.string()),- channelName: v.optional(v.nullable(v.string())),- isActive: v.optional(v.boolean()),- events: v.optional(- v.object({- taskCreated: v.optional(v.boolean()),- taskStatusChanged: v.optional(v.boolean()),- taskPriorityChanged: v.optional(v.boolean()),- taskTitleChanged: v.optional(v.boolean()),- taskDescriptionChanged: v.optional(v.boolean()),- taskCommentCreated: v.optional(v.boolean()),- }),- ),- }),+ },+ responses: {+ 200: jsonResponse(+ "The updated integration",+ slackIntegrationSchema.nullable(),),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+ 400: errorResponse("The resulting config failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Slack integration not found"),+ },+});- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "slack"),- ),- });+const deleteSlackIntegrationRoute = createRoute({+ method: "delete",+ operationId: "deleteSlackIntegration",+ path: "/project/{projectId}",+ tags: ["Slack"],+ summary: "Delete Slack integration",+ description: "Remove the Slack integration from a project.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The integration was removed", deletedSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Slack integration not found"),+ },+});++const slackIntegration = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(getSlackIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const integration = await getSlackIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(createSlackIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- if (!existing) {- throw new HTTPException(404, {- message: "Slack integration not found",- });- }+ const config = normalizeSlackConfig({+ webhookUrl: body.webhookUrl,+ channelName: body.channelName,+ events: body.events,+ });- const currentConfig = normalizeSlackConfig(- JSON.parse(existing.config) as SlackConfig,- );- const nextConfig = normalizeSlackConfig({- webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,- channelName:- body.channelName === undefined- ? currentConfig.channelName- : (body.channelName ?? undefined),- events: {- ...(currentConfig.events ?? {}),- ...(body.events ?? {}),- },+ const validation = await validateSlackConfig(config);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",});+ }- const validation = await validateSlackConfig(nextConfig);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "slack"),+ ),+ });+ if (existing) {await db.update(integrationTable).set({- config: JSON.stringify(nextConfig),- isActive:- body.isActive !== undefined- ? body.isActive- : (existing.isActive ?? true),+ config: JSON.stringify(config),+ isActive: true,updatedAt: new Date(),}).where(eq(integrationTable.id, existing.id));+ } else {+ await db.insert(integrationTable).values({+ projectId,+ type: "slack",+ config: JSON.stringify(config),+ isActive: true,+ });+ }- const integration = await getSlackIntegration(projectId);- return c.json(integration);- },- )- .delete(- "/project/:projectId",- describeRoute({- operationId: "deleteSlackIntegration",- tags: ["Slack"],- description: "Delete Slack integration for a project",- responses: {- 200: {- description: "Slack integration deleted successfully",- content: {- "application/json": {- schema: resolver(v.object({ success: v.boolean() })),- },- },- },+ const integration = await getSlackIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(updateSlackIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");++ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "slack"),+ ),+ });++ if (!existing) {+ throw new HTTPException(404, {+ message: "Slack integration not found",+ });+ }++ const currentConfig = normalizeSlackConfig(+ JSON.parse(existing.config) as SlackConfig,+ );+ const nextConfig = normalizeSlackConfig({+ webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,+ channelName:+ body.channelName === undefined+ ? currentConfig.channelName+ : (body.channelName ?? undefined),+ events: {+ ...(currentConfig.events ?? {}),+ ...(body.events ?? {}),},- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");+ });- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "slack"),- ),+ const validation = await validateSlackConfig(nextConfig);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",});+ }- if (!existing) {- throw new HTTPException(404, {- message: "Slack integration not found",- });- }+ await db+ .update(integrationTable)+ .set({+ config: JSON.stringify(nextConfig),+ isActive:+ body.isActive !== undefined+ ? body.isActive+ : (existing.isActive ?? true),+ updatedAt: new Date(),+ })+ .where(eq(integrationTable.id, existing.id));- await db- .delete(integrationTable)- .where(eq(integrationTable.id, existing.id));- return c.json({ success: true });- },- );+ const integration = await getSlackIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(deleteSlackIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");++ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "slack"),+ ),+ });++ if (!existing) {+ throw new HTTPException(404, {+ message: "Slack integration not found",+ });+ }++ await db+ .delete(integrationTable)+ .where(eq(integrationTable.id, existing.id));+ return c.json({ success: true }, 200);+ });export default slackIntegration;diff --git a/apps/api/src/slack-integration/response.ts b/apps/api/src/slack-integration/response.tsnew file mode 100644index 000000000..49e14424d--- /dev/null+++ b/apps/api/src/slack-integration/response.ts@@ -0,0 +1,20 @@+import { integrationEventsSchema } from "../integrations/response";+import { responseTimestamp, z } from "../openapi";++// The webhook URL is a bearer credential, so only a masked form is returned.+export const slackIntegrationSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ channelName: z.string().nullable(),+ webhookConfigured: z.boolean(),+ maskedWebhookUrl: z.string().openapi({+ description:+ "The webhook URL with its secret path segment masked, or an empty string when none is set.",+ }),+ events: integrationEventsSchema,+ isActive: z.boolean().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("SlackIntegration");diff --git a/apps/api/src/task-relation/index.ts b/apps/api/src/task-relation/index.tsindex 1e8fd0a64..f213f2f29 100644--- a/apps/api/src/task-relation/index.ts+++ b/apps/api/src/task-relation/index.ts@@ -1,160 +1,192 @@import { eq } from "drizzle-orm";-import { Hono } from "hono";+import type { Context, Next } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { projectTable, taskRelationTable, taskTable } from "../database/schema";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { validateWorkspaceAccess } from "../utils/validate-workspace-access";import { workspaceAccess } from "../utils/workspace-access-middleware";import createTaskRelation from "./controllers/create-task-relation";import deleteTaskRelation from "./controllers/delete-task-relation";import getTaskRelations from "./controllers/get-task-relations";+import {+ taskRelationSchema,+ taskRelationWithTasksListSchema,+} from "./response";+import {+ createTaskRelationBody,+ taskIdParam,+ taskRelationParam,+} from "./schema";-const taskRelationSchema = v.object({- id: v.string(),- sourceTaskId: v.string(),- targetTaskId: v.string(),- relationType: v.string(),- createdAt: v.date(),-});+async function workspaceIdOfTask(taskId: string) {+ const [task] = await db+ .select({ workspaceId: projectTable.workspaceId })+ .from(taskTable)+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))+ .where(eq(taskTable.id, taskId))+ .limit(1);+ return task?.workspaceId ?? null;+}++function requireUserId(c: Context) {+ const userId = c.get("userId");+ if (!userId) {+ throw new HTTPException(401, { message: "Unauthorized" });+ }+ return userId as string;+}-const taskRelation = new Hono<{- Variables: {- userId: string;- workspaceId: string;+// Route middleware runs before the request validators, so these read the raw+// request rather than c.req.valid(), which is not populated yet.+async function scopeToSourceTask(c: Context, next: Next) {+ const userId = requireUserId(c);++ const body = (await c.req.json().catch(() => ({}))) as {+ sourceTaskId?: unknown;};-}>()- .get(- "/:taskId",- describeRoute({- operationId: "getTaskRelations",- tags: ["Task Relations"],- description: "Get all relations for a task",- responses: {- 200: {- description: "Task relations with associated task data",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),- workspaceAccess.fromTaskId("taskId"),- async (c) => {- const { taskId } = c.req.valid("param");- const relations = await getTaskRelations(taskId, c.get("workspaceId"));- return c.json(relations);- },- )- .post(- "/",- describeRoute({- operationId: "createTaskRelation",- tags: ["Task Relations"],- description: "Create a relation between two tasks",- responses: {- 200: {- description: "Task relation created successfully",- content: {- "application/json": { schema: resolver(taskRelationSchema) },- },- },- },- }),- validator(- "json",- v.object({- sourceTaskId: v.string(),- targetTaskId: v.string(),- relationType: v.picklist(["subtask", "blocks", "related"]),- }),+ const sourceTaskId =+ typeof body?.sourceTaskId === "string" ? body.sourceTaskId : null;+ if (!sourceTaskId) {+ throw new HTTPException(400, { message: "sourceTaskId is required" });+ }++ const workspaceId = await workspaceIdOfTask(sourceTaskId);+ if (!workspaceId) {+ throw new HTTPException(404, { message: "Source task not found" });+ }++ await validateWorkspaceAccess(userId, workspaceId);+ c.set("workspaceId", workspaceId);+ return next();+}++async function scopeToRelation(c: Context, next: Next) {+ const userId = requireUserId(c);++ const id = c.req.param("id");+ const [rel] = await db+ .select({ sourceTaskId: taskRelationTable.sourceTaskId })+ .from(taskRelationTable)+ .where(eq(taskRelationTable.id, id ?? ""))+ .limit(1);+ if (!rel) {+ throw new HTTPException(404, { message: "Task relation not found" });+ }++ const workspaceId = await workspaceIdOfTask(rel.sourceTaskId);+ if (!workspaceId) {+ throw new HTTPException(404, { message: "Task not found" });+ }++ await validateWorkspaceAccess(userId, workspaceId);+ c.set("workspaceId", workspaceId);+ return next();+}++const getTaskRelationsRoute = createRoute({+ method: "get",+ operationId: "getTaskRelations",+ path: "/{taskId}",+ tags: ["Task Relations"],+ summary: "Get task relations",+ description:+ "Get every relation where the task is the source or the target, each with a summary of both linked tasks. Relations pointing outside the caller's workspace are omitted.",+ middleware: [workspaceAccess.fromTaskId("taskId")] as const,+ request: { params: taskIdParam },+ responses: {+ 200: jsonResponse(+ "Task relations with the linked task summaries",+ taskRelationWithTasksListSchema,+ ),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",),- async (c, next) => {- const userId = c.get("userId");- if (!userId) {- throw new HTTPException(401, { message: "Unauthorized" });- }- const { sourceTaskId } = c.req.valid("json");- const [task] = await db- .select({ workspaceId: projectTable.workspaceId })- .from(taskTable)- .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))- .where(eq(taskTable.id, sourceTaskId))- .limit(1);- if (!task) {- throw new HTTPException(404, { message: "Source task not found" });- }- await validateWorkspaceAccess(userId, task.workspaceId);- c.set("workspaceId", task.workspaceId);- return next();+ 403: errorResponse("No access to the task's workspace"),+ },+});++const createTaskRelationRoute = createRoute({+ method: "post",+ operationId: "createTaskRelation",+ path: "/",+ tags: ["Task Relations"],+ summary: "Create task relation",+ description:+ "Link two tasks. Authorization is scoped to the source task's workspace.",+ middleware: [+ scopeToSourceTask,+ requireWorkspacePermission({ task: ["update"] }),+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createTaskRelationBody } },},+ },+ responses: {+ 200: jsonResponse("The created relation", taskRelationSchema),+ 400: errorResponse("Invalid body, or the relation already exists"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ 404: errorResponse("Source task not found"),+ },+});++const deleteTaskRelationRoute = createRoute({+ method: "delete",+ operationId: "deleteTaskRelation",+ path: "/{id}",+ tags: ["Task Relations"],+ summary: "Delete task relation",+ description: "Remove a link between two tasks. Returns the deleted relation.",+ middleware: [+ scopeToRelation,requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const userId = c.get("userId");- const { sourceTaskId, targetTaskId, relationType } = c.req.valid("json");- const relation = await createTaskRelation({+ ] as const,+ request: { params: taskRelationParam },+ responses: {+ 200: jsonResponse("The deleted relation", taskRelationSchema),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ 404: errorResponse("Task relation not found, or its source task is gone"),+ },+});++const taskRelation = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(getTaskRelationsRoute, async (c) =>+ c.json(+ await getTaskRelations(c.req.valid("param").taskId, c.get("workspaceId")),+ 200,+ ),+ )+ .openapi(createTaskRelationRoute, async (c) => {+ const { sourceTaskId, targetTaskId, relationType } = c.req.valid("json");+ return c.json(+ await createTaskRelation({sourceTaskId,targetTaskId,relationType,- userId,+ userId: c.get("userId"),workspaceId: c.get("workspaceId"),- });- return c.json(relation);- },- )- .delete(- "/:id",- describeRoute({- operationId: "deleteTaskRelation",- tags: ["Task Relations"],- description: "Delete a task relation",- responses: {- 200: {- description: "Task relation deleted successfully",- content: {- "application/json": { schema: resolver(taskRelationSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- async (c, next) => {- const userId = c.get("userId");- if (!userId) {- throw new HTTPException(401, { message: "Unauthorized" });- }- const { id } = c.req.valid("param");- const [rel] = await db- .select({ sourceTaskId: taskRelationTable.sourceTaskId })- .from(taskRelationTable)- .where(eq(taskRelationTable.id, id))- .limit(1);- if (!rel) {- throw new HTTPException(404, { message: "Task relation not found" });- }- const [task] = await db- .select({ workspaceId: projectTable.workspaceId })- .from(taskTable)- .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))- .where(eq(taskTable.id, rel.sourceTaskId))- .limit(1);- if (!task) {- throw new HTTPException(404, { message: "Task not found" });- }- await validateWorkspaceAccess(userId, task.workspaceId);- c.set("workspaceId", task.workspaceId);- return next();- },- requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const userId = c.get("userId");- const { id } = c.req.valid("param");- const relation = await deleteTaskRelation(id, userId);- return c.json(relation);- },+ }),+ 200,+ );+ })+ .openapi(deleteTaskRelationRoute, async (c) =>+ c.json(+ await deleteTaskRelation(c.req.valid("param").id, c.get("userId")),+ 200,+ ),);export default taskRelation;diff --git a/apps/api/src/task-relation/response.ts b/apps/api/src/task-relation/response.tsnew file mode 100644index 000000000..053937fc3--- /dev/null+++ b/apps/api/src/task-relation/response.ts@@ -0,0 +1,42 @@+import { responseTimestamp, z } from "../openapi";++const relationTypeDescription =+ "How the two tasks relate: `subtask`, `blocks`, or `related`.";++// The joined task summary, restricted to the caller's workspace.+const relatedTaskSchema = z+ .object({+ id: z.string(),+ title: z.string(),+ status: z.string(),+ priority: z.string().nullable(),+ number: z.number().nullable(),+ projectId: z.string(),+ userId: z.string().nullable(),+ assigneeName: z.string().nullable(),+ })+ .openapi("RelatedTask");++export const taskRelationSchema = z+ .object({+ id: z.string(),+ sourceTaskId: z.string(),+ targetTaskId: z.string(),+ relationType: z.string().openapi({ description: relationTypeDescription }),+ createdAt: responseTimestamp,+ })+ .openapi("TaskRelation");++// getTaskRelations drops any relation whose endpoints are not both visible in+// the workspace, so in practice these are always present; they stay nullable+// because the lookup itself is a map read.+export const taskRelationWithTasksSchema = taskRelationSchema+ .extend({+ sourceTask: relatedTaskSchema.nullable(),+ targetTask: relatedTaskSchema.nullable(),+ })+ .openapi("TaskRelationWithTasks");++export const taskRelationWithTasksListSchema = z.array(+ taskRelationWithTasksSchema,+);diff --git a/apps/api/src/task-relation/schema.ts b/apps/api/src/task-relation/schema.tsnew file mode 100644index 000000000..676aa75ae--- /dev/null+++ b/apps/api/src/task-relation/schema.ts@@ -0,0 +1,11 @@+import { z } from "../openapi";++export const taskIdParam = z.object({ taskId: z.string() });++export const taskRelationParam = z.object({ id: z.string() });++export const createTaskRelationBody = z.object({+ sourceTaskId: z.string(),+ targetTaskId: z.string(),+ relationType: z.enum(["subtask", "blocks", "related"]),+});diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.tsindex d984a02fe..430fa040f 100644--- a/apps/api/src/task/index.ts+++ b/apps/api/src/task/index.ts@@ -1,8 +1,5 @@import { eq } from "drizzle-orm";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import { requireEntitlement } from "../billing/require-entitlement-middleware";import db from "../database";import {@@ -11,7 +8,13 @@ import {taskTable,workspaceTable,} from "../database/schema";-import { taskSchema } from "../schemas";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import {assertTaskImageKeyMatchesContext,createTaskImageUploadUrl,@@ -45,859 +48,878 @@ import updateTaskDueDate from "./controllers/update-task-due-date";import updateTaskPriority from "./controllers/update-task-priority";import updateTaskStatus from "./controllers/update-task-status";import updateTaskTitle from "./controllers/update-task-title";-import { VALID_PRIORITIES } from "./validate-task-fields";--const task = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/tasks/:projectId",- describeRoute({- operationId: "listTasks",- tags: ["Tasks"],- description: "Get all tasks for a specific project",- responses: {- 200: {- description: "Project with tasks organized by columns",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "query",- v.optional(- v.object({- status: v.optional(v.string()),- priority: v.optional(v.string()),- assigneeId: v.optional(v.string()),- page: v.optional(v.pipe(v.string(), v.transform(Number))),- limit: v.optional(v.pipe(v.string(), v.transform(Number))),- sortBy: v.optional(- v.picklist([- "createdAt",- "priority",- "dueDate",- "position",- "title",- "number",- ]),- ),- sortOrder: v.optional(v.picklist(["asc", "desc"])),- dueBefore: v.optional(v.string()),- dueAfter: v.optional(v.string()),- }),- ),- ),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const filters = c.req.valid("query") || {};-- const tasks = await getTasks(projectId, filters);-- return c.json(tasks);- },- )- .patch(- "/bulk",- describeRoute({- operationId: "bulkUpdateTasks",- tags: ["Tasks"],- description: "Perform bulk operations on multiple tasks",- responses: {- 200: {- description: "Bulk operation completed successfully",- content: {- "application/json": {- schema: resolver(- v.object({- success: v.boolean(),- updatedCount: v.number(),- }),- ),- },- },- },- },- }),- validator(- "json",- v.object({- taskIds: v.pipe(v.array(v.string()), v.minLength(1)),- operation: v.picklist([- "updateStatus",- "updatePriority",- "updateAssignee",- "delete",- "addLabel",- "removeLabel",- "updateDueDate",- ] as const),- value: v.optional(v.nullable(v.string())),- }),+import {+ boardSchema,+ bulkResultSchema,+ finalizedAssetSchema,+ imageUploadSchema,+ moveTaskResultSchema,+ taskExportSchema,+ taskImportResultSchema,+ taskSchema,+ taskWithAssigneeSchema,+} from "./response";+import {+ bulkUpdateBody,+ createTaskBody,+ finalizeImageUploadBody,+ imageUploadBody,+ importTasksBody,+ listTasksQuery,+ moveTaskBody,+ projectIdParam,+ taskParam,+ updateAssigneeBody,+ updateDescriptionBody,+ updateDueDateBody,+ updatePriorityBody,+ updateStatusBody,+ updateTaskBody,+ updateTitleBody,+} from "./schema";++const listTasksRoute = createRoute({+ method: "get",+ operationId: "listTasks",+ path: "/tasks/{projectId}",+ tags: ["Tasks"],+ summary: "List tasks",+ description:+ "Get a project's board: its columns, each with the tasks in it, plus the archived and planned buckets. Filter and paginate with the query parameters.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam, query: listTasksQuery },+ responses: {+ 200: jsonResponse("The project board", boardSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const bulkUpdateTasksRoute = createRoute({+ method: "patch",+ operationId: "bulkUpdateTasks",+ path: "/bulk",+ tags: ["Tasks"],+ summary: "Bulk update tasks",+ description:+ "Apply one operation to many tasks at once. Every task must be in the same workspace.",+ middleware: [workspaceAccess.fromTasks(),requireBulkTaskPermission,requireBulkTaskEntitlement,- async (c) => {- const { taskIds, operation, value } = c.req.valid("json");- const userId = c.get("userId");-- if (!userId) {- throw new HTTPException(401, { message: "Unauthorized" });- }-- if (- operation !== "delete" &&- operation !== "updateDueDate" &&- value === undefined- ) {- throw new HTTPException(400, {- message: "Value is required for this operation",- });- }-- const result = await bulkUpdateTasks({- taskIds,- operation,- value,- userId,- });-- return c.json(result);+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: bulkUpdateBody } },},- )- .post(- "/:projectId",- describeRoute({- operationId: "createTask",- tags: ["Tasks"],- description: "Create a new task in a project",- responses: {- 200: {- description: "Task created successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator(- "json",- v.object({- title: v.string(),- description: v.string(),- startDate: v.optional(v.string()),- dueDate: v.optional(v.string()),- priority: v.picklist(VALID_PRIORITIES),- status: v.string(),- userId: v.optional(v.string()),- }),+ },+ responses: {+ 200: jsonResponse("Bulk operation result", bulkResultSchema),+ 400: errorResponse(+ "Invalid body, or the tasks span more than one workspace",+ ),+ 403: errorResponse(+ "No workspace access, or missing the permission the operation needs",),+ 404: errorResponse("No tasks found"),+ },+});++const createTaskRoute = createRoute({+ method: "post",+ operationId: "createTask",+ path: "/{projectId}",+ tags: ["Tasks"],+ summary: "Create task",+ description:+ "Add a task to a project. It is placed in the column named by `status`.",+ middleware: [workspaceAccess.fromProject("projectId"),requireWorkspacePermission({ task: ["create"] }),requireEntitlement,- async (c) => {- const { projectId } = c.req.param();- const {- title,- description,- startDate,- dueDate,- priority,- status,- userId,- } = c.req.valid("json");-- const parsedStartDate =- startDate !== undefined- ? validateAndParseDate(startDate, "startDate")- : undefined;- const parsedDueDate =- dueDate !== undefined- ? validateAndParseDate(dueDate, "dueDate")- : undefined;-- validateDateRange(parsedStartDate, parsedDueDate);-- const task = await createTask({- projectId,- currentUserId: c.get("userId"),- userId: userId,- title,- description,- startDate: parsedStartDate,- dueDate: parsedDueDate,- priority,- status,- });-- return c.json(task);- },- )- .get(- "/:id",- describeRoute({- operationId: "getTask",- tags: ["Tasks"],- description: "Get a specific task by ID",- responses: {- 200: {- description: "Task details",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- workspaceAccess.fromTask(),- async (c) => {- const { id } = c.req.valid("param");-- const task = await getTask(id);-- return c.json(task);+ ] as const,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createTaskBody } },},- )- .put(- "/move/:id",- describeRoute({- operationId: "moveTask",- tags: ["Tasks"],- description: "Move a task to another project",- responses: {- 200: {- description: "Task moved successfully",- content: {- "application/json": {- schema: resolver(- v.object({- task: taskSchema,- sourceProjectId: v.string(),- destinationProjectId: v.string(),- }),- ),- },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- destinationProjectId: v.string(),- destinationStatus: v.optional(v.string()),- }),+ },+ responses: {+ 200: jsonResponse("The created task", taskSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing task:create permission",+ ),+ },+});++const getTaskRoute = createRoute({+ method: "get",+ operationId: "getTask",+ path: "/{id}",+ tags: ["Tasks"],+ summary: "Get task",+ description: "Get a single task by ID, with its assignee's name resolved.",+ middleware: [workspaceAccess.fromTask()] as const,+ request: { params: taskParam },+ responses: {+ 200: jsonResponse("Task details", taskWithAssigneeSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",),+ 403: errorResponse("No access to the task's workspace"),+ },+});++const moveTaskRoute = createRoute({+ method: "put",+ operationId: "moveTask",+ path: "/move/{id}",+ tags: ["Tasks"],+ summary: "Move task",+ description:+ "Move a task to another project, optionally into a named column. Both projects must be in the same workspace.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { destinationProjectId, destinationStatus } = c.req.valid("json");- const currentUserId = c.get("userId");-- const result = await moveTask({- taskId: id,- destinationProjectId,- destinationStatus,- currentUserId,- });-- return c.json(result);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: moveTaskBody } },},- )- .put(- "/:id",- describeRoute({- operationId: "updateTask",- tags: ["Tasks"],- description: "Update all fields of a task",- responses: {- 200: {- description: "Task updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- title: v.string(),- description: v.string(),- startDate: v.optional(v.string()),- dueDate: v.optional(v.string()),- priority: v.picklist(VALID_PRIORITIES),- status: v.string(),- projectId: v.string(),- position: v.number(),- userId: v.optional(v.string()),- }),+ },+ responses: {+ 200: jsonResponse(+ "The moved task, with both project ids",+ moveTaskResultSchema,+ ),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),+ 404: errorResponse("Task or destination project not found"),+ },+});++const updateTaskRoute = createRoute({+ method: "put",+ operationId: "updateTask",+ path: "/{id}",+ tags: ["Tasks"],+ summary: "Update task",+ description:+ "Replace every field of a task. Use the single-field routes for narrower edits.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireTaskAssigneePermission,requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const {- title,- description,- startDate,- dueDate,- priority,- status,- projectId,- position,- userId,- } = c.req.valid("json");-- const currentUserId = c.get("userId");-- const parsedStartDate =- startDate !== undefined- ? validateAndParseDate(startDate, "startDate")- : undefined;- const parsedDueDate =- dueDate !== undefined- ? validateAndParseDate(dueDate, "dueDate")- : undefined;-- validateDateRange(parsedStartDate, parsedDueDate);-- const task = await updateTask(- id,- title,- status,- parsedStartDate,- parsedDueDate,- projectId,- description,- priority,- position,- userId,- currentUserId,- );-- return c.json(task);- },- )- .get(- "/export/:projectId",- describeRoute({- operationId: "exportTasks",- tags: ["Tasks"],- description: "Export all tasks from a project",- responses: {- 200: {- description: "Exported tasks data",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");-- const exportData = await exportTasks(projectId);-- return c.json(exportData);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateTaskBody } },},- )- .post(- "/import/:projectId",- describeRoute({- operationId: "importTasks",- tags: ["Tasks"],- description: "Import multiple tasks into a project",- responses: {- 200: {- description: "Tasks imported successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- tasks: v.array(- v.object({- title: v.string(),- description: v.optional(v.string()),- status: v.string(),- priority: v.optional(v.string()),- startDate: v.optional(v.nullable(v.string())),- dueDate: v.optional(v.nullable(v.string())),- userId: v.optional(v.nullable(v.string())),- }),- ),- }),+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update or task:assign permission",+ ),+ },+});++const exportTasksRoute = createRoute({+ method: "get",+ operationId: "exportTasks",+ path: "/export/{projectId}",+ tags: ["Tasks"],+ summary: "Export tasks",+ description:+ "Export a project's tasks, with their labels, as a JSON document.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The exported project and tasks", taskExportSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const importTasksRoute = createRoute({+ method: "post",+ operationId: "importTasks",+ path: "/import/{projectId}",+ tags: ["Tasks"],+ summary: "Import tasks",+ description:+ "Import tasks into a project. Each task is reported individually, so a partial import still returns 200.",+ middleware: [workspaceAccess.fromProject("projectId"),requireWorkspacePermission({ task: ["create"] }),requireEntitlement,- async (c) => {- const { projectId } = c.req.valid("param");- const { tasks } = c.req.valid("json");- const currentUserId = c.get("userId");-- const result = await importTasks(projectId, tasks, currentUserId);-- return c.json(result);+ ] as const,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: importTasksBody } },},- )- .delete(- "/:id",- describeRoute({- operationId: "deleteTask",- tags: ["Tasks"],- description: "Delete a task by ID",- responses: {- 200: {- description: "Task deleted successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("Per-task import outcome", taskImportResultSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing task:create permission",+ ),+ },+});++const deleteTaskRoute = createRoute({+ method: "delete",+ operationId: "deleteTask",+ path: "/{id}",+ tags: ["Tasks"],+ summary: "Delete task",+ description:+ "Permanently delete a task and its comments, labels, and time entries.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["delete"] }),- async (c) => {- const { id } = c.req.valid("param");-- const currentUserId = c.get("userId");- const task = await deleteTask(id, currentUserId);-- return c.json(task);- },- )- .put(- "/status/:id",- describeRoute({- operationId: "updateTaskStatus",- tags: ["Tasks"],- description: "Update only the status of a task",- responses: {- 200: {- description: "Task status updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ status: v.string() })),+ ] as const,+ request: { params: taskParam },+ responses: {+ 200: jsonResponse("The deleted task", taskSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing task:delete permission",+ ),+ },+});++const updateTaskStatusRoute = createRoute({+ method: "put",+ operationId: "updateTaskStatus",+ path: "/status/{id}",+ tags: ["Tasks"],+ summary: "Update task status",+ description: "Move a task to another column in the same project.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { status } = c.req.valid("json");- const currentUserId = c.get("userId");-- const task = await updateTaskStatus({ id, status, currentUserId });-- return c.json(task);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateStatusBody } },},- )- .put(- "/priority/:id",- describeRoute({- operationId: "updateTaskPriority",- tags: ["Tasks"],- description: "Update only the priority of a task",- responses: {- 200: {- description: "Task priority updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ priority: v.picklist(VALID_PRIORITIES) })),+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ },+});++const updateTaskPriorityRoute = createRoute({+ method: "put",+ operationId: "updateTaskPriority",+ path: "/priority/{id}",+ tags: ["Tasks"],+ summary: "Update task priority",+ description: "Set a task's priority.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { priority } = c.req.valid("json");- const currentUserId = c.get("userId");-- const task = await updateTaskPriority({ id, priority, currentUserId });-- return c.json(task);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updatePriorityBody } },},- )- .put(- "/assignee/:id",- describeRoute({- operationId: "updateTaskAssignee",- tags: ["Tasks"],- description: "Assign or unassign a task to a user",- responses: {- 200: {- description: "Task assignee updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ userId: v.nullable(v.string()) })),+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid priority, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ },+});++const updateTaskAssigneeRoute = createRoute({+ method: "put",+ operationId: "updateTaskAssignee",+ path: "/assignee/{id}",+ tags: ["Tasks"],+ summary: "Update task assignee",+ description:+ "Assign a task to a workspace member, or send null to unassign it.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["assign"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { userId } = c.req.valid("json");- const currentUserId = c.get("userId");-- const task = await updateTaskAssignee({ id, userId, currentUserId });-- return c.json(task);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateAssigneeBody } },},- )- .put(- "/due-date/:id",- describeRoute({- operationId: "updateTaskDueDate",- tags: ["Tasks"],- description: "Update only the due date of a task",- responses: {- 200: {- description: "Task due date updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ dueDate: v.optional(v.string()) })),+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:assign permission",+ ),+ 404: errorResponse("Assignee is not a member of the workspace"),+ },+});++const updateTaskDueDateRoute = createRoute({+ method: "put",+ operationId: "updateTaskDueDate",+ path: "/due-date/{id}",+ tags: ["Tasks"],+ summary: "Update task due date",+ description: "Set or clear a task's due date.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { dueDate = null } = c.req.valid("json");- const currentUserId = c.get("userId");-- const task = await updateTaskDueDate({- id,- dueDate: dueDate ? validateAndParseDate(dueDate, "dueDate") : null,- currentUserId,- });-- return c.json(task);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateDueDateBody } },},- )-- .put(- "/title/:id",- describeRoute({- operationId: "updateTaskTitle",- tags: ["Tasks"],- description: "Update only the title of a task",- responses: {- 200: {- description: "Task title updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ title: v.string() })),+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid date, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ },+});++const updateTaskTitleRoute = createRoute({+ method: "put",+ operationId: "updateTaskTitle",+ path: "/title/{id}",+ tags: ["Tasks"],+ summary: "Update task title",+ description: "Rename a task.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { title } = c.req.valid("json");- const currentUserId = c.get("userId");-- const task = await updateTaskTitle({ id, title, currentUserId });-- return c.json(task);+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateTitleBody } },},- )-- .put(- "/image-upload/:id",- describeRoute({- operationId: "createTaskImageUpload",- tags: ["Tasks"],- description:- "Create a presigned image upload URL for a task description or comment",- responses: {- 200: {- description: "Image upload URL created successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- filename: v.string(),- contentType: v.string(),- size: v.number(),- surface: v.picklist(["description", "comment"] as const),- }),+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),+ },+});++const createTaskImageUploadRoute = createRoute({+ method: "put",+ operationId: "createTaskImageUpload",+ path: "/image-upload/{id}",+ tags: ["Tasks"],+ summary: "Create image upload URL",+ description:+ "Get a presigned URL for uploading an image used in a task description or comment. PUT the bytes to it, then call the finalize route.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { filename, contentType, size, surface } = c.req.valid("json");-- try {- validateTaskAssetUploadInput(contentType, size);- } catch (error) {- throw new HTTPException(400, {- message:- error instanceof Error- ? error.message- : "Invalid image upload request",- });- }-- const [taskContext] = await db- .select({- taskId: taskTable.id,- projectId: taskTable.projectId,- workspaceId: workspaceTable.id,- })- .from(taskTable)- .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))- .innerJoin(- workspaceTable,- eq(projectTable.workspaceId, workspaceTable.id),- )- .where(eq(taskTable.id, id))- .limit(1);-- if (!taskContext) {- throw new HTTPException(404, { message: "Task not found" });- }-- try {- const upload = await createTaskImageUploadUrl({- workspaceId: taskContext.workspaceId,- projectId: taskContext.projectId,- taskId: taskContext.taskId,- surface,- filename,- contentType,- });-- return c.json(upload);- } catch (error) {- throw new HTTPException(503, {- message:- error instanceof Error- ? error.message- : "Image uploads are not configured",- });- }+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: imageUploadBody } },},- )- .post(- "/image-upload/:id/finalize",- describeRoute({- operationId: "finalizeTaskImageUpload",- tags: ["Tasks"],- description:- "Finalize an uploaded task image and create a private asset record",- responses: {- 200: {- description: "Image upload finalized successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- key: v.string(),- filename: v.string(),- contentType: v.string(),- size: v.number(),- surface: v.picklist(["description", "comment"] as const),- }),+ },+ responses: {+ 200: jsonResponse("The presigned upload", imageUploadSchema),+ 400: errorResponse("Unsupported content type, or the file is too large"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),+ 404: errorResponse("Task not found"),+ 503: errorResponse("Image uploads are not configured on this instance"),+ },+});++const finalizeTaskImageUploadRoute = createRoute({+ method: "post",+ operationId: "finalizeTaskImageUpload",+ path: "/image-upload/{id}/finalize",+ tags: ["Tasks"],+ summary: "Finalize image upload",+ description:+ "Record an uploaded image as a private asset and return the URL to reference it by.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { key, filename, contentType, size, surface } = c.req.valid("json");- const userId = c.get("userId");-- try {- validateTaskAssetUploadInput(contentType, size);- } catch (error) {- throw new HTTPException(400, {- message:- error instanceof Error- ? error.message- : "Invalid image upload request",- });- }-- const [taskContext] = await db- .select({- taskId: taskTable.id,- projectId: taskTable.projectId,- workspaceId: workspaceTable.id,- })- .from(taskTable)- .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))- .innerJoin(- workspaceTable,- eq(projectTable.workspaceId, workspaceTable.id),- )- .where(eq(taskTable.id, id))- .limit(1);-- if (!taskContext) {- throw new HTTPException(404, { message: "Task not found" });- }-- const normalizedKey = key.trim();- if (- !assertTaskImageKeyMatchesContext(normalizedKey, {- workspaceId: taskContext.workspaceId,- projectId: taskContext.projectId,- taskId: taskContext.taskId,- surface,- })- ) {- throw new HTTPException(400, {- message: "Image upload key does not match the task context.",- });- }-- const [existingAsset] = await db- .select({ id: assetTable.id })- .from(assetTable)- .where(eq(assetTable.objectKey, normalizedKey))- .limit(1);-- const [asset] = existingAsset- ? await db- .update(assetTable)- .set({- workspaceId: taskContext.workspaceId,- projectId: taskContext.projectId,- taskId: taskContext.taskId,- filename,- mimeType: contentType,- size,- kind: isImageContentType(contentType) ? "image" : "attachment",- surface,- createdBy: userId || null,- })- .where(eq(assetTable.id, existingAsset.id))- .returning({- id: assetTable.id,- })- : await db- .insert(assetTable)- .values({- workspaceId: taskContext.workspaceId,- projectId: taskContext.projectId,- taskId: taskContext.taskId,- objectKey: normalizedKey,- filename,- mimeType: contentType,- size,- kind: isImageContentType(contentType) ? "image" : "attachment",- surface,- createdBy: userId || null,- })- .returning({- id: assetTable.id,- });-- if (!asset) {- throw new HTTPException(500, {- message: "Failed to save asset",- });- }-- const apiBaseUrl = normalizeApiServerUrl(- process.env.KANEO_API_URL || new URL(c.req.url).origin,- );- return c.json({- id: asset.id,- url: `${apiBaseUrl}/asset/${asset.id}`,- });+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: finalizeImageUploadBody } },},- )- .put(- "/description/:id",- describeRoute({- operationId: "updateTaskDescription",- tags: ["Tasks"],- description: "Update only the description of a task",- responses: {- 200: {- description: "Task description updated successfully",- content: {- "application/json": { schema: resolver(taskSchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator("json", v.object({ description: v.string() })),+ },+ responses: {+ 200: jsonResponse("The stored asset", finalizedAssetSchema),+ 400: errorResponse(+ "Invalid upload, or the key does not belong to this task",+ ),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ 404: errorResponse("Task not found"),+ },+});++const updateTaskDescriptionRoute = createRoute({+ method: "put",+ operationId: "updateTaskDescription",+ path: "/description/{id}",+ tags: ["Tasks"],+ summary: "Update task description",+ description: "Replace a task's description.",+ middleware: [workspaceAccess.fromTask(),requireWorkspacePermission({ task: ["update"] }),requireEntitlement,- async (c) => {- const { id } = c.req.valid("param");- const { description } = c.req.valid("json");- const currentUserId = c.get("userId");-- const task = await updateTaskDescription({- id,- description,- currentUserId,+ ] as const,+ request: {+ params: taskParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateDescriptionBody } },+ },+ },+ responses: {+ 200: jsonResponse("The updated task", taskSchema),+ 400: errorResponse("Invalid body, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ },+});++const task = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(listTasksRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const filters = c.req.valid("query") || {};++ const tasks = await getTasks(projectId, filters);++ return c.json(tasks, 200);+ })+ .openapi(bulkUpdateTasksRoute, async (c) => {+ const { taskIds, operation, value } = c.req.valid("json");+ const userId = c.get("userId");++ if (!userId) {+ throw new HTTPException(401, { message: "Unauthorized" });+ }++ if (+ operation !== "delete" &&+ operation !== "updateDueDate" &&+ value === undefined+ ) {+ throw new HTTPException(400, {+ message: "Value is required for this operation",+ });+ }++ const result = await bulkUpdateTasks({+ taskIds,+ operation,+ value,+ userId,+ });++ return c.json(result, 200);+ })+ .openapi(createTaskRoute, async (c) => {+ const { projectId } = c.req.param();+ const { title, description, startDate, dueDate, priority, status, userId } =+ c.req.valid("json");++ const parsedStartDate =+ startDate !== undefined+ ? validateAndParseDate(startDate, "startDate")+ : undefined;+ const parsedDueDate =+ dueDate !== undefined+ ? validateAndParseDate(dueDate, "dueDate")+ : undefined;++ validateDateRange(parsedStartDate, parsedDueDate);++ const task = await createTask({+ projectId,+ currentUserId: c.get("userId"),+ userId: userId,+ title,+ description,+ startDate: parsedStartDate,+ dueDate: parsedDueDate,+ priority,+ status,+ });++ return c.json(task, 200);+ })+ .openapi(getTaskRoute, async (c) => {+ const { id } = c.req.valid("param");++ const task = await getTask(id);++ return c.json(task, 200);+ })+ .openapi(moveTaskRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { destinationProjectId, destinationStatus } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const result = await moveTask({+ taskId: id,+ destinationProjectId,+ destinationStatus,+ currentUserId,+ });++ return c.json(result, 200);+ })+ .openapi(updateTaskRoute, async (c) => {+ const { id } = c.req.valid("param");+ const {+ title,+ description,+ startDate,+ dueDate,+ priority,+ status,+ projectId,+ position,+ userId,+ } = c.req.valid("json");++ const currentUserId = c.get("userId");++ const parsedStartDate =+ startDate !== undefined+ ? validateAndParseDate(startDate, "startDate")+ : undefined;+ const parsedDueDate =+ dueDate !== undefined+ ? validateAndParseDate(dueDate, "dueDate")+ : undefined;++ validateDateRange(parsedStartDate, parsedDueDate);++ const task = await updateTask(+ id,+ title,+ status,+ parsedStartDate,+ parsedDueDate,+ projectId,+ description,+ priority,+ position,+ userId,+ currentUserId,+ );++ return c.json(task, 200);+ })+ .openapi(exportTasksRoute, async (c) => {+ const { projectId } = c.req.valid("param");++ const exportData = await exportTasks(projectId);++ return c.json(exportData, 200);+ })+ .openapi(importTasksRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const { tasks } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const result = await importTasks(projectId, tasks, currentUserId);++ return c.json(result, 200);+ })+ .openapi(deleteTaskRoute, async (c) => {+ const { id } = c.req.valid("param");++ const currentUserId = c.get("userId");+ const task = await deleteTask(id, currentUserId);++ return c.json(task, 200);+ })+ .openapi(updateTaskStatusRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { status } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const task = await updateTaskStatus({ id, status, currentUserId });++ return c.json(task, 200);+ })+ .openapi(updateTaskPriorityRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { priority } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const task = await updateTaskPriority({ id, priority, currentUserId });++ return c.json(task, 200);+ })+ .openapi(updateTaskAssigneeRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { userId } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const task = await updateTaskAssignee({ id, userId, currentUserId });++ return c.json(task, 200);+ })+ .openapi(updateTaskDueDateRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { dueDate = null } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const task = await updateTaskDueDate({+ id,+ dueDate: dueDate ? validateAndParseDate(dueDate, "dueDate") : null,+ currentUserId,+ });++ return c.json(task, 200);+ })+ .openapi(updateTaskTitleRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { title } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const task = await updateTaskTitle({ id, title, currentUserId });++ return c.json(task, 200);+ })+ .openapi(createTaskImageUploadRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { filename, contentType, size, surface } = c.req.valid("json");++ try {+ validateTaskAssetUploadInput(contentType, size);+ } catch (error) {+ throw new HTTPException(400, {+ message:+ error instanceof Error+ ? error.message+ : "Invalid image upload request",+ });+ }++ const [taskContext] = await db+ .select({+ taskId: taskTable.id,+ projectId: taskTable.projectId,+ workspaceId: workspaceTable.id,+ })+ .from(taskTable)+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))+ .innerJoin(+ workspaceTable,+ eq(projectTable.workspaceId, workspaceTable.id),+ )+ .where(eq(taskTable.id, id))+ .limit(1);++ if (!taskContext) {+ throw new HTTPException(404, { message: "Task not found" });+ }++ try {+ const upload = await createTaskImageUploadUrl({+ workspaceId: taskContext.workspaceId,+ projectId: taskContext.projectId,+ taskId: taskContext.taskId,+ surface,+ filename,+ contentType,});- return c.json(task);- },- );+ return c.json(upload, 200);+ } catch (error) {+ throw new HTTPException(503, {+ message:+ error instanceof Error+ ? error.message+ : "Image uploads are not configured",+ });+ }+ })+ .openapi(finalizeTaskImageUploadRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { key, filename, contentType, size, surface } = c.req.valid("json");+ const userId = c.get("userId");++ try {+ validateTaskAssetUploadInput(contentType, size);+ } catch (error) {+ throw new HTTPException(400, {+ message:+ error instanceof Error+ ? error.message+ : "Invalid image upload request",+ });+ }++ const [taskContext] = await db+ .select({+ taskId: taskTable.id,+ projectId: taskTable.projectId,+ workspaceId: workspaceTable.id,+ })+ .from(taskTable)+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))+ .innerJoin(+ workspaceTable,+ eq(projectTable.workspaceId, workspaceTable.id),+ )+ .where(eq(taskTable.id, id))+ .limit(1);++ if (!taskContext) {+ throw new HTTPException(404, { message: "Task not found" });+ }++ const normalizedKey = key.trim();+ if (+ !assertTaskImageKeyMatchesContext(normalizedKey, {+ workspaceId: taskContext.workspaceId,+ projectId: taskContext.projectId,+ taskId: taskContext.taskId,+ surface,+ })+ ) {+ throw new HTTPException(400, {+ message: "Image upload key does not match the task context.",+ });+ }++ const [existingAsset] = await db+ .select({ id: assetTable.id })+ .from(assetTable)+ .where(eq(assetTable.objectKey, normalizedKey))+ .limit(1);++ const [asset] = existingAsset+ ? await db+ .update(assetTable)+ .set({+ workspaceId: taskContext.workspaceId,+ projectId: taskContext.projectId,+ taskId: taskContext.taskId,+ filename,+ mimeType: contentType,+ size,+ kind: isImageContentType(contentType) ? "image" : "attachment",+ surface,+ createdBy: userId || null,+ })+ .where(eq(assetTable.id, existingAsset.id))+ .returning({+ id: assetTable.id,+ })+ : await db+ .insert(assetTable)+ .values({+ workspaceId: taskContext.workspaceId,+ projectId: taskContext.projectId,+ taskId: taskContext.taskId,+ objectKey: normalizedKey,+ filename,+ mimeType: contentType,+ size,+ kind: isImageContentType(contentType) ? "image" : "attachment",+ surface,+ createdBy: userId || null,+ })+ .returning({+ id: assetTable.id,+ });++ if (!asset) {+ throw new HTTPException(500, {+ message: "Failed to save asset",+ });+ }++ const apiBaseUrl = normalizeApiServerUrl(+ process.env.KANEO_API_URL || new URL(c.req.url).origin,+ );+ return c.json(+ {+ id: asset.id,+ url: `${apiBaseUrl}/asset/${asset.id}`,+ },+ 200,+ );+ })+ .openapi(updateTaskDescriptionRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { description } = c.req.valid("json");+ const currentUserId = c.get("userId");++ const task = await updateTaskDescription({+ id,+ description,+ currentUserId,+ });++ return c.json(task, 200);+ });export default task;diff --git a/apps/api/src/task/response.ts b/apps/api/src/task/response.tsnew file mode 100644index 000000000..bd9738417--- /dev/null+++ b/apps/api/src/task/response.ts@@ -0,0 +1,213 @@+import { nullableResponseTimestamp, responseTimestamp, z } from "../openapi";++const priorityDescription = "One of: no-priority, low, medium, high, urgent.";++export const taskSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ position: z.number().nullable().openapi({+ description: "Order within its column, ascending.",+ }),+ number: z.number().nullable().openapi({+ description: "Per-project counter shown as {projectSlug}-{number}.",+ }),+ userId: z+ .string()+ .nullable()+ .openapi({ description: "The assignee, if any." }),+ title: z.string(),+ description: z.string().nullable(),+ status: z.string().openapi({+ description: "The slug of the column the task sits in.",+ }),+ priority: z.string().openapi({ description: priorityDescription }),+ // Nullable, not optional: the columns are always selected and may be null.+ startDate: nullableResponseTimestamp,+ dueDate: nullableResponseTimestamp,+ createdAt: responseTimestamp,+ })+ .openapi("Task");++// The single-task route joins the assignee; the list/board route returns the+// richer BoardTask below.+export const taskWithAssigneeSchema = taskSchema+ .extend({+ assigneeName: z.string().nullable(),+ assigneeId: z.string().nullable(),+ })+ .openapi("TaskWithAssignee");++const taskLabelSchema = z+ .object({ id: z.string(), name: z.string(), color: z.string() })+ .openapi("TaskLabel");++const taskExternalLinkSchema = z+ .object({+ id: z.string(),+ taskId: z.string(),+ integrationId: z.string(),+ resourceType: z.string(),+ externalId: z.string(),+ url: z.string(),+ title: z.string().nullable(),+ metadata: z.record(z.string(), z.unknown()).nullable().openapi({+ description:+ "Provider-specific payload, already parsed from the stored JSON string.",+ }),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("TaskExternalLink");++// The board task carries the joined assignee and the task's labels and links.+export const boardTaskSchema = z+ .object({+ id: z.string(),+ title: z.string(),+ number: z.number().nullable(),+ description: z.string().nullable(),+ status: z.string(),+ priority: z.string().openapi({ description: priorityDescription }),+ startDate: nullableResponseTimestamp,+ dueDate: nullableResponseTimestamp,+ position: z.number().nullable(),+ createdAt: responseTimestamp,+ userId: z.string().nullable(),+ assigneeName: z.string().nullable(),+ assigneeId: z.string().nullable(),+ assigneeImage: z.string().nullable(),+ projectId: z.string(),+ labels: z.array(taskLabelSchema),+ externalLinks: z.array(taskExternalLinkSchema),+ })+ .openapi("BoardTask");++export const boardColumnSchema = z+ .object({+ id: z.string().openapi({ description: "The column slug, same as `slug`." }),+ slug: z.string(),+ name: z.string(),+ icon: z.string().nullable(),+ isFinal: z.boolean(),+ tasks: z.array(boardTaskSchema),+ })+ .openapi("BoardColumn");++// listTasks returns the project's board, not a flat task list.+export const boardSchema = z+ .object({+ data: z+ .object({+ id: z.string(),+ name: z.string(),+ slug: z.string(),+ icon: z.string().nullable(),+ description: z.string().nullable(),+ isPublic: z.boolean().nullable(),+ workspaceId: z.string(),+ columns: z.array(boardColumnSchema),+ archivedTasks: z.array(boardTaskSchema),+ plannedTasks: z.array(boardTaskSchema),+ })+ .openapi("Board"),+ pagination: z+ .object({+ total: z.number(),+ page: z.number(),+ pageSize: z.number(),+ totalPages: z.number(),+ })+ .openapi({+ description:+ "When no page/limit is given, everything is returned on a single page.",+ })+ .openapi("BoardPagination"),+ })+ .openapi("BoardResponse");++export const bulkResultSchema = z+ .object({ success: z.boolean(), updatedCount: z.number() })+ .openapi("BulkTaskResult");++export const moveTaskResultSchema = z+ .object({+ task: taskSchema,+ sourceProjectId: z.string(),+ destinationProjectId: z.string(),+ })+ .openapi("MoveTaskResult");++export const taskExportSchema = z+ .object({+ project: z+ .object({+ name: z.string(),+ slug: z.string(),+ description: z.string().nullable(),+ exportedAt: z.string().openapi({ format: "date-time" }),+ })+ .openapi("TaskExportProject"),+ tasks: z.array(+ z+ .object({+ title: z.string(),+ description: z.string(),+ status: z.string(),+ priority: z.string(),+ dueDate: z.string().nullable().openapi({ format: "date-time" }),+ startDate: z.string().nullable().openapi({ format: "date-time" }),+ userId: z.string().nullable(),+ labels: z+ .array(+ z+ .object({ name: z.string(), color: z.string() })+ .openapi("ExportedTaskLabel"),+ )+ .openapi({+ description: "Label names and colors, without their ids.",+ }),+ })+ .openapi("ExportedTask"),+ ),+ })+ .openapi("TaskExport");++export const taskImportResultSchema = z+ .object({+ results: z+ .object({+ total: z.number(),+ successful: z.number(),+ failed: z.number(),+ tasks: z.array(z.unknown()).openapi({+ description: "Per-task outcome, each carrying a success flag.",+ }),+ })+ .openapi("TaskImportSummary"),+ })+ .openapi("TaskImportResult");++export const imageUploadSchema = z+ .object({+ key: z.string().openapi({+ description: "Object key to send back to the finalize route.",+ }),+ uploadUrl: z.string().openapi({+ description: "Presigned URL to PUT the image bytes to.",+ }),+ headers: z.record(z.string(), z.string()).openapi({+ description:+ "Headers that must accompany the upload request, including Content-Type.",+ }),+ })+ .openapi("TaskImageUpload");++export const finalizedAssetSchema = z+ .object({+ id: z.string(),+ url: z.string().openapi({+ description: "Where the stored image can be read back from.",+ }),+ })+ .openapi("TaskImageAsset");diff --git a/apps/api/src/task/schema.ts b/apps/api/src/task/schema.tsnew file mode 100644index 000000000..1847a7a0e--- /dev/null+++ b/apps/api/src/task/schema.ts@@ -0,0 +1,121 @@+import { z } from "../openapi";+import { VALID_PRIORITIES } from "./validate-task-fields";++export const taskParam = z.object({ id: z.string() });++export const projectIdParam = z.object({ projectId: z.string() });++const priority = z.enum(VALID_PRIORITIES);++// Every filter is optional; the outer object is required so it can be a+// RouteParameter, and the handler treats an empty object as "no filters".+export const listTasksQuery = z.object({+ status: z.string().optional(),+ priority: z.string().optional(),+ assigneeId: z.string().optional(),+ // Query strings arrive as text; both are coerced after validation.+ page: z+ .string()+ .optional()+ .transform((v) => (v === undefined ? undefined : Number(v))),+ limit: z+ .string()+ .optional()+ .transform((v) => (v === undefined ? undefined : Number(v))),+ sortBy: z+ .enum(["createdAt", "priority", "dueDate", "position", "title", "number"])+ .optional(),+ sortOrder: z.enum(["asc", "desc"]).optional(),+ dueBefore: z.string().optional(),+ dueAfter: z.string().optional(),+});++export const bulkUpdateBody = z.object({+ taskIds: z.array(z.string()).min(1),+ operation: z.enum([+ "updateStatus",+ "updatePriority",+ "updateAssignee",+ "delete",+ "addLabel",+ "removeLabel",+ "updateDueDate",+ ]),+ value: z.string().nullable().optional().openapi({+ description:+ "The new value for the chosen operation. Unused by `delete`; null clears an assignee or due date.",+ }),+});++export const createTaskBody = z.object({+ title: z.string(),+ description: z.string(),+ startDate: z.string().optional(),+ dueDate: z.string().optional(),+ priority,+ status: z.string().openapi({ description: "The target column's slug." }),+ userId: z.string().optional().openapi({ description: "Assignee, if any." }),+});++export const updateTaskBody = z.object({+ title: z.string(),+ description: z.string(),+ startDate: z.string().optional(),+ dueDate: z.string().optional(),+ priority,+ status: z.string(),+ projectId: z.string(),+ position: z.number(),+ userId: z.string().optional(),+});++export const moveTaskBody = z.object({+ destinationProjectId: z.string(),+ destinationStatus: z.string().optional().openapi({+ description: "Defaults to the destination project's first column.",+ }),+});++export const importTasksBody = z.object({+ tasks: z.array(+ z.object({+ title: z.string(),+ description: z.string().optional(),+ status: z.string(),+ priority: z.string().optional(),+ startDate: z.string().nullable().optional(),+ dueDate: z.string().nullable().optional(),+ userId: z.string().nullable().optional(),+ }),+ ),+});++export const updateStatusBody = z.object({ status: z.string() });+export const updatePriorityBody = z.object({ priority });+export const updateAssigneeBody = z.object({+ userId: z.string().nullable().openapi({ description: "Null unassigns." }),+});+export const updateDueDateBody = z.object({ dueDate: z.string().optional() });+export const updateTitleBody = z.object({ title: z.string() });+export const updateDescriptionBody = z.object({ description: z.string() });++const surface = z.enum(["description", "comment"]).openapi({+ description: "Where the image is used, which decides how it is scoped.",+});++export const imageUploadBody = z.object({+ filename: z.string(),+ contentType: z.string(),+ size: z.number(),+ surface,+});++export const finalizeImageUploadBody = z.object({+ key: z+ .string()+ .openapi({ description: "The key returned when the URL was issued." }),+ filename: z.string(),+ contentType: z.string(),+ size: z.number(),+ surface,+});diff --git a/apps/api/src/telegram-integration/controllers/telegram-controller.ts b/apps/api/src/telegram-integration/controllers/telegram-controller.tsindex 4a3e1d35a..24bb0ae69 100644--- a/apps/api/src/telegram-integration/controllers/telegram-controller.ts+++ b/apps/api/src/telegram-integration/controllers/telegram-controller.ts@@ -7,22 +7,21 @@ import {defaultTelegramEvents,normalizeTelegramConfig,type TelegramConfig,+ type TelegramEventKey,telegramConfigSchema,- telegramEventsSchema,} from "../../plugins/telegram/config";-export const telegramIntegrationPatchBodySchema = v.object({- botToken: v.optional(v.string()),- chatId: v.optional(v.string()),- threadId: v.optional(v.nullable(v.number())),- chatLabel: v.optional(v.nullable(v.string())),- isActive: v.optional(v.boolean()),- events: v.optional(telegramEventsSchema),-});--export type TelegramIntegrationPatchBody = v.InferOutput<- typeof telegramIntegrationPatchBodySchema->;+// The HTTP body is validated by updateTelegramBody in ../schema; this is the+// shape it produces. Every event toggle is genuinely optional -- a patch merges+// the toggles it carries over the stored ones and leaves the rest alone.+export type TelegramIntegrationPatchBody = {+ botToken?: string;+ chatId?: string;+ threadId?: number | null;+ chatLabel?: string | null;+ isActive?: boolean;+ events?: Partial<Record<TelegramEventKey, boolean>>;+};export function buildNextTelegramConfigFromPatch(body: TelegramIntegrationPatchBody,diff --git a/apps/api/src/telegram-integration/index.ts b/apps/api/src/telegram-integration/index.tsindex d65786273..cd70cf97c 100644--- a/apps/api/src/telegram-integration/index.ts+++ b/apps/api/src/telegram-integration/index.ts@@ -1,26 +1,31 @@import { and, eq } from "drizzle-orm";-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";import db from "../database";import { integrationTable } from "../database/schema";import { publishEvent } from "../events";+import { deletedSchema, projectIdParam } from "../integrations/schema";import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";+import {+ defaultTelegramEvents,normalizeTelegramConfig,- telegramEventsSchema,validateTelegramConfig,} from "../plugins/telegram/config";-import { telegramIntegrationSchema } from "../schemas";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import {buildNextTelegramConfigFromPatch,getTelegramIntegration,parseTelegramIntegrationConfig,- telegramIntegrationPatchBodySchema,toResponse,} from "./controllers/telegram-controller";+import { telegramIntegrationSchema } from "./response";+import { createTelegramBody, updateTelegramBody } from "./schema";function safePublishIntegrationEvent(eventName:@@ -40,277 +45,277 @@ function safePublishIntegrationEvent(});}-const telegramIntegration = new Hono<{- Variables: {- userId: string;- workspaceId: string;- apiKey?: {- id: string;- userId: string;- enabled: boolean;- };- };-}>();+const manageAccess = [+ workspaceAccess.fromProject("projectId"),+ requireWorkspacePermission({ workspace: ["manage_settings"] }),+];-telegramIntegration- .get(- "/project/:projectId",- describeRoute({- operationId: "getTelegramIntegration",- tags: ["Telegram"],- description: "Get Telegram integration for a project",- responses: {- 200: {- description: "Telegram integration details",- content: {- "application/json": { schema: resolver(telegramIntegrationSchema) },- },- },- 404: {- description: "Telegram integration not found",- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const integration = await getTelegramIntegration(projectId);- return c.json(integration);+const getTelegramIntegrationRoute = createRoute({+ method: "get",+ operationId: "getTelegramIntegration",+ path: "/project/{projectId}",+ tags: ["Telegram"],+ summary: "Get Telegram integration",+ description:+ "Get the Telegram integration for a project, or null when none is configured.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse(+ "Telegram integration details, or null",+ telegramIntegrationSchema.nullable(),+ ),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const createTelegramIntegrationRoute = createRoute({+ method: "post",+ operationId: "createTelegramIntegration",+ path: "/project/{projectId}",+ tags: ["Telegram"],+ summary: "Create Telegram integration",+ description:+ "Create or replace the Telegram integration for a project. The bot token and chat are verified with Telegram before they are stored.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: createTelegramBody } },},- )- .post(- "/project/:projectId",- describeRoute({- operationId: "createTelegramIntegration",- tags: ["Telegram"],- description: "Create or replace a Telegram integration for a project",- responses: {- 200: {- description: "Telegram integration created successfully",- content: {- "application/json": { schema: resolver(telegramIntegrationSchema) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- botToken: v.pipe(v.string(), v.minLength(1)),- chatId: v.pipe(v.string(), v.minLength(1)),- threadId: v.optional(v.number()),- chatLabel: v.optional(v.string()),- events: v.optional(telegramEventsSchema),- }),+ },+ responses: {+ 200: jsonResponse(+ "The stored integration",+ telegramIntegrationSchema.nullable(),),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+ 400: errorResponse("The bot token or chat failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ },+});- const config = normalizeTelegramConfig({- botToken: body.botToken,- chatId: body.chatId,- threadId: body.threadId,- chatLabel: body.chatLabel,- events: body.events,- });+const updateTelegramIntegrationRoute = createRoute({+ method: "patch",+ operationId: "updateTelegramIntegration",+ path: "/project/{projectId}",+ tags: ["Telegram"],+ summary: "Update Telegram integration",+ description:+ "Update the Telegram integration. Omitted fields keep their current value; threadId and chatLabel accept null to clear them.",+ middleware: manageAccess,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateTelegramBody } },+ },+ },+ responses: {+ 200: jsonResponse(+ "The updated integration",+ telegramIntegrationSchema.nullable(),+ ),+ 400: errorResponse("The resulting config failed validation"),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Telegram integration not found"),+ },+});- const validation = validateTelegramConfig(config);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+const deleteTelegramIntegrationRoute = createRoute({+ method: "delete",+ operationId: "deleteTelegramIntegration",+ path: "/project/{projectId}",+ tags: ["Telegram"],+ summary: "Delete Telegram integration",+ description: "Remove the Telegram integration from a project.",+ middleware: manageAccess,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("The integration was removed", deletedSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing workspace:manage_settings",+ ),+ 404: errorResponse("Telegram integration not found"),+ },+});- const priorIntegration = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "telegram"),- ),- columns: { id: true },- });+const telegramIntegration = apiRouter<BaseVariables & { workspaceId: string }>()+ .openapi(getTelegramIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const integration = await getTelegramIntegration(projectId);+ return c.json(integration, 200);+ })+ .openapi(createTelegramIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- await db- .insert(integrationTable)- .values({- projectId,- type: "telegram",- config: JSON.stringify(config),- isActive: true,- })- .onConflictDoUpdate({- target: [integrationTable.projectId, integrationTable.type],- set: {- config: JSON.stringify(config),- updatedAt: new Date(),- },- });+ const config = normalizeTelegramConfig({+ botToken: body.botToken,+ chatId: body.chatId,+ threadId: body.threadId,+ chatLabel: body.chatLabel,+ events: { ...defaultTelegramEvents, ...(body.events ?? {}) },+ });- const integration = await getTelegramIntegration(projectId);- if (!integration) {- throw new HTTPException(500, {- message: "Failed to load Telegram integration after save",- });- }+ const validation = validateTelegramConfig(config);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",+ });+ }- const apiKey = c.get("apiKey");- safePublishIntegrationEvent(- priorIntegration ? "integration.updated" : "integration.created",- {- projectId,- userId: c.get("userId"),- integrationType: "telegram",- integrationId: integration.id,- ...(apiKey?.id ? { apiKeyId: apiKey.id } : {}),- },- );+ const priorIntegration = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "telegram"),+ ),+ columns: { id: true },+ });- return c.json(integration);- },- )- .patch(- "/project/:projectId",- describeRoute({- operationId: "updateTelegramIntegration",- tags: ["Telegram"],- description: "Update Telegram integration settings",- responses: {- 200: {- description: "Telegram integration updated successfully",- content: {- "application/json": { schema: resolver(telegramIntegrationSchema) },- },+ await db+ .insert(integrationTable)+ .values({+ projectId,+ type: "telegram",+ config: JSON.stringify(config),+ isActive: true,+ })+ .onConflictDoUpdate({+ target: [integrationTable.projectId, integrationTable.type],+ set: {+ config: JSON.stringify(config),+ updatedAt: new Date(),},- },- }),- validator("param", v.object({ projectId: v.string() })),- validator("json", telegramIntegrationPatchBodySchema),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const body = c.req.valid("json");+ });- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "telegram"),- ),+ const integration = await getTelegramIntegration(projectId);+ if (!integration) {+ throw new HTTPException(500, {+ message: "Failed to load Telegram integration after save",});+ }- if (!existing) {- throw new HTTPException(404, {- message: "Telegram integration not found",- });- }+ const apiKey = c.get("apiKey");+ safePublishIntegrationEvent(+ priorIntegration ? "integration.updated" : "integration.created",+ {+ projectId,+ userId: c.get("userId"),+ integrationType: "telegram",+ integrationId: integration.id,+ ...(apiKey?.id ? { apiKeyId: apiKey.id } : {}),+ },+ );- const currentConfig = parseTelegramIntegrationConfig(existing);- const nextConfig = normalizeTelegramConfig(- buildNextTelegramConfigFromPatch(body, currentConfig),- );+ return c.json(integration, 200);+ })+ .openapi(updateTelegramIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const body = c.req.valid("json");- const resolvedIsActive =- body.isActive !== undefined- ? body.isActive- : (existing.isActive ?? true);+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "telegram"),+ ),+ });- if (- JSON.stringify(currentConfig) === JSON.stringify(nextConfig) &&- resolvedIsActive === (existing.isActive ?? true)- ) {- return c.json(toResponse(existing));- }+ if (!existing) {+ throw new HTTPException(404, {+ message: "Telegram integration not found",+ });+ }- const validation = validateTelegramConfig(nextConfig);- if (!validation.valid) {- throw new HTTPException(400, {- message: validation.errors?.join(", ") ?? "Invalid config",- });- }+ const currentConfig = parseTelegramIntegrationConfig(existing);+ const nextConfig = normalizeTelegramConfig(+ buildNextTelegramConfigFromPatch(body, currentConfig),+ );- await db- .update(integrationTable)- .set({- config: JSON.stringify(nextConfig),- isActive: resolvedIsActive,- updatedAt: new Date(),- })- .where(eq(integrationTable.id, existing.id));+ const resolvedIsActive =+ body.isActive !== undefined ? body.isActive : (existing.isActive ?? true);- const integration = await getTelegramIntegration(projectId);- if (!integration) {- throw new HTTPException(500, {- message: "Failed to load Telegram integration after update",- });- }+ if (+ JSON.stringify(currentConfig) === JSON.stringify(nextConfig) &&+ resolvedIsActive === (existing.isActive ?? true)+ ) {+ return c.json(toResponse(existing), 200);+ }- const apiKey = c.get("apiKey");- safePublishIntegrationEvent("integration.updated", {- projectId,- userId: c.get("userId"),- integrationType: "telegram",- integrationId: integration.id,- ...(apiKey?.id ? { apiKeyId: apiKey.id } : {}),+ const validation = validateTelegramConfig(nextConfig);+ if (!validation.valid) {+ throw new HTTPException(400, {+ message: validation.errors?.join(", ") ?? "Invalid config",});+ }- return c.json(integration);- },- )- .delete(- "/project/:projectId",- describeRoute({- operationId: "deleteTelegramIntegration",- tags: ["Telegram"],- description: "Delete Telegram integration for a project",- responses: {- 200: {- description: "Telegram integration deleted successfully",- content: {- "application/json": {- schema: resolver(v.object({ success: v.boolean() })),- },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- workspaceAccess.fromProject("projectId"),- requireWorkspacePermission({ workspace: ["manage_settings"] }),- async (c) => {- const { projectId } = c.req.valid("param");+ await db+ .update(integrationTable)+ .set({+ config: JSON.stringify(nextConfig),+ isActive: resolvedIsActive,+ updatedAt: new Date(),+ })+ .where(eq(integrationTable.id, existing.id));- const existing = await db.query.integrationTable.findFirst({- where: and(- eq(integrationTable.projectId, projectId),- eq(integrationTable.type, "telegram"),- ),+ const integration = await getTelegramIntegration(projectId);+ if (!integration) {+ throw new HTTPException(500, {+ message: "Failed to load Telegram integration after update",});+ }- if (!existing) {- throw new HTTPException(404, {- message: "Telegram integration not found",- });- }+ const apiKey = c.get("apiKey");+ safePublishIntegrationEvent("integration.updated", {+ projectId,+ userId: c.get("userId"),+ integrationType: "telegram",+ integrationId: integration.id,+ ...(apiKey?.id ? { apiKeyId: apiKey.id } : {}),+ });- await db- .delete(integrationTable)- .where(eq(integrationTable.id, existing.id));+ return c.json(integration, 200);+ })+ .openapi(deleteTelegramIntegrationRoute, async (c) => {+ const { projectId } = c.req.valid("param");- const apiKey = c.get("apiKey");- safePublishIntegrationEvent("integration.deleted", {- projectId,- userId: c.get("userId"),- integrationType: "telegram",- integrationId: existing.id,- ...(apiKey?.id ? { apiKeyId: apiKey.id } : {}),+ const existing = await db.query.integrationTable.findFirst({+ where: and(+ eq(integrationTable.projectId, projectId),+ eq(integrationTable.type, "telegram"),+ ),+ });++ if (!existing) {+ throw new HTTPException(404, {+ message: "Telegram integration not found",});+ }- return c.json({ success: true });- },- );+ await db+ .delete(integrationTable)+ .where(eq(integrationTable.id, existing.id));++ const apiKey = c.get("apiKey");+ safePublishIntegrationEvent("integration.deleted", {+ projectId,+ userId: c.get("userId"),+ integrationType: "telegram",+ integrationId: existing.id,+ ...(apiKey?.id ? { apiKeyId: apiKey.id } : {}),+ });++ return c.json({ success: true }, 200);+ });export default telegramIntegration;diff --git a/apps/api/src/telegram-integration/response.ts b/apps/api/src/telegram-integration/response.tsnew file mode 100644index 000000000..82d06ca57--- /dev/null+++ b/apps/api/src/telegram-integration/response.ts@@ -0,0 +1,25 @@+import { integrationEventsSchema } from "../integrations/response";+import { responseTimestamp, z } from "../openapi";++// The bot token is a bearer credential, so only a masked form is returned.+export const telegramIntegrationSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ chatId: z.string().openapi({+ description: "The Telegram chat, group, or channel messages are sent to.",+ }),+ threadId: z.number().nullable().openapi({+ description: "Forum topic id, when the target group uses topics.",+ }),+ chatLabel: z.string().nullable().openapi({+ description: "A human-readable name for the chat, shown in the UI.",+ }),+ botTokenConfigured: z.boolean(),+ maskedBotToken: z.string(),+ events: integrationEventsSchema,+ isActive: z.boolean().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("TelegramIntegration");diff --git a/apps/api/src/telegram-integration/schema.ts b/apps/api/src/telegram-integration/schema.tsnew file mode 100644index 000000000..62d4c380b--- /dev/null+++ b/apps/api/src/telegram-integration/schema.ts@@ -0,0 +1,23 @@+import { integrationEventToggles } from "../integrations/schema";+import { z } from "../openapi";++export const createTelegramBody = z.object({+ botToken: z.string().min(1).openapi({+ description: "A Telegram bot token, in the form 123456789:AA...",+ }),+ chatId: z.string().min(1),+ threadId: z.number().optional(),+ chatLabel: z.string().optional(),+ events: integrationEventToggles.optional(),+});++// Mirrors telegramIntegrationPatchBodySchema in controllers/telegram-controller,+// which still types buildNextTelegramConfigFromPatch.+export const updateTelegramBody = z.object({+ botToken: z.string().optional(),+ chatId: z.string().optional(),+ threadId: z.number().nullable().optional(),+ chatLabel: z.string().nullable().optional(),+ isActive: z.boolean().optional(),+ events: integrationEventToggles.optional(),+});diff --git a/apps/api/src/time-entry/index.ts b/apps/api/src/time-entry/index.tsindex 65a96e7d3..cc1cf4d47 100644--- a/apps/api/src/time-entry/index.ts+++ b/apps/api/src/time-entry/index.ts@@ -1,167 +1,146 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";-import { timeEntrySchema } from "../schemas";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import createTimeEntry from "./controllers/create-time-entry";import getTimeEntriesByTaskId from "./controllers/get-time-entries";import getTimeEntry from "./controllers/get-time-entry";import updateTimeEntry from "./controllers/update-time-entry";+import { timeEntryListSchema, timeEntrySchema } from "./response";+import {+ createTimeEntryBody,+ taskIdParam,+ timeEntryParam,+ updateTimeEntryBody,+} from "./schema";-const ISO_TIMESTAMP =- /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:\d{2})$/;--function isIsoTimestamp(value: string) {- if (!ISO_TIMESTAMP.test(value) || Number.isNaN(Date.parse(value))) {- return false;- }-- const year = Number(value.slice(0, 4));- const month = Number(value.slice(5, 7));- const day = Number(value.slice(8, 10));- const probe = new Date(0);- probe.setUTCFullYear(year, month - 1, day);-- return (- probe.getUTCFullYear() === year &&- probe.getUTCMonth() === month - 1 &&- probe.getUTCDate() === day- );-}+const getTaskTimeEntriesRoute = createRoute({+ method: "get",+ operationId: "getTaskTimeEntries",+ path: "/task/{taskId}",+ tags: ["Time Entries"],+ summary: "Get task time entries",+ description: "Get every time entry logged against a task.",+ middleware: [workspaceAccess.fromTaskId()] as const,+ request: { params: taskIdParam },+ responses: {+ 200: jsonResponse("List of time entries for the task", timeEntryListSchema),+ 400: errorResponse(+ "Unknown task, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the task's workspace"),+ },+});-const timestamp = v.pipe(- v.string(),- v.check(isIsoTimestamp, "Expected an ISO 8601 timestamp"),-);+const getTimeEntryRoute = createRoute({+ method: "get",+ operationId: "getTimeEntry",+ path: "/{id}",+ tags: ["Time Entries"],+ summary: "Get time entry",+ description: "Get a single time entry by ID.",+ middleware: [workspaceAccess.fromTimeEntry()] as const,+ request: { params: timeEntryParam },+ responses: {+ 200: jsonResponse("Time entry details", timeEntrySchema),+ 400: errorResponse(+ "Unknown entry, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the entry's workspace"),+ },+});-const timeEntry = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/task/:taskId",- describeRoute({- operationId: "getTaskTimeEntries",- tags: ["Time Entries"],- description: "Get all time entries for a specific task",- responses: {- 200: {- description: "List of time entries for the task",- content: {- "application/json": { schema: resolver(v.array(timeEntrySchema)) },- },- },- },- }),- validator("param", v.object({ taskId: v.string() })),+const createTimeEntryRoute = createRoute({+ method: "post",+ operationId: "createTimeEntry",+ path: "/",+ tags: ["Time Entries"],+ summary: "Create time entry",+ description:+ "Log time against a task. Omit endTime to start a running entry that can be closed later with an update.",+ middleware: [workspaceAccess.fromTaskId(),- async (c) => {- const { taskId } = c.req.valid("param");- const timeEntries = await getTimeEntriesByTaskId(taskId);- return c.json(timeEntries);+ requireWorkspacePermission({ task: ["update"] }),+ ] as const,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: createTimeEntryBody } },},- )- .get(- "/:id",- describeRoute({- operationId: "getTimeEntry",- tags: ["Time Entries"],- description: "Get a specific time entry by ID",- responses: {- 200: {- description: "Time entry details",- content: {- "application/json": { schema: resolver(timeEntrySchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),+ },+ responses: {+ 200: jsonResponse("The created time entry", timeEntrySchema),+ 400: errorResponse("Invalid timestamps, or unknown task"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",+ ),+ },+});++const updateTimeEntryRoute = createRoute({+ method: "put",+ operationId: "updateTimeEntry",+ path: "/{id}",+ tags: ["Time Entries"],+ summary: "Update time entry",+ description:+ "Replace a time entry's start, end, and description. Setting endTime closes a running entry and fills in its duration.",+ middleware: [workspaceAccess.fromTimeEntry(),- async (c) => {- const { id } = c.req.valid("param");- const timeEntry = await getTimeEntry(id);- return c.json(timeEntry);+ requireWorkspacePermission({ task: ["update"] }),+ ] as const,+ request: {+ params: timeEntryParam,+ body: {+ required: true,+ content: { "application/json": { schema: updateTimeEntryBody } },},- )- .post(- "/",- describeRoute({- operationId: "createTimeEntry",- tags: ["Time Entries"],- description: "Create a new time entry for a task",- responses: {- 200: {- description: "Time entry created successfully",- content: {- "application/json": { schema: resolver(timeEntrySchema) },- },- },- },- }),- validator(- "json",- v.object({- taskId: v.string(),- startTime: timestamp,- endTime: v.optional(timestamp),- description: v.optional(v.string()),- }),+ },+ responses: {+ 200: jsonResponse("The updated time entry", timeEntrySchema),+ 400: errorResponse("Invalid timestamps, or unknown entry"),+ 403: errorResponse(+ "No workspace access, or missing task:update permission",),- workspaceAccess.fromTaskId(),- requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { taskId, startTime, endTime, description } = c.req.valid("json");- const userId = c.get("userId");- const timeEntry = await createTimeEntry({+ },+});++const timeEntry = apiRouter()+ .openapi(getTaskTimeEntriesRoute, async (c) =>+ c.json(await getTimeEntriesByTaskId(c.req.valid("param").taskId), 200),+ )+ .openapi(getTimeEntryRoute, async (c) =>+ c.json(await getTimeEntry(c.req.valid("param").id), 200),+ )+ .openapi(createTimeEntryRoute, async (c) => {+ const { taskId, startTime, endTime, description } = c.req.valid("json");+ return c.json(+ await createTimeEntry({taskId,- userId,+ userId: c.get("userId"),startTime: new Date(startTime),endTime: endTime ? new Date(endTime) : undefined,description,- });- return c.json(timeEntry);- },- )- .put(- "/:id",- describeRoute({- operationId: "updateTimeEntry",- tags: ["Time Entries"],- description: "Update an existing time entry",- responses: {- 200: {- description: "Time entry updated successfully",- content: {- "application/json": { schema: resolver(timeEntrySchema) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- validator(- "json",- v.object({- startTime: timestamp,- endTime: v.optional(timestamp),- description: v.optional(v.string()),}),- ),- workspaceAccess.fromTimeEntry(),- requireWorkspacePermission({ task: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const { startTime, endTime, description } = c.req.valid("json");- const timeEntry = await updateTimeEntry({+ 200,+ );+ })+ .openapi(updateTimeEntryRoute, async (c) => {+ const { id } = c.req.valid("param");+ const { startTime, endTime, description } = c.req.valid("json");+ return c.json(+ await updateTimeEntry({timeEntryId: id,startTime: new Date(startTime),endTime: endTime ? new Date(endTime) : undefined,description,- });- return c.json(timeEntry);- },- );+ }),+ 200,+ );+ });export default timeEntry;diff --git a/apps/api/src/time-entry/response.ts b/apps/api/src/time-entry/response.tsnew file mode 100644index 000000000..2e1ecc33b--- /dev/null+++ b/apps/api/src/time-entry/response.ts@@ -0,0 +1,23 @@+import { nullableResponseTimestamp, responseTimestamp, z } from "../openapi";++export const timeEntrySchema = z+ .object({+ id: z.string(),+ taskId: z.string(),+ userId: z.string().nullable().openapi({+ description: "Null once the user who logged the time has been removed.",+ }),+ description: z.string().nullable(),+ startTime: responseTimestamp,+ endTime: nullableResponseTimestamp.openapi({+ description: "Null while the timer is still running.",+ }),+ duration: z.number().nullable().openapi({+ description: "Elapsed seconds, filled in once the entry has an endTime.",+ }),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("TimeEntry");++export const timeEntryListSchema = z.array(timeEntrySchema);diff --git a/apps/api/src/time-entry/schema.ts b/apps/api/src/time-entry/schema.tsnew file mode 100644index 000000000..48a20f2cb--- /dev/null+++ b/apps/api/src/time-entry/schema.ts@@ -0,0 +1,48 @@+import { z } from "../openapi";++const ISO_TIMESTAMP =+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}:\d{2})$/;++// Date.parse alone accepts impossible calendar dates like 2024-02-31, so the+// round-trip through UTC getters rejects anything the calendar rolled over.+function isIsoTimestamp(value: string) {+ if (!ISO_TIMESTAMP.test(value) || Number.isNaN(Date.parse(value))) {+ return false;+ }++ const year = Number(value.slice(0, 4));+ const month = Number(value.slice(5, 7));+ const day = Number(value.slice(8, 10));+ const probe = new Date(0);+ probe.setUTCFullYear(year, month - 1, day);++ return (+ probe.getUTCFullYear() === year &&+ probe.getUTCMonth() === month - 1 &&+ probe.getUTCDate() === day+ );+}++const timestamp = z+ .string()+ .refine(isIsoTimestamp, "Expected an ISO 8601 timestamp")+ .openapi({ format: "date-time", example: "2026-01-31T09:00:00Z" });++export const taskIdParam = z.object({ taskId: z.string() });++export const timeEntryParam = z.object({ id: z.string() });++export const createTimeEntryBody = z.object({+ taskId: z.string(),+ startTime: timestamp,+ endTime: timestamp.optional().openapi({+ description: "Omit to start an open-ended entry that is still running.",+ }),+ description: z.string().optional(),+});++export const updateTimeEntryBody = z.object({+ startTime: timestamp,+ endTime: timestamp.optional(),+ description: z.string().optional(),+});diff --git a/apps/api/src/user/index.ts b/apps/api/src/user/index.tsindex ced5298cd..0b8e8ef55 100644--- a/apps/api/src/user/index.ts+++ b/apps/api/src/user/index.ts@@ -1,99 +1,69 @@-import { Hono } from "hono";import { HTTPException } from "hono/http-exception";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { MAX_AVATAR_BYTES } from "./avatar";import deleteAvatar from "./controllers/delete-avatar";import saveAvatar from "./controllers/save-avatar";+import { avatarDeletedSchema, avatarSchema } from "./response";+import { uploadAvatarBody } from "./schema";-const httpErrorSchema = v.object({ message: v.string() });--const avatarResponseSchema = v.object({- id: v.string(),- url: v.string(),- size: v.number(),+const uploadAvatarRoute = createRoute({+ method: "put",+ operationId: "uploadUserAvatar",+ path: "/avatar",+ tags: ["User"],+ summary: "Upload avatar",+ description: `Store a base64 encoded avatar (PNG, JPEG, or WebP, up to ${Math.floor(+ MAX_AVATAR_BYTES / 1024,+ )}KB) for the current user and return its public URL. Replaces any existing avatar.`,+ request: {+ body: {+ required: true,+ content: { "application/json": { schema: uploadAvatarBody } },+ },+ },+ responses: {+ 200: jsonResponse("Avatar stored", avatarSchema),+ 400: errorResponse(+ "Unsupported content type, malformed base64, or too large",+ ),+ },});-const user = new Hono<{- Variables: {- userId: string;- userEmail: string;- };-}>()- .put(- "/avatar",- describeRoute({- operationId: "uploadUserAvatar",- tags: ["User"],- description: `Store a base64 encoded avatar (PNG, JPEG, or WebP, up to ${Math.floor(MAX_AVATAR_BYTES / 1024)}KB) for the current user and return its public URL`,- responses: {- 200: {- description: "Avatar stored",- content: {- "application/json": { schema: resolver(avatarResponseSchema) },- },- },- 400: {- description: "Validation error",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- 401: {- description: "Unauthorized",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- },- }),- validator(- "json",- v.object({- contentType: v.string(),- data: v.string(),- }),- ),- async (c) => {- const userId = c.get("userId");- const { contentType, data } = c.req.valid("json");+const deleteAvatarRoute = createRoute({+ method: "delete",+ operationId: "deleteUserAvatar",+ path: "/avatar",+ tags: ["User"],+ summary: "Delete avatar",+ description:+ "Remove the uploaded avatar of the current user. Succeeds even when there was nothing to remove.",+ responses: {+ 200: jsonResponse("Avatar removed", avatarDeletedSchema),+ },+});- try {- return c.json(await saveAvatar({ userId, contentType, data }));- } catch (error) {- throw new HTTPException(400, {- message:- error instanceof Error ? error.message : "Invalid avatar upload",- });- }- },- )- .delete(- "/avatar",- describeRoute({- operationId: "deleteUserAvatar",- tags: ["User"],- description: "Remove the uploaded avatar of the current user",- responses: {- 200: {- description: "Avatar removed",- content: {- "application/json": {- schema: resolver(v.object({ deleted: v.boolean() })),- },- },- },- 401: {- description: "Unauthorized",- content: {- "application/json": { schema: resolver(httpErrorSchema) },- },- },- },- }),- async (c) => {- return c.json(await deleteAvatar(c.get("userId")));- },+const user = apiRouter()+ .openapi(uploadAvatarRoute, async (c) => {+ const { contentType, data } = c.req.valid("json");+ try {+ return c.json(+ await saveAvatar({ userId: c.get("userId"), contentType, data }),+ 200,+ );+ } catch (error) {+ throw new HTTPException(400, {+ message:+ error instanceof Error ? error.message : "Invalid avatar upload",+ });+ }+ })+ .openapi(deleteAvatarRoute, async (c) =>+ c.json(await deleteAvatar(c.get("userId")), 200),);export default user;diff --git a/apps/api/src/user/response.ts b/apps/api/src/user/response.tsnew file mode 100644index 000000000..d9766dc86--- /dev/null+++ b/apps/api/src/user/response.ts@@ -0,0 +1,20 @@+import { z } from "../openapi";++export const avatarSchema = z+ .object({+ id: z.string(),+ url: z.string().openapi({+ description:+ "Public URL for the stored avatar, served from /api/user/avatar/{id}.",+ }),+ size: z.number().openapi({ description: "Decoded size in bytes." }),+ })+ .openapi("UserAvatar");++export const avatarDeletedSchema = z+ .object({+ deleted: z.boolean().openapi({+ description: "False when the user had no uploaded avatar to remove.",+ }),+ })+ .openapi("UserAvatarDeleted");diff --git a/apps/api/src/user/schema.ts b/apps/api/src/user/schema.tsnew file mode 100644index 000000000..96bfed60c--- /dev/null+++ b/apps/api/src/user/schema.ts@@ -0,0 +1,9 @@+import { z } from "../openapi";++export const uploadAvatarBody = z.object({+ contentType: z.string().openapi({+ description: "One of image/png, image/jpeg, or image/webp.",+ example: "image/png",+ }),+ data: z.string().openapi({ description: "Base64 encoded image bytes." }),+});diff --git a/apps/api/src/utils/openapi-spec.ts b/apps/api/src/utils/openapi-spec.tsindex 418efc42e..fad1ce8a6 100644--- a/apps/api/src/utils/openapi-spec.ts+++ b/apps/api/src/utils/openapi-spec.ts@@ -1,622 +1,7 @@-const HTTP_METHODS = [- "get",- "put",- "post",- "delete",- "patch",- "head",- "options",- "trace",-] as const;--const wordCapitalize = (value: string): string =>- value ? value.charAt(0).toUpperCase() + value.slice(1) : value;--const toWords = (value: string): string[] =>- value- .replace(/[{}]/g, "")- .split(/[^a-zA-Z0-9]+/)- .map((part) => part.trim().toLowerCase())- .filter(Boolean);--const toCamelCase = (parts: string[]): string =>- parts- .map((part, index) => (index === 0 ? part : wordCapitalize(part)))- .join("");--const toTitleCase = (parts: string[]): string =>- parts.map((part) => wordCapitalize(part)).join(" ");--const splitCamelCase = (value: string): string[] =>- value- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")- .split(/[^a-zA-Z0-9]+/)- .map((part) => part.trim())- .filter(Boolean);--const summarizeAction = (action: string): string => {- if (action === "has") {- return "check";- }- return action;-};-+// The API's OpenAPI document is produced natively by @hono/zod-openapi+// (see createApp in ../index.ts), so the spec-rewriting helpers that used to+// live here are gone. This is the one piece of shared URL handling left.export const normalizeApiServerUrl = (baseUrl: string): string => {const trimmed = baseUrl.replace(/\/+$/, "");return trimmed.endsWith("/api") ? trimmed : `${trimmed}/api`;};--export const normalizeOrganizationAuthOperations = (- authSpec: Record<string, unknown>,-): Record<string, unknown> => {- const normalized = JSON.parse(JSON.stringify(authSpec)) as Record<- string,- unknown- >;- const paths = ((normalized as { paths?: unknown }).paths || {}) as Record<- string,- unknown- >;- const organizationPaths = Object.fromEntries(- Object.entries(paths)- .filter(- ([path]) =>- path.startsWith("/organization") ||- path.startsWith("/auth/organization"),- )- .map(([path, pathItem]) => [- path.startsWith("/auth/") ? path : `/auth${path}`,- pathItem,- ]),- ) as Record<string, unknown>;-- for (const [path, pathItem] of Object.entries(organizationPaths)) {- if (!pathItem || typeof pathItem !== "object") {- continue;- }-- const endpointWords = toWords(- path.replace(/^\/(?:auth\/)?organization\/?/, ""),- );- const action = endpointWords[0] || "get";- const rest = endpointWords.slice(1);- const opIdBaseParts = [action, "organization", ...rest];- const summaryVerb = summarizeAction(action);- const summaryObjectParts = ["organization", ...rest];-- for (const method of HTTP_METHODS) {- const operation = (pathItem as Record<string, unknown>)[method] as- | Record<string, unknown>- | undefined;- if (!operation || typeof operation !== "object") {- continue;- }-- operation.operationId = toCamelCase(opIdBaseParts);- operation.summary = `${wordCapitalize(summaryVerb)} ${toTitleCase(- summaryObjectParts,- )}`.trim();- operation.tags = ["Organization Management"];-- if (path === "/auth/organization/get-invitation" && method === "get") {- const parameters = operation.parameters;- if (Array.isArray(parameters)) {- const idParameter = parameters.find(- (parameter) =>- isPlainObject(parameter) &&- parameter.name === "id" &&- parameter.in === "query",- );- if (isPlainObject(idParameter)) {- idParameter.required = true;- }- }- }-- if (path === "/auth/organization/update-team" && method === "post") {- const requestBody = operation.requestBody;- if (isPlainObject(requestBody)) {- const content = requestBody.content;- const jsonContent = isPlainObject(content)- ? content["application/json"]- : undefined;- const schema = isPlainObject(jsonContent)- ? jsonContent.schema- : undefined;- const properties = isPlainObject(schema)- ? schema.properties- : undefined;- const data = isPlainObject(properties) ? properties.data : undefined;- const dataProperties = isPlainObject(data)- ? data.properties- : undefined;- const id = isPlainObject(dataProperties)- ? dataProperties.id- : undefined;- if (isPlainObject(id)) {- delete id.default;- }- }- }- }- }-- const normalizedWithOnlyOrganizationPaths = {- ...normalized,- paths: organizationPaths,- tags: [- {- name: "Organization Management",- },- ],- } as Record<string, unknown>;-- const refPattern = /^#\/components\/([^/]+)\/([^/]+)$/;- const refs = new Set<string>();- const scanRefs = (value: unknown) => {- if (Array.isArray(value)) {- for (const entry of value) {- scanRefs(entry);- }- return;- }- if (!value || typeof value !== "object") {- return;- }-- for (const [key, next] of Object.entries(value)) {- if (key === "$ref" && typeof next === "string") {- refs.add(next);- } else {- scanRefs(next);- }- }- };-- scanRefs(- (- normalizedWithOnlyOrganizationPaths as {- paths?: unknown;- security?: unknown;- }- ).paths,- );- scanRefs(- (- normalizedWithOnlyOrganizationPaths as {- paths?: unknown;- security?: unknown;- }- ).security,- );-- const sourceComponents = ((normalized as { components?: unknown })- .components || {}) as Record<string, unknown>;- const prunedComponents: Record<string, unknown> = {};-- if (- sourceComponents.securitySchemes &&- typeof sourceComponents.securitySchemes === "object"- ) {- prunedComponents.securitySchemes = sourceComponents.securitySchemes;- }-- let changed = true;- while (changed) {- changed = false;- const pendingRefs = [...refs];- for (const ref of pendingRefs) {- const match = refPattern.exec(ref);- if (!match) {- continue;- }- const section = match[1];- const name = match[2];- if (!section || !name) {- continue;- }- const sourceSection = sourceComponents[section] as- | Record<string, unknown>- | undefined;- if (!sourceSection || !(name in sourceSection)) {- continue;- }-- if (!(section in prunedComponents)) {- prunedComponents[section] = {};- }- const targetSection = prunedComponents[section] as Record<- string,- unknown- >;- if (name in targetSection) {- continue;- }-- targetSection[name] = sourceSection[name];- const before = refs.size;- scanRefs(sourceSection[name]);- if (refs.size > before) {- changed = true;- }- }- }-- if (Object.keys(prunedComponents).length > 0) {- normalizedWithOnlyOrganizationPaths.components = prunedComponents;- } else {- delete normalizedWithOnlyOrganizationPaths.components;- }-- return normalizedWithOnlyOrganizationPaths;-};--export const mergeOpenApiSpecs = (- honoSpec: Record<string, unknown>,- authSpec: Record<string, unknown>,-) => {- const mergeRecord = (a: unknown, b: unknown): Record<string, unknown> => ({- ...((a as Record<string, unknown>) || {}),- ...((b as Record<string, unknown>) || {}),- });-- const mergeArray = (a: unknown, b: unknown): unknown[] => [- ...((a as unknown[]) || []),- ...((b as unknown[]) || []),- ];-- return {- ...honoSpec,- openapi:- (honoSpec as { openapi?: string }).openapi ||- (authSpec as { openapi?: string }).openapi ||- "3.0.3",- info:- (honoSpec as { info?: unknown }).info ||- (authSpec as { info?: unknown }).info,- servers:- (honoSpec as { servers?: unknown[] }).servers ||- (authSpec as { servers?: unknown[] }).servers,- security:- (honoSpec as { security?: unknown[] }).security ||- (authSpec as { security?: unknown[] }).security,- paths: mergeRecord(- (honoSpec as { paths?: unknown }).paths,- (authSpec as { paths?: unknown }).paths,- ),- tags: mergeArray(- (honoSpec as { tags?: unknown[] }).tags,- (authSpec as { tags?: unknown[] }).tags,- ),- components: {- ...mergeRecord(- (honoSpec as { components?: unknown }).components,- (authSpec as { components?: unknown }).components,- ),- schemas: mergeRecord(- (honoSpec as { components?: { schemas?: unknown } }).components- ?.schemas,- (authSpec as { components?: { schemas?: unknown } }).components- ?.schemas,- ),- securitySchemes: mergeRecord(- (honoSpec as { components?: { securitySchemes?: unknown } }).components- ?.securitySchemes,- (authSpec as { components?: { securitySchemes?: unknown } }).components- ?.securitySchemes,- ),- },- };-};--export const dedupeOperationIds = (spec: Record<string, unknown>) => {- const paths = ((spec as { paths?: unknown }).paths || {}) as Record<- string,- unknown- >;- const seen = new Set<string>();-- for (const [path, pathItem] of Object.entries(paths)) {- if (!pathItem || typeof pathItem !== "object") {- continue;- }-- for (const method of HTTP_METHODS) {- const operation = (pathItem as Record<string, unknown>)[method] as- | Record<string, unknown>- | undefined;-- if (!operation || typeof operation !== "object") {- continue;- }-- const operationId = operation.operationId;- if (typeof operationId !== "string" || operationId.length === 0) {- continue;- }-- if (!seen.has(operationId)) {- seen.add(operationId);- continue;- }-- const pathSuffix = path- .replace(/\//g, "_")- .replace(/[{}]/g, "")- .replace(/_+/g, "_")- .replace(/^_+|_+$/g, "");- const nextId = `${operationId}_${method}_${pathSuffix || "root"}`;- operation.operationId = nextId;- seen.add(nextId);- }- }-- return spec;-};--const isPlainObject = (value: unknown): value is Record<string, unknown> =>- !!value && typeof value === "object" && !Array.isArray(value);--const setObjectContents = (- target: Record<string, unknown>,- source: Record<string, unknown>,-) => {- for (const key of Object.keys(target)) {- delete target[key];- }- Object.assign(target, source);-};--export const normalizeNullableSchemasForOpenApi30 = (- spec: Record<string, unknown>,-) => {- const visit = (node: unknown): void => {- if (Array.isArray(node)) {- for (const item of node) {- visit(item);- }- return;- }-- if (!isPlainObject(node)) {- return;- }-- const typeValue = node.type;- if (Array.isArray(typeValue)) {- const nullRemoved = typeValue.filter((entry) => entry !== "null");- const hadNull = nullRemoved.length !== typeValue.length;-- if (hadNull && nullRemoved.length === 1) {- node.type = nullRemoved[0];- node.nullable = true;- }- }-- const anyOfValue = node.anyOf;- if (Array.isArray(anyOfValue) && anyOfValue.length >= 2) {- const nullSchema = anyOfValue.find(- (entry) => isPlainObject(entry) && entry.type === "null",- );- const nonNullSchemas = anyOfValue.filter(- (entry) => !(isPlainObject(entry) && entry.type === "null"),- );-- if (- nullSchema &&- nonNullSchemas.length === 1 &&- isPlainObject(nonNullSchemas[0])- ) {- const { anyOf: _anyOf, ...rest } = node;- setObjectContents(node, {- ...rest,- ...(nonNullSchemas[0] as Record<string, unknown>),- nullable: true,- });- }- }-- for (const value of Object.values(node)) {- visit(value);- }- };-- visit(spec);- return spec;-};--export const normalizeEmptyRequiredArrays = (spec: Record<string, unknown>) => {- const visit = (node: unknown): void => {- if (Array.isArray(node)) {- for (const item of node) {- visit(item);- }- return;- }-- if (!isPlainObject(node)) {- return;- }-- if (Array.isArray(node.required) && node.required.length === 0) {- delete node.required;- }-- for (const value of Object.values(node)) {- visit(value);- }- };-- visit(spec);- return spec;-};--// Better Auth's generateOpenAPISchema sometimes emits a `properties` entry whose-// value is a primitive instead of a schema object, e.g. the organization-// `create-role` `additionalFields` field comes through as-// `properties: { type: "object" }`. OpenAPI validators (Mintlify) reject the-// invalid sub-schema, so drop any property whose schema is not an object.-export const normalizeMalformedPropertySchemas = (- spec: Record<string, unknown>,-) => {- const visit = (node: unknown): void => {- if (Array.isArray(node)) {- for (const item of node) {- visit(item);- }- return;- }-- if (!isPlainObject(node)) {- return;- }-- if (isPlainObject(node.properties)) {- const properties = node.properties as Record<string, unknown>;- for (const [key, value] of Object.entries(properties)) {- if (!isPlainObject(value)) {- delete properties[key];- }- }- }-- for (const value of Object.values(node)) {- visit(value);- }- };-- visit(spec);- return spec;-};--export const markOptionalSchemaFieldsNullable = (- spec: Record<string, unknown>,-) => {- const schemas = ((spec as { components?: { schemas?: unknown } }).components- ?.schemas || {}) as Record<string, unknown>;-- for (const schema of Object.values(schemas)) {- if (!isPlainObject(schema)) continue;-- const properties = schema.properties as Record<string, unknown> | undefined;- if (!isPlainObject(properties)) continue;-- const required = Array.isArray(schema.required) ? schema.required : [];-- for (const [name, prop] of Object.entries(properties)) {- if (required.includes(name)) continue;- if (!isPlainObject(prop)) continue;- if (prop.nullable === true) continue;- if (typeof prop.type !== "string") continue;-- prop.nullable = true;- }- }-- return spec;-};--export const normalizeEmptyAndEnumSchemas = (spec: Record<string, unknown>) => {- const visit = (node: unknown): void => {- if (Array.isArray(node)) {- for (const item of node) {- visit(item);- }- return;- }-- if (!isPlainObject(node)) {- return;- }-- // propertyNames is not valid in OpenAPI 3.0.x, so remove it- if ("propertyNames" in node) {- delete node.propertyNames;- }-- // Schema with enum but no type → add type: "string"- if (Array.isArray(node.enum) && !node.type && !node.$ref) {- node.type = "string";- }-- // $ref with siblings is invalid in 3.0.x → wrap in allOf- if (typeof node.$ref === "string" && Object.keys(node).length > 1) {- const ref = node.$ref as string;- delete node.$ref;- const rest = { ...node };- for (const k of Object.keys(node)) {- delete node[k];- }- Object.assign(node, { allOf: [{ $ref: ref }], ...rest });- }-- // For "properties" maps, check children for empty schemas (v.date() → {})- if (isPlainObject(node.properties)) {- const props = node.properties as Record<string, unknown>;- for (const [name, schema] of Object.entries(props)) {- if (isPlainObject(schema) && Object.keys(schema).length === 0) {- props[name] = { type: "string", format: "date-time" };- }- }- }-- for (const [k, value] of Object.entries(node)) {- // Replace remaining empty schemas {} (e.g. v.any() or v.unknown()).- if (isPlainObject(value) && Object.keys(value).length === 0) {- // An empty properties map is valid and must remain a map. Replacing it- // with a schema object would create `properties: { type: "object" }`.- if (k === "properties") {- continue;- }- // additionalProperties: {} → true (means "any additional properties")- node[k] = k === "additionalProperties" ? true : { type: "object" };- continue;- }- visit(value);- }- };-- visit(spec);- return spec;-};--export const ensureOperationSummaries = (spec: Record<string, unknown>) => {- const paths = ((spec as { paths?: unknown }).paths || {}) as Record<- string,- unknown- >;-- for (const pathItem of Object.values(paths)) {- if (!pathItem || typeof pathItem !== "object") {- continue;- }-- for (const method of HTTP_METHODS) {- const operation = (pathItem as Record<string, unknown>)[method] as- | Record<string, unknown>- | undefined;- if (!operation || typeof operation !== "object") {- continue;- }-- const summary = operation.summary;- if (typeof summary === "string" && summary.trim().length > 0) {- continue;- }-- const operationId = operation.operationId;- if (typeof operationId !== "string" || operationId.trim().length === 0) {- continue;- }-- const words = splitCamelCase(operationId);- if (words.length === 0) {- continue;- }-- operation.summary = words.map((word) => wordCapitalize(word)).join(" ");- }- }-- return spec;-};diff --git a/apps/api/src/workflow-rule/index.ts b/apps/api/src/workflow-rule/index.tsindex 3fdccad4d..d742fdbaa 100644--- a/apps/api/src/workflow-rule/index.ts+++ b/apps/api/src/workflow-rule/index.ts@@ -1,101 +1,110 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { requireWorkspacePermission } from "../utils/require-workspace-permission";import { workspaceAccess } from "../utils/workspace-access-middleware";import deleteWorkflowRule from "./controllers/delete-workflow-rule";import getWorkflowRules from "./controllers/get-workflow-rules";import upsertWorkflowRule from "./controllers/upsert-workflow-rule";+import { workflowRuleListSchema, workflowRuleRowSchema } from "./response";+import {+ projectIdParam,+ upsertWorkflowRuleBody,+ workflowRuleParam,+} from "./schema";-const workflowRule = new Hono<{- Variables: {- userId: string;- };-}>()- .get(- "/:projectId",- describeRoute({- operationId: "getWorkflowRules",- tags: ["Workflow Rules"],- description: "Get all workflow rules for a project",- responses: {- 200: {- description: "List of workflow rules",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),+const getWorkflowRulesRoute = createRoute({+ method: "get",+ operationId: "getWorkflowRules",+ path: "/{projectId}",+ tags: ["Workflow Rules"],+ summary: "Get workflow rules",+ description:+ "Get every workflow rule for a project. A rule moves a task to a column when an integration event fires.",+ middleware: [workspaceAccess.fromProject("projectId")] as const,+ request: { params: projectIdParam },+ responses: {+ 200: jsonResponse("List of workflow rules", workflowRuleListSchema),+ 400: errorResponse(+ "Unknown project, or its workspace could not be determined",+ ),+ 403: errorResponse("No access to the project's workspace"),+ },+});++const upsertWorkflowRuleRoute = createRoute({+ method: "put",+ operationId: "upsertWorkflowRule",+ path: "/{projectId}",+ tags: ["Workflow Rules"],+ summary: "Upsert workflow rule",+ description:+ "Create a workflow rule, or update the target column of the existing rule for the same integration and event.",+ middleware: [workspaceAccess.fromProject("projectId"),- async (c) => {- const { projectId } = c.req.valid("param");- const rules = await getWorkflowRules(projectId);- return c.json(rules);+ requireWorkspacePermission({ project: ["update"] }),+ ] as const,+ request: {+ params: projectIdParam,+ body: {+ required: true,+ content: { "application/json": { schema: upsertWorkflowRuleBody } },},- )- .put(- "/:projectId",- describeRoute({- operationId: "upsertWorkflowRule",- tags: ["Workflow Rules"],- description: "Create or update a workflow rule",- responses: {- 200: {- description: "Workflow rule upserted successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ projectId: v.string() })),- validator(- "json",- v.object({- integrationType: v.string(),- eventType: v.string(),- columnId: v.string(),- }),+ },+ responses: {+ 200: jsonResponse("The created or updated rule", workflowRuleRowSchema),+ 400: errorResponse("Invalid body, or unknown project"),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",),- workspaceAccess.fromProject("projectId"),+ },+});++const deleteWorkflowRuleRoute = createRoute({+ method: "delete",+ operationId: "deleteWorkflowRule",+ path: "/{id}",+ tags: ["Workflow Rules"],+ summary: "Delete workflow rule",+ description: "Delete a workflow rule. Returns the rule that was removed.",+ middleware: [+ workspaceAccess.fromWorkflowRule("id"),requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { projectId } = c.req.valid("param");- const { integrationType, eventType, columnId } = c.req.valid("json");- const result = await upsertWorkflowRule({+ ] as const,+ request: { params: workflowRuleParam },+ responses: {+ 200: jsonResponse("The deleted rule", workflowRuleRowSchema),+ 400: errorResponse(+ "Unknown rule, or its workspace could not be determined",+ ),+ 403: errorResponse(+ "No workspace access, or missing project:update permission",+ ),+ },+});++const workflowRule = apiRouter()+ .openapi(getWorkflowRulesRoute, async (c) =>+ c.json(await getWorkflowRules(c.req.valid("param").projectId), 200),+ )+ .openapi(upsertWorkflowRuleRoute, async (c) => {+ const { projectId } = c.req.valid("param");+ const { integrationType, eventType, columnId } = c.req.valid("json");+ return c.json(+ await upsertWorkflowRule({projectId,integrationType,eventType,columnId,- });- return c.json(result);- },- )- .delete(- "/:id",- describeRoute({- operationId: "deleteWorkflowRule",- tags: ["Workflow Rules"],- description: "Delete a workflow rule",- responses: {- 200: {- description: "Workflow rule deleted successfully",- content: {- "application/json": { schema: resolver(v.any()) },- },- },- },- }),- validator("param", v.object({ id: v.string() })),- workspaceAccess.fromWorkflowRule("id"),- requireWorkspacePermission({ project: ["update"] }),- async (c) => {- const { id } = c.req.valid("param");- const result = await deleteWorkflowRule(id);- return c.json(result);- },+ }),+ 200,+ );+ })+ .openapi(deleteWorkflowRuleRoute, async (c) =>+ c.json(await deleteWorkflowRule(c.req.valid("param").id), 200),);export default workflowRule;diff --git a/apps/api/src/workflow-rule/response.ts b/apps/api/src/workflow-rule/response.tsnew file mode 100644index 000000000..9ca863d38--- /dev/null+++ b/apps/api/src/workflow-rule/response.ts@@ -0,0 +1,39 @@+import { responseTimestamp, z } from "../openapi";++// getWorkflowRules left-joins the column, so the column fields are null when+// the referenced column has been removed.+export const workflowRuleSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ integrationType: z.string().openapi({+ description: "The integration that emits the event, e.g. `github`.",+ }),+ eventType: z.string().openapi({+ description:+ "The provider event that triggers the move, e.g. `pull_request.opened`.",+ }),+ columnId: z.string().openapi({+ description: "The column tasks are moved to when the event fires.",+ }),+ columnName: z.string().nullable(),+ columnSlug: z.string().nullable(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("WorkflowRule");++export const workflowRuleListSchema = z.array(workflowRuleSchema);++// Upsert and delete return the raw row, without the joined column fields.+export const workflowRuleRowSchema = z+ .object({+ id: z.string(),+ projectId: z.string(),+ integrationType: z.string(),+ eventType: z.string(),+ columnId: z.string(),+ createdAt: responseTimestamp,+ updatedAt: responseTimestamp,+ })+ .openapi("WorkflowRuleRow");diff --git a/apps/api/src/workflow-rule/schema.ts b/apps/api/src/workflow-rule/schema.tsnew file mode 100644index 000000000..b315f8141--- /dev/null+++ b/apps/api/src/workflow-rule/schema.ts@@ -0,0 +1,11 @@+import { z } from "../openapi";++export const projectIdParam = z.object({ projectId: z.string() });++export const workflowRuleParam = z.object({ id: z.string() });++export const upsertWorkflowRuleBody = z.object({+ integrationType: z.string(),+ eventType: z.string(),+ columnId: z.string(),+});diff --git a/apps/api/src/workspace/index.ts b/apps/api/src/workspace/index.tsindex de7554b8e..d35fce80b 100644--- a/apps/api/src/workspace/index.ts+++ b/apps/api/src/workspace/index.ts@@ -1,48 +1,34 @@-import { Hono } from "hono";-import { describeRoute, resolver, validator } from "hono-openapi";-import * as v from "valibot";+import {+ apiRouter,+ type BaseVariables,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";import { workspaceAccess } from "../utils/workspace-access-middleware";import getWorkspaceMembersCtrl from "./controllers/get-workspace-members";+import { workspaceMemberListSchema } from "./response";+import { workspaceIdParam } from "./schema";-const workspace = new Hono<{- Variables: {- userId: string;- workspaceId: string;- };-}>().get(- "/:workspaceId/members",- describeRoute({- operationId: "getWorkspaceMembers",- tags: ["Workspaces"],- description: "Get all members of a workspace",- responses: {- 200: {- description: "List of workspace members",- content: {- "application/json": {- schema: resolver(- v.array(- v.object({- id: v.string(),- name: v.string(),- email: v.string(),- image: v.nullable(v.string()),- role: v.string(),- }),- ),- ),- },- },- },- },- }),- validator("param", v.object({ workspaceId: v.string() })),- workspaceAccess.fromParam("workspaceId"),- async (c) => {- const workspaceId = c.get("workspaceId");- const members = await getWorkspaceMembersCtrl(workspaceId);- return c.json(members);+const getWorkspaceMembersRoute = createRoute({+ method: "get",+ operationId: "getWorkspaceMembers",+ path: "/{workspaceId}/members",+ tags: ["Workspaces"],+ summary: "Get workspace members",+ description: "Get all members of a workspace, with their role.",+ middleware: [workspaceAccess.fromParam("workspaceId")] as const,+ request: { params: workspaceIdParam },+ responses: {+ 200: jsonResponse("List of workspace members", workspaceMemberListSchema),+ 400: errorResponse("Workspace ID could not be determined"),+ 403: errorResponse("No access to the workspace"),},+});++const workspace = apiRouter<BaseVariables & { workspaceId: string }>().openapi(+ getWorkspaceMembersRoute,+ async (c) => c.json(await getWorkspaceMembersCtrl(c.get("workspaceId")), 200),);export default workspace;diff --git a/apps/api/src/workspace/response.ts b/apps/api/src/workspace/response.tsnew file mode 100644index 000000000..dca2965b2--- /dev/null+++ b/apps/api/src/workspace/response.ts@@ -0,0 +1,16 @@+import { z } from "../openapi";++export const workspaceMemberSchema = z+ .object({+ id: z.string(),+ name: z.string(),+ email: z.string(),+ image: z.string().nullable(),+ role: z.string().openapi({+ description:+ "The member's workspace role: a built-in role (owner, admin, member, guest) or a custom role name.",+ }),+ })+ .openapi("WorkspaceMember");++export const workspaceMemberListSchema = z.array(workspaceMemberSchema);diff --git a/apps/api/src/workspace/schema.ts b/apps/api/src/workspace/schema.tsnew file mode 100644index 000000000..fd911d4b6--- /dev/null+++ b/apps/api/src/workspace/schema.ts@@ -0,0 +1,3 @@+import { z } from "../openapi";++export const workspaceIdParam = z.object({ workspaceId: z.string() });diff --git a/apps/docs/openapi.json b/apps/docs/openapi.jsonindex f070001a4..b4902fd4d 100644--- a/apps/docs/openapi.json+++ b/apps/docs/openapi.json@@ -1,9 +1,9 @@{- "openapi": "3.0.3",+ "openapi": "3.1.0","info": {"title": "Kaneo API",- "description": "Kaneo Project Management API - Manage projects, tasks, labels, and more",- "version": "1.0.0"+ "version": "1.0.0",+ "description": "Kaneo Project Management API - Manage projects, tasks, labels, and more"},"servers": [{@@ -11,3108 +11,3339 @@"description": "Kaneo API Server"}],+ "security": [+ {+ "bearerAuth": []+ }+ ],"components": {"securitySchemes": {"bearerAuth": {"type": "http","scheme": "bearer",- "description": "Bearer token authentication"- },- "apiKeyCookie": {- "type": "apiKey",- "in": "cookie",- "name": "apiKeyCookie",- "description": "API Key authentication via cookie"+ "description": "API key or session token (Bearer)"}},"schemas": {- "Organization": {+ "InstanceStatus": {"type": "object","properties": {- "id": {+ "hasUsers": {+ "type": "boolean"+ },+ "hasAdmin": {+ "type": "boolean"+ }+ },+ "required": [+ "hasUsers",+ "hasAdmin"+ ]+ },+ "Config": {+ "type": "object",+ "properties": {+ "disableRegistration": {+ "type": "boolean"+ },+ "disablePasswordRegistration": {+ "type": "boolean"+ },+ "disableEmailOtpSignIn": {+ "type": "boolean"+ },+ "disableWorkspaceCreation": {+ "type": "boolean"+ },+ "isDemoMode": {+ "type": "boolean"+ },+ "hasSmtp": {+ "type": "boolean"+ },+ "hasGithubSignIn": {+ "type": "boolean"+ },+ "hasGoogleSignIn": {+ "type": "boolean"+ },+ "hasDiscordSignIn": {+ "type": "boolean"+ },+ "hasCustomOAuth": {+ "type": "boolean"+ },+ "hasGuestAccess": {+ "type": "boolean"+ },+ "disableLoginForm": {+ "type": "boolean"+ },+ "customOAuthAutoLogin": {+ "type": "boolean"+ },+ "customOAuthLogoutUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "billingEnabled": {+ "type": "boolean"+ }+ },+ "required": [+ "disableRegistration",+ "disablePasswordRegistration",+ "disableEmailOtpSignIn",+ "disableWorkspaceCreation",+ "isDemoMode",+ "hasSmtp",+ "hasGithubSignIn",+ "hasGoogleSignIn",+ "hasDiscordSignIn",+ "hasCustomOAuth",+ "hasGuestAccess",+ "disableLoginForm",+ "customOAuthAutoLogin",+ "customOAuthLogoutUrl",+ "billingEnabled"+ ]+ },+ "McpClientRegistration": {+ "type": "object",+ "properties": {+ "client_id": {+ "type": "string"+ },+ "client_id_issued_at": {+ "type": "number"+ },+ "redirect_uris": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "client_name": {+ "type": "string"+ },+ "token_endpoint_auth_method": {"type": "string",- "nullable": true+ "enum": [+ "none"+ ]},- "name": {+ "grant_types": {+ "type": "array",+ "items": {+ "type": "string",+ "enum": [+ "authorization_code"+ ]+ }+ },+ "response_types": {+ "type": "array",+ "items": {+ "type": "string",+ "enum": [+ "code"+ ]+ }+ }+ },+ "required": [+ "client_id",+ "client_id_issued_at",+ "redirect_uris",+ "token_endpoint_auth_method",+ "grant_types",+ "response_types"+ ]+ },+ "OAuthError": {+ "type": "object",+ "properties": {+ "error": {+ "type": "string"+ }+ },+ "required": [+ "error"+ ]+ },+ "McpAuthorizationRequest": {+ "type": "object",+ "properties": {+ "client_name": {"type": "string"},- "slug": {+ "redirect_uri": {+ "type": "string"+ }+ },+ "required": [+ "client_name",+ "redirect_uri"+ ]+ },+ "McpAuthorizationDecision": {+ "type": "object",+ "properties": {+ "redirect": {+ "type": "string",+ "description": "Where to send the browser next: back to the client with a code on approval, or with an error on denial."+ }+ },+ "required": [+ "redirect"+ ]+ },+ "OAuthIdToken": {+ "type": "object",+ "properties": {+ "idToken": {+ "type": [+ "string",+ "null"+ ],+ "description": "The stored id_token for the user's `custom` OAuth account, or null when they have no such account."+ }+ },+ "required": [+ "idToken"+ ]+ },+ "BillingWebhookResult": {+ "type": "object",+ "properties": {+ "processed": {+ "type": "boolean"+ },+ "duplicate": {+ "type": "boolean",+ "description": "True when this event id was already applied, so the delivery was a safe no-op."+ }+ },+ "required": [+ "processed",+ "duplicate"+ ]+ },+ "WorkspaceBilling": {+ "type": "object",+ "properties": {+ "billingEnabled": {+ "type": "boolean",+ "description": "False when the instance has no billing configured."+ },+ "entitlement": {+ "$ref": "#/components/schemas/BillingEntitlement"+ },+ "foundingFree": {+ "type": "boolean"+ },+ "trialEndsAt": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "plan": {+ "type": [+ "string",+ "null"+ ],+ "description": "`personal` or `team`."+ },+ "billingInterval": {+ "type": [+ "string",+ "null"+ ],+ "description": "`monthly` or `annual`."+ },+ "status": {+ "type": [+ "string",+ "null"+ ],+ "description": "The provider's subscription status."+ },+ "seats": {+ "type": "number"+ },+ "currentPeriodEnd": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "canceledAt": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "hasCustomer": {+ "type": "boolean",+ "description": "Whether a billing customer exists yet. The portal link requires one."+ }+ },+ "required": [+ "billingEnabled",+ "entitlement",+ "foundingFree",+ "trialEndsAt",+ "plan",+ "billingInterval",+ "status",+ "seats",+ "currentPeriodEnd",+ "canceledAt",+ "hasCustomer"+ ]+ },+ "BillingEntitlement": {+ "type": "object",+ "properties": {+ "active": {+ "type": "boolean",+ "description": "Whether the workspace currently has paid-tier access."+ },+ "reason": {+ "type": "string",+ "enum": [+ "billing_disabled",+ "founding_free",+ "subscription",+ "trial",+ "expired"+ ],+ "description": "Why access is granted or denied. `billing_disabled` means the instance is not running billing at all, so everything is unlocked."+ }+ },+ "required": [+ "active",+ "reason"+ ]+ },+ "BillingCheckout": {+ "type": "object",+ "properties": {+ "checkoutUrl": {+ "type": "string",+ "description": "Redirect the browser here to complete payment."+ }+ },+ "required": [+ "checkoutUrl"+ ]+ },+ "BillingPortal": {+ "type": "object",+ "properties": {+ "portalUrl": {+ "type": "string",+ "description": "A short-lived link to the provider's customer portal."+ }+ },+ "required": [+ "portalUrl"+ ]+ },+ "ProjectListItem": {+ "allOf": [+ {+ "$ref": "#/components/schemas/Project"+ },+ {+ "type": "object",+ "properties": {+ "statistics": {+ "$ref": "#/components/schemas/ProjectStatistics"+ },+ "archivedTasks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardTask"+ },+ "description": "Always empty."+ },+ "plannedTasks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardTask"+ },+ "description": "Always empty."+ },+ "columns": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardColumn"+ },+ "description": "Always empty."+ }+ },+ "required": [+ "statistics",+ "archivedTasks",+ "plannedTasks",+ "columns"+ ]+ }+ ]+ },+ "ProjectStatistics": {+ "type": "object",+ "properties": {+ "completionPercentage": {+ "type": "number"+ },+ "totalTasks": {+ "type": "number"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time",+ "description": "The soonest due date among the project's open tasks."+ }+ },+ "required": [+ "completionPercentage",+ "totalTasks",+ "dueDate"+ ]+ },+ "BoardTask": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "title": {+ "type": "string"+ },+ "number": {+ "type": [+ "number",+ "null"+ ]+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {"type": "string"},- "logo": {+ "priority": {"type": "string",- "nullable": true+ "description": "One of: no-priority, low, medium, high, urgent."+ },+ "startDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "position": {+ "type": [+ "number",+ "null"+ ]},"createdAt": {"type": "string","format": "date-time"},+ "userId": {+ "type": [+ "string",+ "null"+ ]+ },+ "assigneeName": {+ "type": [+ "string",+ "null"+ ]+ },+ "assigneeId": {+ "type": [+ "string",+ "null"+ ]+ },+ "assigneeImage": {+ "type": [+ "string",+ "null"+ ]+ },+ "projectId": {+ "type": "string"+ },+ "labels": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/TaskLabel"+ }+ },+ "externalLinks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/TaskExternalLink"+ }+ }+ },+ "required": [+ "id",+ "title",+ "number",+ "description",+ "status",+ "priority",+ "startDate",+ "dueDate",+ "position",+ "createdAt",+ "userId",+ "assigneeName",+ "assigneeId",+ "assigneeImage",+ "projectId",+ "labels",+ "externalLinks"+ ]+ },+ "TaskLabel": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "color": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "name",+ "color"+ ]+ },+ "TaskExternalLink": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "taskId": {+ "type": "string"+ },+ "integrationId": {+ "type": "string"+ },+ "resourceType": {+ "type": "string"+ },+ "externalId": {+ "type": "string"+ },+ "url": {+ "type": "string"+ },+ "title": {+ "type": [+ "string",+ "null"+ ]+ },"metadata": {+ "type": [+ "object",+ "null"+ ],+ "additionalProperties": {},+ "description": "Provider-specific payload, already parsed from the stored JSON string."+ },+ "createdAt": {"type": "string",- "nullable": true+ "format": "date-time"},- "description": {+ "updatedAt": {"type": "string",- "nullable": true+ "format": "date-time"}},"required": [- "name",- "slug",- "createdAt"+ "id",+ "taskId",+ "integrationId",+ "resourceType",+ "externalId",+ "url",+ "title",+ "metadata",+ "createdAt",+ "updatedAt"]},- "Team": {+ "BoardColumn": {"type": "object","properties": {"id": {"type": "string",- "nullable": true+ "description": "The column slug, same as `slug`."+ },+ "slug": {+ "type": "string"},"name": {"type": "string"},- "organizationId": {+ "icon": {+ "type": [+ "string",+ "null"+ ]+ },+ "isFinal": {+ "type": "boolean"+ },+ "tasks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardTask"+ }+ }+ },+ "required": [+ "id",+ "slug",+ "name",+ "icon",+ "isFinal",+ "tasks"+ ]+ },+ "Project": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "workspaceId": {+ "type": "string"+ },+ "slug": {+ "type": "string",+ "description": "Short prefix used in task identifiers, e.g. KAN-12."+ },+ "icon": {+ "type": [+ "string",+ "null"+ ]+ },+ "name": {"type": "string"},+ "description": {+ "type": [+ "string",+ "null"+ ]+ },"createdAt": {"type": "string","format": "date-time"},- "updatedAt": {- "type": "string",+ "isPublic": {+ "type": [+ "boolean",+ "null"+ ],+ "description": "When true the project's board is readable without signing in, via /api/public-project/{id}."+ },+ "archivedAt": {+ "type": [+ "string",+ "null"+ ],"format": "date-time",- "nullable": true+ "description": "Non-null once archived; archived projects are hidden by default."+ },+ "position": {+ "type": "number",+ "description": "Sidebar order, ascending."+ },+ "lastTaskNumber": {+ "type": "number",+ "description": "Highest task number issued in this project; the next task gets this plus one."}},"required": [+ "id",+ "workspaceId",+ "slug",+ "icon","name",- "organizationId",- "createdAt"+ "description",+ "createdAt",+ "isPublic",+ "archivedAt",+ "position",+ "lastTaskNumber"]- }- }- },- "security": [- {- "bearerAuth": []- }- ],- "paths": {- "/instance/status": {- "get": {- "operationId": "getInstanceStatus",- "tags": [- "Instance"- ],- "description": "Public instance setup status. When hasUsers is false the next signup becomes the instance admin.",- "security": [],- "responses": {- "200": {- "description": "Instance status",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "hasUsers": {- "type": "boolean"- },- "hasAdmin": {- "type": "boolean"- }- },- "required": [- "hasUsers",- "hasAdmin"- ]- }- }- }+ },+ "BoardResponse": {+ "type": "object",+ "properties": {+ "data": {+ "$ref": "#/components/schemas/Board"+ },+ "pagination": {+ "$ref": "#/components/schemas/BoardPagination"}},- "summary": "Get Instance Status"- }- },- "/auth/get-session": {- "get": {- "operationId": "getSession",- "tags": [- "Authentication"- ],- "description": "Get the current authenticated session",- "security": [],- "responses": {- "200": {- "description": "Current session details or null when unauthenticated",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }+ "required": [+ "data",+ "pagination"+ ]+ },+ "Board": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "slug": {+ "type": "string"+ },+ "icon": {+ "type": [+ "string",+ "null"+ ]+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "isPublic": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "workspaceId": {+ "type": "string"+ },+ "columns": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardColumn"+ }+ },+ "archivedTasks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardTask"+ }+ },+ "plannedTasks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/BoardTask"}}},- "summary": "Get Session"- }- },- "/asset/{id}": {- "get": {- "operationId": "getAsset",- "tags": [- "Assets"+ "required": [+ "id",+ "name",+ "slug",+ "icon",+ "description",+ "isPublic",+ "workspaceId",+ "columns",+ "archivedTasks",+ "plannedTasks"+ ]+ },+ "BoardPagination": {+ "type": "object",+ "properties": {+ "total": {+ "type": "number"+ },+ "page": {+ "type": "number"+ },+ "pageSize": {+ "type": "number"+ },+ "totalPages": {+ "type": "number"+ }+ },+ "required": [+ "total",+ "page",+ "pageSize",+ "totalPages"],- "description": "Download an uploaded asset by ID",- "security": [],- "responses": {- "200": {- "description": "The requested asset binary stream",- "content": {- "*/*": {- "schema": {- "type": "string",- "format": "binary"- }- }- }+ "description": "When no page/limit is given, everything is returned on a single page."+ },+ "BulkTaskResult": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean"+ },+ "updatedCount": {+ "type": "number"}},- "parameters": [+ "required": [+ "success",+ "updatedCount"+ ]+ },+ "Task": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "position": {+ "type": [+ "number",+ "null"+ ],+ "description": "Order within its column, ascending."+ },+ "number": {+ "type": [+ "number",+ "null"+ ],+ "description": "Per-project counter shown as {projectSlug}-{number}."+ },+ "userId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The assignee, if any."+ },+ "title": {+ "type": "string"+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "status": {+ "type": "string",+ "description": "The slug of the column the task sits in."+ },+ "priority": {+ "type": "string",+ "description": "One of: no-priority, low, medium, high, urgent."+ },+ "startDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ }+ },+ "required": [+ "id",+ "projectId",+ "position",+ "number",+ "userId",+ "title",+ "description",+ "status",+ "priority",+ "startDate",+ "dueDate",+ "createdAt"+ ]+ },+ "TaskWithAssignee": {+ "allOf": [{- "in": "path",- "name": "id",- "schema": {- "type": "string"+ "$ref": "#/components/schemas/Task"+ },+ {+ "type": "object",+ "properties": {+ "assigneeName": {+ "type": [+ "string",+ "null"+ ]+ },+ "assigneeId": {+ "type": [+ "string",+ "null"+ ]+ }},- "required": true+ "required": [+ "assigneeName",+ "assigneeId"+ ]}- ],- "summary": "Get Asset"- }- },- "/config": {- "get": {- "operationId": "getConfig",- "tags": [- "Config"- ],- "description": "Get application settings and configuration",- "responses": {- "200": {- "description": "Application settings",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "disableRegistration": {- "type": "boolean",- "nullable": true- },- "disablePasswordRegistration": {- "type": "boolean",- "nullable": true- },- "disableEmailOtpSignIn": {- "type": "boolean",- "nullable": true- },- "isDemoMode": {- "type": "boolean"- },- "hasSmtp": {- "type": "boolean"- },- "hasGithubSignIn": {- "type": "boolean",- "nullable": true- },- "hasGoogleSignIn": {- "type": "boolean",- "nullable": true- },- "hasDiscordSignIn": {- "type": "boolean",- "nullable": true- },- "hasCustomOAuth": {- "type": "boolean",- "nullable": true- },- "hasGuestAccess": {- "type": "boolean",- "nullable": true- },- "disableLoginForm": {- "type": "boolean",- "nullable": true- },- "customOAuthAutoLogin": {- "type": "boolean",- "nullable": true- },- "customOAuthLogoutUrl": {- "type": "string",- "nullable": true- }- },- "required": [- "disableRegistration",- "disablePasswordRegistration",- "disableEmailOtpSignIn",- "isDemoMode",- "hasSmtp",- "hasGithubSignIn",- "hasGoogleSignIn",- "hasDiscordSignIn",- "hasCustomOAuth",- "hasGuestAccess",- "disableLoginForm",- "customOAuthAutoLogin",- "customOAuthLogoutUrl"- ]- }- }- }+ ]+ },+ "MoveTaskResult": {+ "type": "object",+ "properties": {+ "task": {+ "$ref": "#/components/schemas/Task"+ },+ "sourceProjectId": {+ "type": "string"+ },+ "destinationProjectId": {+ "type": "string"}},- "summary": "Get Config"- }- },- "/auth/device": {- "get": {- "operationId": "getDeviceAuthorizationPage",- "tags": [- "Authentication"- ],- "description": "Redirect browser-based device authorization requests to the web UI",- "security": [],- "parameters": [- {- "in": "query",- "name": "user_code",- "schema": {- "type": "string"- }+ "required": [+ "task",+ "sourceProjectId",+ "destinationProjectId"+ ]+ },+ "TaskExport": {+ "type": "object",+ "properties": {+ "project": {+ "$ref": "#/components/schemas/TaskExportProject"},- {- "in": "query",- "name": "ui",- "schema": {- "enum": [- "1"- ],- "type": "string"+ "tasks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ExportedTask"}}- ],- "responses": {- "200": {- "description": "Device authorization payload from Better Auth",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ },+ "required": [+ "project",+ "tasks"+ ]+ },+ "TaskExportProject": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"},- "302": {- "description": "Redirects the browser to the web app device screen"+ "slug": {+ "type": "string"+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "exportedAt": {+ "type": "string",+ "format": "date-time"}},- "summary": "Get Device Authorization Page"- }- },- "/oauth/id-token": {- "get": {- "operationId": "getOAuthIdToken",- "tags": [- "Authentication"- ],- "description": "Get the id_token for the current user's custom OAuth account",- "responses": {- "200": {- "description": "The id_token if available",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "idToken": {- "type": "string",- "nullable": true- }- },- "required": [- "idToken"- ]- }- }- }- }- },- "summary": "Get OAuth Id Token"- }- },- "/project": {- "get": {- "operationId": "listProjects",- "tags": [- "Projects"- ],- "description": "Get all projects in a workspace",- "responses": {- "200": {- "description": "List of projects with statistics",- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }- }- }- },- "parameters": [- {- "in": "query",- "name": "workspaceId",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "name",+ "slug",+ "description",+ "exportedAt"+ ]+ },+ "ExportedTask": {+ "type": "object",+ "properties": {+ "title": {+ "type": "string"},- {- "in": "query",- "name": "includeArchived",- "schema": {- "type": "string"- }+ "description": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": "string"+ },+ "dueDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "startDate": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "userId": {+ "type": [+ "string",+ "null"+ ]+ },+ "labels": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ExportedTaskLabel"+ },+ "description": "Label names and colors, without their ids."}- ],- "summary": "List Projects"+ },+ "required": [+ "title",+ "description",+ "status",+ "priority",+ "dueDate",+ "startDate",+ "userId",+ "labels"+ ]},- "post": {- "operationId": "createProject",- "tags": [- "Projects"- ],- "description": "Create a new project in a workspace",- "responses": {- "200": {- "description": "Project created successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }+ "ExportedTaskLabel": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "color": {+ "type": "string"}},- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "icon": {- "type": "string"- },- "slug": {- "type": "string"- }- },- "required": [- "name",- "workspaceId",- "icon",- "slug"- ]- }- }+ "required": [+ "name",+ "color"+ ]+ },+ "TaskImportResult": {+ "type": "object",+ "properties": {+ "results": {+ "$ref": "#/components/schemas/TaskImportSummary"}},- "summary": "Create Project"- }- },- "/project/{id}": {- "get": {- "operationId": "getProject",- "tags": [- "Projects"- ],- "description": "Get a specific project by ID",- "responses": {- "200": {- "description": "Project details",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }+ "required": [+ "results"+ ]+ },+ "TaskImportSummary": {+ "type": "object",+ "properties": {+ "total": {+ "type": "number"+ },+ "successful": {+ "type": "number"+ },+ "failed": {+ "type": "number"+ },+ "tasks": {+ "type": "array",+ "items": {},+ "description": "Per-task outcome, each carrying a success flag."}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {+ "required": [+ "total",+ "successful",+ "failed",+ "tasks"+ ]+ },+ "TaskImageUpload": {+ "type": "object",+ "properties": {+ "key": {+ "type": "string",+ "description": "Object key to send back to the finalize route."+ },+ "uploadUrl": {+ "type": "string",+ "description": "Presigned URL to PUT the image bytes to."+ },+ "headers": {+ "type": "object",+ "additionalProperties": {"type": "string"},- "required": true+ "description": "Headers that must accompany the upload request, including Content-Type."}- ],- "summary": "Get Project"+ },+ "required": [+ "key",+ "uploadUrl",+ "headers"+ ]},- "put": {- "operationId": "updateProject",- "tags": [- "Projects"- ],- "description": "Update an existing project",- "responses": {- "200": {- "description": "Project updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }+ "TaskImageAsset": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "url": {+ "type": "string",+ "description": "Where the stored image can be read back from."}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "id",+ "url"+ ]+ },+ "Column": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "slug": {+ "type": "string",+ "description": "Stable identifier derived from the name; tasks store this as their status."+ },+ "position": {+ "type": "number",+ "description": "Board order, ascending. Columns are always returned sorted by it."+ },+ "icon": {+ "type": [+ "string",+ "null"+ ]+ },+ "color": {+ "type": [+ "string",+ "null"+ ]+ },+ "isFinal": {+ "type": "boolean",+ "description": "Marks the column as a done state, which stops overdue reminders for tasks in it."+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}- ],- "requestBody": {- "required": true,+ },+ "required": [+ "id",+ "projectId",+ "name",+ "slug",+ "position",+ "icon",+ "color",+ "isFinal",+ "createdAt",+ "updatedAt"+ ]+ },+ "Activity": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "taskId": {+ "type": "string"+ },+ "type": {+ "type": "string",+ "description": "One of: comment, task, create, status_changed, priority_changed, assignee_changed, unassigned, due_date_changed, title_changed, description_changed."+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ },+ "userId": {+ "type": [+ "string",+ "null"+ ]+ },"content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "icon": {- "type": "string"- },- "slug": {- "type": "string"- },- "description": {- "type": "string"- },- "isPublic": {- "type": "boolean"- }- },- "required": [- "name",- "icon",- "slug",- "description",- "isPublic"- ]- }- }+ "type": [+ "string",+ "null"+ ]+ },+ "eventData": {+ "description": "Type-specific payload, e.g. { oldStatus, newStatus } for status_changed. Null for plain comments."+ },+ "externalUserName": {+ "type": [+ "string",+ "null"+ ],+ "description": "Set when the activity was imported from another tool."+ },+ "externalUserAvatar": {+ "type": [+ "string",+ "null"+ ]+ },+ "externalSource": {+ "type": [+ "string",+ "null"+ ],+ "description": "The tool it was imported from, e.g. planka, trello, jira."+ },+ "externalUrl": {+ "type": [+ "string",+ "null"+ ]}},- "summary": "Update Project"+ "required": [+ "id",+ "taskId",+ "type",+ "createdAt",+ "updatedAt",+ "userId",+ "content",+ "externalUserName",+ "externalUserAvatar",+ "externalSource",+ "externalUrl"+ ]},- "delete": {- "operationId": "deleteProject",- "tags": [- "Projects"- ],- "description": "Delete a project by ID",- "responses": {- "200": {- "description": "Project deleted successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }+ "Comment": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "taskId": {+ "type": "string"+ },+ "userId": {+ "type": "string"+ },+ "content": {+ "type": "string"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ },+ "user": {+ "$ref": "#/components/schemas/CommentAuthor"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Delete Project"- }- },- "/project/{id}/archive": {- "put": {- "operationId": "archiveProject",- "tags": [- "Projects"- ],- "description": "Archive a project by ID",- "responses": {- "200": {- "description": "Project archived successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }- }- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Archive Project"- }- },- "/project/{id}/unarchive": {- "put": {- "operationId": "unarchiveProject",- "tags": [- "Projects"- ],- "description": "Unarchive a project by ID",- "responses": {- "200": {- "description": "Project unarchived successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- }- }+ "required": [+ "id",+ "taskId",+ "userId",+ "content",+ "createdAt",+ "updatedAt",+ "user"+ ]+ },+ "CommentAuthor": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "image": {+ "type": [+ "string",+ "null"+ ]}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Unarchive Project"- }- },- "/task/tasks/{projectId}": {- "get": {- "operationId": "listTasks",- "tags": [- "Tasks"- ],- "description": "Get all tasks for a specific project",- "responses": {- "200": {- "description": "Project with tasks organized by columns",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }- }- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- },- {- "in": "query",- "name": "status",- "schema": {- "type": "string"- }+ "required": [+ "name",+ "image"+ ]+ },+ "TimeEntry": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"},- {- "in": "query",- "name": "priority",- "schema": {- "type": "string"- }+ "taskId": {+ "type": "string"},- {- "in": "query",- "name": "assigneeId",- "schema": {- "type": "string"- }+ "userId": {+ "type": [+ "string",+ "null"+ ],+ "description": "Null once the user who logged the time has been removed."},- {- "in": "query",- "name": "page",- "schema": {- "type": "string"- }+ "description": {+ "type": [+ "string",+ "null"+ ]},- {- "in": "query",- "name": "limit",- "schema": {- "type": "string"- }+ "startTime": {+ "type": "string",+ "format": "date-time"},- {- "in": "query",- "name": "sortBy",- "schema": {- "enum": [- "createdAt",- "priority",- "dueDate",- "position",- "title",- "number"- ],- "type": "string"- }+ "endTime": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time",+ "description": "Null while the timer is still running."},- {- "in": "query",- "name": "sortOrder",- "schema": {- "enum": [- "asc",- "desc"- ],- "type": "string"- }+ "duration": {+ "type": [+ "number",+ "null"+ ],+ "description": "Elapsed seconds, filled in once the entry has an endTime."},- {- "in": "query",- "name": "dueBefore",- "schema": {- "type": "string"- }+ "createdAt": {+ "type": "string",+ "format": "date-time"},- {- "in": "query",- "name": "dueAfter",- "schema": {- "type": "string"- }- }- ],- "summary": "List Tasks"- }- },- "/task/bulk": {- "patch": {- "operationId": "bulkUpdateTasks",- "tags": [- "Tasks"- ],- "description": "Perform bulk operations on multiple tasks",- "responses": {- "200": {- "description": "Bulk operation completed successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- },- "updatedCount": {- "type": "number"- }- },- "required": [- "success",- "updatedCount"- ]- }- }- }- }- },- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "taskIds": {- "type": "array",- "items": {- "type": "string"- },- "minItems": 1- },- "operation": {- "enum": [- "updateStatus",- "updatePriority",- "updateAssignee",- "delete",- "addLabel",- "removeLabel",- "updateDueDate"- ],- "type": "string"- },- "value": {- "type": "string",- "nullable": true- }- },- "required": [- "taskIds",- "operation"- ]- }- }- }- },- "summary": "Bulk Update Tasks"- }- },- "/task/{projectId}": {- "post": {- "operationId": "createTask",- "tags": [- "Tasks"- ],- "description": "Create a new task in a project",- "responses": {- "200": {- "description": "Task created successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }- }- },- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "title": {- "type": "string"- },- "description": {- "type": "string"- },- "startDate": {- "type": "string"- },- "dueDate": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "status": {- "type": "string"- },- "userId": {- "type": "string"- }- },- "required": [- "title",- "description",- "priority",- "status"- ]- }- }- }- },- "parameters": [- {- "schema": {- "type": "string"- },- "in": "path",- "name": "projectId",- "required": true- }- ],- "summary": "Create Task"- }- },- "/task/{id}": {- "get": {- "operationId": "getTask",- "tags": [- "Tasks"- ],- "description": "Get a specific task by ID",- "responses": {- "200": {- "description": "Task details",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Task"+ "required": [+ "id",+ "taskId",+ "userId",+ "description",+ "startTime",+ "endTime",+ "duration",+ "createdAt",+ "updatedAt"+ ]},- "put": {- "operationId": "updateTask",- "tags": [- "Tasks"- ],- "description": "Update all fields of a task",- "responses": {- "200": {- "description": "Task updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "Label": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "color": {+ "type": "string"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ },+ "taskId": {+ "type": [+ "string",+ "null"+ ]+ },+ "workspaceId": {+ "type": [+ "string",+ "null"+ ]}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "requestBody": {- "required": true,+ "required": [+ "id",+ "name",+ "color",+ "createdAt",+ "updatedAt",+ "taskId",+ "workspaceId"+ ]+ },+ "Notification": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "userId": {+ "type": "string"+ },+ "title": {+ "type": [+ "string",+ "null"+ ]+ },"content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "title": {- "type": "string"- },- "description": {- "type": "string"- },- "startDate": {- "type": "string"- },- "dueDate": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "status": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number"- },- "userId": {- "type": "string"- }- },- "required": [- "title",- "description",- "priority",- "status",- "projectId",- "position"- ]- }- }+ "type": [+ "string",+ "null"+ ],+ "description": "Free-text body. Null for generated notifications, whose text the client renders from type and eventData."+ },+ "type": {+ "type": "string",+ "description": "One of: info, task_created, workspace_created, task_status_changed, task_assignee_changed, time_entry_created, due_date_reminder, task_overdue, task_mention, task_comment."+ },+ "eventData": {+ "description": "Type-specific payload, e.g. { taskTitle, oldStatus, newStatus, projectId, workspaceId }."+ },+ "isRead": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "resourceId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The id of the task or workspace the notification points at."+ },+ "resourceType": {+ "type": [+ "string",+ "null"+ ],+ "description": "`task` or `workspace`."+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "summary": "Update Task"+ "required": [+ "id",+ "userId",+ "title",+ "content",+ "type",+ "isRead",+ "resourceId",+ "resourceType",+ "createdAt",+ "updatedAt"+ ]},- "delete": {- "operationId": "deleteTask",- "tags": [- "Tasks"- ],- "description": "Delete a task by ID",- "responses": {- "200": {- "description": "Task deleted successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "NotificationBulkResult": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"+ "required": [+ "success"+ ]+ },+ "NotificationPreferences": {+ "type": "object",+ "properties": {+ "emailAddress": {+ "type": [+ "string",+ "null"+ ]+ },+ "emailEnabled": {+ "type": "boolean"+ },+ "ntfyEnabled": {+ "type": "boolean"+ },+ "ntfyConfigured": {+ "type": "boolean"+ },+ "ntfyServerUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "ntfyTopic": {+ "type": [+ "string",+ "null"+ ]+ },+ "ntfyTokenConfigured": {+ "type": "boolean"+ },+ "maskedNtfyToken": {+ "type": [+ "string",+ "null"+ ]+ },+ "gotifyEnabled": {+ "type": "boolean"+ },+ "gotifyConfigured": {+ "type": "boolean"+ },+ "gotifyServerUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "gotifyTokenConfigured": {+ "type": "boolean"+ },+ "maskedGotifyToken": {+ "type": [+ "string",+ "null"+ ]+ },+ "webhookEnabled": {+ "type": "boolean"+ },+ "webhookConfigured": {+ "type": "boolean"+ },+ "webhookUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "webhookSecretConfigured": {+ "type": "boolean"+ },+ "maskedWebhookSecret": {+ "type": [+ "string",+ "null"+ ]+ },+ "taskAssignmentEnabled": {+ "type": "boolean"+ },+ "taskCommentEnabled": {+ "type": "boolean"+ },+ "taskStatusChangeEnabled": {+ "type": "boolean"+ },+ "dueDateReminderEnabled": {+ "type": "boolean"+ },+ "dueDateReminderLeadTimeMinutes": {+ "type": "number",+ "description": "How long before a due date the reminder fires, in minutes."+ },+ "workspaces": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/NotificationPreferenceWorkspaceRule"},- "required": true- }- ],- "summary": "Delete Task"- }- },- "/task/move/{id}": {- "put": {- "operationId": "moveTask",- "tags": [- "Tasks"- ],- "description": "Move a task to another project",- "responses": {- "200": {- "description": "Task moved successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "task": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- },- "sourceProjectId": {- "type": "string"- },- "destinationProjectId": {- "type": "string"- }- },- "required": [- "task",- "sourceProjectId",- "destinationProjectId"- ]- }- }- }+ "description": "Per-workspace overrides. A workspace with no rule follows the global settings."+ },+ "createdAt": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "updatedAt": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {+ "required": [+ "emailAddress",+ "emailEnabled",+ "ntfyEnabled",+ "ntfyConfigured",+ "ntfyServerUrl",+ "ntfyTopic",+ "ntfyTokenConfigured",+ "maskedNtfyToken",+ "gotifyEnabled",+ "gotifyConfigured",+ "gotifyServerUrl",+ "gotifyTokenConfigured",+ "maskedGotifyToken",+ "webhookEnabled",+ "webhookConfigured",+ "webhookUrl",+ "webhookSecretConfigured",+ "maskedWebhookSecret",+ "taskAssignmentEnabled",+ "taskCommentEnabled",+ "taskStatusChangeEnabled",+ "dueDateReminderEnabled",+ "dueDateReminderLeadTimeMinutes",+ "workspaces",+ "createdAt",+ "updatedAt"+ ]+ },+ "NotificationPreferenceWorkspaceRule": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "workspaceId": {+ "type": "string"+ },+ "workspaceName": {+ "type": "string"+ },+ "isActive": {+ "type": "boolean",+ "description": "Turn all notifications for this workspace on or off."+ },+ "emailEnabled": {+ "type": "boolean"+ },+ "ntfyEnabled": {+ "type": "boolean"+ },+ "gotifyEnabled": {+ "type": "boolean"+ },+ "webhookEnabled": {+ "type": "boolean"+ },+ "projectMode": {+ "type": "string",+ "enum": [+ "all",+ "selected"+ ],+ "description": "`all` notifies for every project in the workspace; `selected` restricts it to selectedProjectIds."+ },+ "selectedProjectIds": {+ "type": "array",+ "items": {"type": "string"- },- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "destinationProjectId": {- "type": "string"- },- "destinationStatus": {- "type": "string"- }- },- "required": [- "destinationProjectId"- ]- }}+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "summary": "Move Task"- }- },- "/task/export/{projectId}": {- "get": {- "operationId": "exportTasks",- "tags": [- "Tasks"- ],- "description": "Export all tasks from a project",- "responses": {- "200": {- "description": "Exported tasks data",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }+ "required": [+ "id",+ "workspaceId",+ "workspaceName",+ "isActive",+ "emailEnabled",+ "ntfyEnabled",+ "gotifyEnabled",+ "webhookEnabled",+ "projectMode",+ "selectedProjectIds",+ "createdAt",+ "updatedAt"+ ]+ },+ "SearchResponse": {+ "type": "object",+ "properties": {+ "results": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/SearchResult"}+ },+ "totalCount": {+ "type": "number",+ "description": "Total matches found before the `limit` slice, so a caller can tell that more exist."+ },+ "searchQuery": {+ "type": "string",+ "description": "The query that was run."}},- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "results",+ "totalCount",+ "searchQuery"+ ]+ },+ "SearchResult": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "type": {+ "type": "string",+ "enum": [+ "task",+ "project",+ "workspace",+ "comment",+ "activity"+ ]+ },+ "title": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "content": {+ "type": "string",+ "description": "Matched body text, for comment and activity results. Activities get a rendered summary such as `changed status from Todo to In Progress`."+ },+ "projectId": {+ "type": "string"+ },+ "projectName": {+ "type": "string"+ },+ "projectSlug": {+ "type": "string"+ },+ "workspaceId": {+ "type": "string"+ },+ "workspaceName": {+ "type": "string"+ },+ "userId": {+ "type": "string"+ },+ "userName": {+ "type": "string"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "relevanceScore": {+ "type": "number",+ "description": "Higher is a better match. Results are sorted by score, then by createdAt descending."+ },+ "taskNumber": {+ "type": "number"+ },+ "priority": {+ "type": "string"+ },+ "status": {+ "type": "string"}- ],- "summary": "Export Tasks"- }- },- "/task/import/{projectId}": {- "post": {- "operationId": "importTasks",- "tags": [- "Tasks"- ],- "description": "Import multiple tasks into a project",- "responses": {- "200": {- "description": "Tasks imported successfully",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ },+ "required": [+ "id",+ "type",+ "title",+ "createdAt",+ "relevanceScore"+ ]+ },+ "GitHubAppInfo": {+ "type": "object",+ "properties": {+ "appName": {+ "type": [+ "string",+ "null"+ ],+ "description": "The configured GitHub App slug, or null when this instance has no App set up."}},- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"+ "required": [+ "appName"+ ]+ },+ "GitHubRepositoryList": {+ "type": "object",+ "properties": {+ "repositories": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/GitHubRepository"},- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "tasks": {- "type": "array",- "items": {- "type": "object",- "properties": {- "title": {- "type": "string"- },- "description": {- "type": "string"- },- "status": {- "type": "string"- },- "priority": {- "type": "string"- },- "startDate": {- "type": "string",- "nullable": true- },- "dueDate": {- "type": "string",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- }- },- "required": [- "title",- "status"- ]- }- }- },- "required": [- "tasks"- ]- }+ "description": "Deduplicated across installations, most recently updated first."+ },+ "installations": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/GitHubInstallation"}+ },+ "total": {+ "type": "number"}},- "summary": "Import Tasks"- }- },- "/task/status/{id}": {- "put": {- "operationId": "updateTaskStatus",- "tags": [- "Tasks"- ],- "description": "Update only the status of a task",- "responses": {- "200": {- "description": "Task status updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "required": [+ "repositories",+ "installations",+ "total"+ ]+ },+ "GitHubRepository": {+ "type": "object",+ "properties": {+ "id": {+ "type": "number"+ },+ "name": {+ "type": "string"+ },+ "full_name": {+ "type": "string"+ },+ "private": {+ "type": "boolean"+ },+ "owner": {+ "$ref": "#/components/schemas/GitHubRepositoryOwner"+ },+ "description": {+ "type": [+ "string",+ "null"+ ]+ },+ "html_url": {+ "type": "string"+ },+ "permissions": {+ "$ref": "#/components/schemas/GitHubRepositoryPermissions"+ },+ "updated_at": {+ "type": "string",+ "format": "date-time"+ },+ "installation_id": {+ "type": "number",+ "description": "Which App installation this repository came through."}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {+ "required": [+ "id",+ "name",+ "full_name",+ "private",+ "owner",+ "description",+ "html_url",+ "updated_at",+ "installation_id"+ ]+ },+ "GitHubRepositoryOwner": {+ "type": "object",+ "properties": {+ "login": {+ "type": "string"+ },+ "avatar_url": {+ "type": "string"+ },+ "type": {+ "type": "string"+ }+ },+ "required": [+ "login",+ "avatar_url",+ "type"+ ]+ },+ "GitHubRepositoryPermissions": {+ "type": "object",+ "properties": {+ "admin": {+ "type": "boolean"+ },+ "push": {+ "type": "boolean"+ },+ "pull": {+ "type": "boolean"+ }+ },+ "required": [+ "admin",+ "push",+ "pull"+ ]+ },+ "GitHubInstallation": {+ "type": "object",+ "properties": {+ "id": {+ "type": "number"+ },+ "account": {+ "$ref": "#/components/schemas/GitHubInstallationAccount"+ },+ "repositories": {+ "type": "array",+ "items": {"type": "string"},- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "status": {- "type": "string"- }- },- "required": [- "status"- ]- }- }+ "description": "Full names of the repositories under this installation. Empty when listing them failed."}},- "summary": "Update Task Status"- }- },- "/task/priority/{id}": {- "put": {- "operationId": "updateTaskPriority",- "tags": [- "Tasks"+ "required": [+ "id",+ "account",+ "repositories"+ ]+ },+ "GitHubInstallationAccount": {+ "type": [+ "object",+ "null"],- "description": "Update only the priority of a task",- "responses": {- "200": {- "description": "Task priority updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "properties": {+ "login": {+ "type": "string"+ },+ "type": {+ "type": "string"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {+ "required": [+ "login",+ "type"+ ]+ },+ "GitHubVerificationResult": {+ "type": "object",+ "properties": {+ "isInstalled": {+ "type": "boolean"+ },+ "installationId": {+ "type": [+ "number",+ "null"+ ]+ },+ "repositoryExists": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "repositoryPrivate": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "permissions": {+ "type": [+ "object",+ "null"+ ],+ "additionalProperties": {"type": "string"},- "required": true+ "description": "The permissions the installation currently grants."+ },+ "hasRequiredPermissions": {+ "type": "boolean"+ },+ "missingPermissions": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Permissions that must be granted before the link will work."+ },+ "message": {+ "type": "string",+ "description": "A human-readable summary to show the user."+ },+ "settingsUrl": {+ "type": "string",+ "description": "Where to adjust the installation, when one exists."+ },+ "installationUrl": {+ "type": "string",+ "description": "Where to install the App, when it is not installed yet."}+ },+ "required": [+ "isInstalled",+ "installationId",+ "repositoryExists",+ "repositoryPrivate",+ "permissions",+ "hasRequiredPermissions",+ "missingPermissions",+ "message"+ ]+ },+ "GitHubIntegration": {+ "type": [+ "object",+ "null"],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- }- },- "required": [- "priority"- ]- }- }+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "repositoryOwner": {+ "type": "string"+ },+ "repositoryName": {+ "type": "string"+ },+ "installationId": {+ "type": [+ "number",+ "null"+ ],+ "description": "The GitHub App installation that grants access to the repository."+ },+ "branchPattern": {+ "type": "string",+ "description": "Template used to name branches created for a task."+ },+ "commentTaskLinkOnGitHubIssue": {+ "type": "boolean",+ "description": "When on, Kaneo comments a link back to the task on the linked GitHub issue."+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "summary": "Update Task Priority"- }- },- "/task/assignee/{id}": {- "put": {- "operationId": "updateTaskAssignee",- "tags": [- "Tasks"- ],- "description": "Assign or unassign a task to a user",- "responses": {- "200": {- "description": "Task assignee updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "required": [+ "id",+ "projectId",+ "repositoryOwner",+ "repositoryName",+ "installationId",+ "isActive",+ "createdAt",+ "updatedAt"+ ]+ },+ "CreatedGitHubIntegration": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "repositoryOwner": {+ "type": "string"+ },+ "repositoryName": {+ "type": "string"+ },+ "installationId": {+ "type": [+ "number",+ "null"+ ],+ "description": "The GitHub App installation that grants access to the repository."+ },+ "branchPattern": {+ "type": "string",+ "description": "Template used to name branches created for a task."+ },+ "commentTaskLinkOnGitHubIssue": {+ "type": "boolean",+ "description": "When on, Kaneo comments a link back to the task on the linked GitHub issue."+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "repositoryOwner",+ "repositoryName",+ "installationId"+ ]+ },+ "GitHubDeleteResult": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean"+ },+ "message": {+ "type": "string"}- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "userId": {- "type": "string",- "nullable": true- }- },- "required": [- "userId"- ]- }+ },+ "required": [+ "success",+ "message"+ ]+ },+ "IssueImportResult": {+ "type": "object",+ "properties": {+ "imported": {+ "type": "number"+ },+ "skipped": {+ "type": "number",+ "description": "Issues that already had a task, or were not importable."+ },+ "errors": {+ "type": "array",+ "items": {+ "type": "string"}}},- "summary": "Update Task Assignee"- }- },- "/task/due-date/{id}": {- "put": {- "operationId": "updateTaskDueDate",- "tags": [- "Tasks"- ],- "description": "Update only the due date of a task",- "responses": {- "200": {- "description": "Task due date updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }+ "required": [+ "imported",+ "skipped"+ ]+ },+ "GiteaRepositoryList": {+ "type": "object",+ "properties": {+ "repositories": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/GiteaRepository"}}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "repositories"+ ]+ },+ "GiteaRepository": {+ "type": "object",+ "properties": {+ "id": {+ "type": "number"+ },+ "name": {+ "type": "string"+ },+ "full_name": {+ "type": "string"+ },+ "owner": {+ "$ref": "#/components/schemas/GiteaRepositoryOwner"+ },+ "private": {+ "type": "boolean"+ },+ "html_url": {+ "type": "string"}- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "dueDate": {- "type": "string"- }- }- }+ },+ "required": [+ "id",+ "name",+ "full_name",+ "owner",+ "private",+ "html_url"+ ]+ },+ "GiteaRepositoryOwner": {+ "type": "object",+ "properties": {+ "login": {+ "type": "string"+ }+ },+ "required": [+ "login"+ ]+ },+ "GiteaVerificationResult": {+ "type": "object",+ "properties": {+ "isInstalled": {+ "type": "boolean"+ },+ "hasRequiredPermissions": {+ "type": "boolean"+ },+ "repositoryExists": {+ "type": "boolean"+ },+ "repositoryPrivate": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "missingPermissions": {+ "type": "array",+ "items": {+ "type": "string"}+ },+ "message": {+ "type": "string",+ "description": "A human-readable summary to show the user."+ },+ "failureReason": {+ "type": [+ "string",+ "null"+ ],+ "enum": [+ "not_a_gitea_instance",+ "redirected",+ "repository_not_found",+ null+ ],+ "description": "Why verification failed, when it did. `redirected` usually means the base URL is behind a proxy that rewrites it."}},- "summary": "Update Task Due Date"- }- },- "/task/title/{id}": {- "put": {- "operationId": "updateTaskTitle",- "tags": [- "Tasks"+ "required": [+ "isInstalled",+ "hasRequiredPermissions",+ "repositoryExists",+ "repositoryPrivate",+ "missingPermissions",+ "message",+ "failureReason"+ ]+ },+ "GiteaIntegration": {+ "type": [+ "object",+ "null"],- "description": "Update only the title of a task",- "responses": {- "200": {- "description": "Task title updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "baseUrl": {+ "type": "string",+ "description": "Root URL of the Gitea instance."+ },+ "repositoryOwner": {+ "type": "string"+ },+ "repositoryName": {+ "type": "string"+ },+ "maskedAccessToken": {+ "type": "string"+ },+ "webhookUrl": {+ "type": "string",+ "description": "Where Gitea should POST events for this project."+ },+ "webhookSecret": {+ "type": "string",+ "description": "Only returned to callers with workspace:manage_settings, so the value can be pasted into Gitea."+ },+ "branchPattern": {+ "type": "string"+ },+ "commentTaskLinkOnGiteaIssue": {+ "type": "boolean",+ "description": "When on, Kaneo comments a link back to the task on the linked Gitea issue."+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ }+ },+ "required": [+ "id",+ "projectId",+ "baseUrl",+ "repositoryOwner",+ "repositoryName",+ "maskedAccessToken",+ "isActive",+ "createdAt",+ "updatedAt"+ ]+ },+ "GiteaDeleteResult": {+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean"+ },+ "message": {+ "type": "string"+ }+ },+ "required": [+ "success",+ "message"+ ]+ },+ "GiteaImportResult": {+ "type": "object",+ "properties": {+ "imported": {+ "type": "number"+ },+ "updated": {+ "type": "number",+ "description": "Existing tasks that were refreshed from their issue."+ },+ "skipped": {+ "type": "number"+ },+ "errors": {+ "type": "array",+ "items": {+ "type": "string"}}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "imported",+ "updated",+ "skipped"+ ]+ },+ "GenericWebhookIntegration": {+ "type": [+ "object",+ "null"+ ],+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "webhookConfigured": {+ "type": "boolean"+ },+ "maskedWebhookUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "secretConfigured": {+ "type": "boolean"+ },+ "maskedSecret": {+ "type": [+ "string",+ "null"+ ],+ "description": "A preview of the HMAC signing secret used to sign outgoing deliveries."+ },+ "events": {+ "$ref": "#/components/schemas/GenericWebhookEvents"+ },+ "dueDateReminderLeadTimeMinutes": {+ "type": "number",+ "description": "How long before a due date the dueDateReminder event fires, in minutes."+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ }+ },+ "required": [+ "id",+ "projectId",+ "webhookConfigured",+ "maskedWebhookUrl",+ "secretConfigured",+ "maskedSecret",+ "events",+ "dueDateReminderLeadTimeMinutes",+ "isActive",+ "createdAt",+ "updatedAt"+ ]+ },+ "GenericWebhookEvents": {+ "allOf": [+ {+ "$ref": "#/components/schemas/IntegrationEvents"+ },+ {+ "type": "object",+ "properties": {+ "taskDeleted": {+ "type": "boolean"+ },+ "taskMoved": {+ "type": "boolean"+ },+ "taskDueDateChanged": {+ "type": "boolean"+ },+ "taskAssigneeChanged": {+ "type": "boolean"+ },+ "taskUnassigned": {+ "type": "boolean"+ },+ "dueDateReminder": {+ "type": "boolean"+ }+ },+ "required": [+ "taskDeleted",+ "taskMoved",+ "taskDueDateChanged",+ "taskAssigneeChanged",+ "taskUnassigned",+ "dueDateReminder"+ ]+ }+ ]+ },+ "IntegrationEvents": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"}+ },+ "required": [+ "taskCreated",+ "taskStatusChanged",+ "taskPriorityChanged",+ "taskTitleChanged",+ "taskDescriptionChanged",+ "taskCommentCreated"+ ]+ },+ "DiscordIntegration": {+ "type": [+ "object",+ "null"],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "title": {- "type": "string"- }- },- "required": [- "title"- ]- }- }+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "channelName": {+ "type": [+ "string",+ "null"+ ]+ },+ "webhookConfigured": {+ "type": "boolean"+ },+ "maskedWebhookUrl": {+ "type": "string",+ "description": "The webhook URL with its secret path segment masked, or an empty string when none is set."+ },+ "events": {+ "$ref": "#/components/schemas/IntegrationEvents"+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "summary": "Update Task Title"- }- },- "/task/image-upload/{id}": {- "put": {- "operationId": "createTaskImageUpload",- "tags": [- "Tasks"+ "required": [+ "id",+ "projectId",+ "channelName",+ "webhookConfigured",+ "maskedWebhookUrl",+ "events",+ "isActive",+ "createdAt",+ "updatedAt"+ ]+ },+ "SlackIntegration": {+ "type": [+ "object",+ "null"],- "description": "Create a presigned image upload URL for a task description or comment",- "responses": {- "200": {- "description": "Image upload URL created successfully",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "channelName": {+ "type": [+ "string",+ "null"+ ]+ },+ "webhookConfigured": {+ "type": "boolean"+ },+ "maskedWebhookUrl": {+ "type": "string",+ "description": "The webhook URL with its secret path segment masked, or an empty string when none is set."+ },+ "events": {+ "$ref": "#/components/schemas/IntegrationEvents"+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "parameters": [+ "required": [+ "id",+ "projectId",+ "channelName",+ "webhookConfigured",+ "maskedWebhookUrl",+ "events",+ "isActive",+ "createdAt",+ "updatedAt"+ ]+ },+ "TelegramIntegration": {+ "type": [+ "object",+ "null"+ ],+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "chatId": {+ "type": "string",+ "description": "The Telegram chat, group, or channel messages are sent to."+ },+ "threadId": {+ "type": [+ "number",+ "null"+ ],+ "description": "Forum topic id, when the target group uses topics."+ },+ "chatLabel": {+ "type": [+ "string",+ "null"+ ],+ "description": "A human-readable name for the chat, shown in the UI."+ },+ "botTokenConfigured": {+ "type": "boolean"+ },+ "maskedBotToken": {+ "type": "string"+ },+ "events": {+ "$ref": "#/components/schemas/IntegrationEvents"+ },+ "isActive": {+ "type": [+ "boolean",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ }+ },+ "required": [+ "id",+ "projectId",+ "chatId",+ "threadId",+ "chatLabel",+ "botTokenConfigured",+ "maskedBotToken",+ "events",+ "isActive",+ "createdAt",+ "updatedAt"+ ]+ },+ "TaskRelationWithTasks": {+ "allOf": [{- "in": "path",- "name": "id",- "schema": {- "type": "string"+ "$ref": "#/components/schemas/TaskRelation"+ },+ {+ "type": "object",+ "properties": {+ "sourceTask": {+ "$ref": "#/components/schemas/RelatedTask"+ },+ "targetTask": {+ "$ref": "#/components/schemas/RelatedTask"+ }},- "required": true+ "required": [+ "sourceTask",+ "targetTask"+ ]}+ ]+ },+ "RelatedTask": {+ "type": [+ "object",+ "null"],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "filename": {- "type": "string"- },- "contentType": {- "type": "string"- },- "size": {- "type": "number"- },- "surface": {- "enum": [- "description",- "comment"- ],- "type": "string"- }- },- "required": [- "filename",- "contentType",- "size",- "surface"- ]- }- }+ "properties": {+ "id": {+ "type": "string"+ },+ "title": {+ "type": "string"+ },+ "status": {+ "type": "string"+ },+ "priority": {+ "type": [+ "string",+ "null"+ ]+ },+ "number": {+ "type": [+ "number",+ "null"+ ]+ },+ "projectId": {+ "type": "string"+ },+ "userId": {+ "type": [+ "string",+ "null"+ ]+ },+ "assigneeName": {+ "type": [+ "string",+ "null"+ ]}},- "summary": "Create Task Image Upload"- }- },- "/task/image-upload/{id}/finalize": {- "post": {- "operationId": "finalizeTaskImageUpload",- "tags": [- "Tasks"- ],- "description": "Finalize an uploaded task image and create a private asset record",- "responses": {- "200": {- "description": "Image upload finalized successfully",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ "required": [+ "id",+ "title",+ "status",+ "priority",+ "number",+ "projectId",+ "userId",+ "assigneeName"+ ]+ },+ "TaskRelation": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "sourceTaskId": {+ "type": "string"+ },+ "targetTaskId": {+ "type": "string"+ },+ "relationType": {+ "type": "string",+ "description": "How the two tasks relate: `subtask`, `blocks`, or `related`."+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ }+ },+ "required": [+ "id",+ "sourceTaskId",+ "targetTaskId",+ "relationType",+ "createdAt"+ ]+ },+ "ExternalLink": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "taskId": {+ "type": "string"+ },+ "integrationId": {+ "type": "string"+ },+ "resourceType": {+ "type": "string",+ "description": "The kind of remote resource, e.g. `issue` or `pull_request`."+ },+ "externalId": {+ "type": "string",+ "description": "The provider's own identifier for the linked resource."+ },+ "url": {+ "type": "string"+ },+ "title": {+ "type": [+ "string",+ "null"+ ]+ },+ "metadata": {+ "description": "Provider-specific payload, parsed from the stored JSON string. Null when the link has no metadata."+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"+ },+ "integration": {+ "$ref": "#/components/schemas/ExternalLinkIntegration"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "key": {- "type": "string"- },- "filename": {- "type": "string"- },- "contentType": {- "type": "string"- },- "size": {- "type": "number"- },- "surface": {- "enum": [- "description",- "comment"- ],- "type": "string"- }- },- "required": [- "key",- "filename",- "contentType",- "size",- "surface"- ]- }- }+ "required": [+ "id",+ "taskId",+ "integrationId",+ "resourceType",+ "externalId",+ "url",+ "title",+ "createdAt",+ "updatedAt",+ "integration"+ ]+ },+ "ExternalLinkIntegration": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "type": {+ "type": "string"}},- "summary": "Finalize Task Image Upload"- }- },- "/task/description/{id}": {- "put": {- "operationId": "updateTaskDescription",- "tags": [- "Tasks"- ],- "description": "Update only the description of a task",- "responses": {- "200": {- "description": "Task description updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- }- }+ "required": [+ "id",+ "type"+ ]+ },+ "WorkflowRule": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "integrationType": {+ "type": "string",+ "description": "The integration that emits the event, e.g. `github`."+ },+ "eventType": {+ "type": "string",+ "description": "The provider event that triggers the move, e.g. `pull_request.opened`."+ },+ "columnId": {+ "type": "string",+ "description": "The column tasks are moved to when the event fires."+ },+ "columnName": {+ "type": [+ "string",+ "null"+ ]+ },+ "columnSlug": {+ "type": [+ "string",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "id",+ "projectId",+ "integrationType",+ "eventType",+ "columnId",+ "columnName",+ "columnSlug",+ "createdAt",+ "updatedAt"+ ]+ },+ "WorkflowRuleRow": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "projectId": {+ "type": "string"+ },+ "integrationType": {+ "type": "string"+ },+ "eventType": {+ "type": "string"+ },+ "columnId": {+ "type": "string"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "updatedAt": {+ "type": "string",+ "format": "date-time"}- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "description": {- "type": "string"- }- },- "required": [- "description"- ]- }- }+ },+ "required": [+ "id",+ "projectId",+ "integrationType",+ "eventType",+ "columnId",+ "createdAt",+ "updatedAt"+ ]+ },+ "PendingInvitation": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "email": {+ "type": "string"+ },+ "workspaceId": {+ "type": "string"+ },+ "workspaceName": {+ "type": "string"+ },+ "inviterName": {+ "type": "string"+ },+ "expiresAt": {+ "type": "string",+ "format": "date-time"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "status": {+ "type": "string",+ "description": "Always `pending` here; expired and accepted ones are filtered out."}},- "summary": "Update Task Description"- }- },- "/column/{projectId}": {- "get": {- "operationId": "getColumns",- "tags": [- "Columns"- ],- "description": "Get all columns for a project",- "responses": {- "200": {- "description": "List of columns ordered by position",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ "required": [+ "id",+ "email",+ "workspaceId",+ "workspaceName",+ "inviterName",+ "expiresAt",+ "createdAt",+ "status"+ ]+ },+ "InvitationDetails": {+ "type": "object",+ "properties": {+ "valid": {+ "type": "boolean",+ "description": "True only when the invitation can still be accepted."+ },+ "invitation": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "email": {+ "type": "string"+ },+ "workspaceName": {+ "type": "string"+ },+ "inviterName": {+ "type": "string"+ },+ "expiresAt": {+ "type": "string",+ "format": "date-time"+ },+ "status": {+ "type": "string"+ },+ "expired": {+ "type": "boolean"+ }+ },+ "required": [+ "id",+ "email",+ "workspaceName",+ "inviterName",+ "expiresAt",+ "status",+ "expired"+ ],+ "description": "Omitted when the invitation does not exist, was already accepted, or was canceled -- the details are withheld rather than leaked."+ },+ "error": {+ "type": "string",+ "description": "Why the invitation is unusable, when valid is false."}},- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true+ "required": [+ "valid"+ ]+ },+ "WorkspaceMember": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "email": {+ "type": "string"+ },+ "image": {+ "type": [+ "string",+ "null"+ ]+ },+ "role": {+ "type": "string",+ "description": "The member's workspace role: a built-in role (owner, admin, member, guest) or a custom role name."}- ],- "summary": "Get Columns"+ },+ "required": [+ "id",+ "name",+ "email",+ "image",+ "role"+ ]},- "post": {- "operationId": "createColumn",- "tags": [- "Columns"- ],- "description": "Create a new column in a project",- "responses": {- "200": {- "description": "Column created successfully",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ "UserAvatar": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "url": {+ "type": "string",+ "description": "Public URL for the stored avatar, served from /api/user/avatar/{id}."+ },+ "size": {+ "type": "number",+ "description": "Decoded size in bytes."}},- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "icon": {- "type": "string"- },- "color": {- "type": "string"- },- "isFinal": {- "type": "boolean"- }- },- "required": [- "name"- ]- }- }+ "required": [+ "id",+ "url",+ "size"+ ]+ },+ "UserAvatarDeleted": {+ "type": "object",+ "properties": {+ "deleted": {+ "type": "boolean",+ "description": "False when the user had no uploaded avatar to remove."}},- "summary": "Create Column"+ "required": [+ "deleted"+ ]}},- "/column/reorder/{projectId}": {- "put": {- "operationId": "reorderColumns",+ "parameters": {}+ },+ "paths": {+ "/instance/status": {+ "get": {+ "operationId": "getInstanceStatus","tags": [- "Columns"+ "Instance"],- "description": "Reorder columns in a project",+ "summary": "Get instance status",+ "description": "Public instance setup status. When hasUsers is false the next signup becomes the instance admin.",+ "security": [],"responses": {"200": {- "description": "Columns reordered successfully",+ "description": "Instance status","content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/InstanceStatus"}}}}- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "columns": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "position": {- "type": "number"- }- },- "required": [- "id",- "position"- ]- }- }- },- "required": [- "columns"- ]- }- }- }- },- "summary": "Reorder Columns"+ }}},- "/column/{id}": {- "put": {- "operationId": "updateColumn",+ "/auth/get-session": {+ "get": {+ "operationId": "getSession","tags": [- "Columns"+ "Authentication"],- "description": "Update a column",+ "summary": "Get session",+ "description": "Get the current authenticated session, or null when the caller is not signed in. Served by Better Auth.",+ "security": [],"responses": {"200": {- "description": "Column updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ "description": "Current session details, or null when unauthenticated"}- },+ }+ }+ },+ "/asset/{id}": {+ "get": {+ "operationId": "getAsset",+ "tags": [+ "Assets"+ ],+ "summary": "Download asset",+ "description": "Download an uploaded asset. Readable without signing in only when it belongs to a public project; image types are served inline, everything else as an attachment.",+ "security": [],"parameters": [{- "in": "path",- "name": "id","schema": {"type": "string"},- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "color": {- "type": "string",- "nullable": true- },- "isFinal": {- "type": "boolean"- }- }- }- }+ "required": true,+ "name": "id",+ "in": "path"}- },- "summary": "Update Column"- },- "delete": {- "operationId": "deleteColumn",- "tags": [- "Columns"],- "description": "Delete a column","responses": {"200": {- "description": "Column deleted successfully",+ "description": "The requested asset binary stream","content": {- "application/json": {+ "*/*": {"schema": {- "type": "object"+ "type": "string",+ "format": "binary"}}}+ },+ "304": {+ "description": "Not modified"+ },+ "403": {+ "description": "No access to this asset"+ },+ "404": {+ "description": "Asset not found"}- },+ }+ }+ },+ "/user/avatar/{id}": {+ "get": {+ "operationId": "getUserAvatar",+ "tags": [+ "User"+ ],+ "summary": "Download avatar",+ "description": "Download a user avatar by its avatar ID. Public, immutable, and cache-friendly: the id changes whenever the avatar is replaced.",+ "security": [],"parameters": [{- "in": "path",- "name": "id","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Delete Column"- }- },- "/activity/{taskId}": {- "get": {- "operationId": "getActivities",- "tags": [- "Activity"- ],- "description": "Get all activities for a specific task","responses": {"200": {- "description": "List of activities for the task",+ "description": "The avatar image","content": {- "application/json": {+ "image/*": {"schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "userId": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true- },- "externalSource": {- "type": "string",- "nullable": true- },- "externalUrl": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "taskId",- "type",- "createdAt",- "userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"- ]- }+ "type": "string",+ "format": "binary"}}}+ },+ "304": {+ "description": "Not modified"+ },+ "404": {+ "description": "Avatar not found"}- },- "parameters": [- {- "in": "path",- "name": "taskId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Activities"+ }}},- "/activity/create": {- "post": {- "operationId": "createActivity",+ "/config": {+ "get": {+ "operationId": "getConfig","tags": [- "Activity"+ "Config"],- "description": "Create a new activity (system-generated event)",+ "summary": "Get config",+ "description": "Public instance settings: which sign-in methods, registration paths, and features are enabled.",+ "security": [],"responses": {"200": {- "description": "Activity created successfully",+ "description": "Application settings","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "userId": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true- },- "externalSource": {- "type": "string",- "nullable": true- },- "externalUrl": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "taskId",- "type",- "createdAt",- "userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"- ]+ "$ref": "#/components/schemas/Config"}}}}- },+ }+ }+ },+ "/auth/organization/accept-invitation": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "acceptOrganizationInvitation",+ "summary": "Accept Organization Invitation",+ "description": "Accept an invitation to an organization","requestBody": {"required": true,"content": {@@ -3120,126 +3351,53 @@"schema": {"type": "object","properties": {- "taskId": {- "type": "string"- },- "userId": {- "type": "string"- },- "message": {+ "invitationId": {"type": "string",- "nullable": true- },- "type": {- "type": "string"- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true+ "description": "The ID of the invitation to accept"}},"required": [- "taskId",- "userId",- "message",- "type"+ "invitationId"]}}}},- "summary": "Create Activity"- }- },- "/activity/comment": {- "post": {- "operationId": "createComment",- "tags": [- "Activity"- ],- "description": "Create a new comment on a task","responses": {"200": {- "description": "Comment created successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "userId": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {+ "invitation": {"type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true- },- "externalSource": {- "type": "string",- "nullable": true+ "additionalProperties": {}},- "externalUrl": {- "type": "string",- "nullable": true+ "member": {+ "type": "object",+ "additionalProperties": {}}- },- "required": [- "id",- "taskId",- "type",- "createdAt",- "userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"- ]+ }}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/add-team-member": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "addOrganizationTeamMember",+ "summary": "Add Organization Team Member",+ "description": "The newly created member","requestBody": {"required": true,"content": {@@ -3247,110 +3405,79 @@"schema": {"type": "object","properties": {- "taskId": {- "type": "string"+ "teamId": {+ "type": "string",+ "description": "The team the user should be a member of."},- "comment": {- "type": "string"+ "userId": {+ "type": "string",+ "description": "The user Id which represents the user to be added as a member."+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization ID which the team falls under. If not provided, it will default to the user's active organization."}},"required": [- "taskId",- "comment"+ "teamId",+ "userId"]}}}},- "summary": "Create Comment"- },- "put": {- "operationId": "updateComment",- "tags": [- "Activity"- ],- "description": "Update an existing comment","responses": {"200": {- "description": "Comment updated successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {"id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {"type": "string",- "format": "date-time"+ "description": "Unique identifier of the team member"},"userId": {"type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true+ "description": "The user ID of the team member"},- "externalSource": {+ "teamId": {"type": "string",- "nullable": true+ "description": "The team ID of the team the team member is in"},- "externalUrl": {+ "createdAt": {"type": "string",- "nullable": true+ "description": "Timestamp when the team member was created"}},"required": ["id",- "taskId",- "type",- "createdAt","userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"+ "teamId",+ "createdAt"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/cancel-invitation": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "cancelOrganizationInvitation",+ "summary": "Cancel Organization Invitation",+ "description": "Cancel Organization Invitation","requestBody": {"required": true,"content": {@@ -3358,110 +3485,36 @@"schema": {"type": "object","properties": {- "activityId": {- "type": "string"- },- "comment": {- "type": "string"+ "invitationId": {+ "type": "string",+ "description": "The ID of the invitation to cancel"}},"required": [- "activityId",- "comment"+ "invitationId"]}}}},- "summary": "Update Comment"- },- "delete": {- "operationId": "deleteComment",- "tags": [- "Activity"- ],- "description": "Delete a comment","responses": {"200": {- "description": "Comment deleted successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "userId": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true- },- "externalSource": {- "type": "string",- "nullable": true- },- "externalUrl": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "taskId",- "type",- "createdAt",- "userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"- ]- }- }- }+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/check-slug": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "checkOrganizationSlug",+ "summary": "Check Organization Slug",+ "description": "Check Organization Slug","requestBody": {"required": true,"content": {@@ -3469,174 +3522,120 @@"schema": {"type": "object","properties": {- "activityId": {- "type": "string"+ "slug": {+ "type": "string",+ "description": "The organization slug to check. Eg: \"my-org\""}},"required": [- "activityId"+ "slug"]}}}},- "summary": "Delete Comment"+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }}},- "/comment/{taskId}": {- "get": {- "operationId": "getTaskComments",+ "/auth/organization/create": {+ "post": {"tags": [- "Comments"+ "Organization Management"],- "description": "Get all comments for a specific task",- "responses": {- "200": {- "description": "List of comments for the task",- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "userId": {- "type": "string"- },- "content": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- },- "user": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "image": {- "type": "string",- "nullable": true- }- },- "required": [- "name",- "image"- ]- }- },- "required": [- "id",- "taskId",- "userId",- "content",- "createdAt",- "updatedAt"+ "operationId": "createOrganization",+ "summary": "Create Organization",+ "description": "Create an organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string",+ "description": "The name of the organization"+ },+ "slug": {+ "type": "string",+ "description": "The slug of the organization"+ },+ "userId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The user id of the organization creator. If not provided, the current user will be used. Should only be used by admins or when called by the server. server-only. Eg: \"user-id\""+ },+ "logo": {+ "type": [+ "string",+ "null"+ ],+ "description": "The logo of the organization"+ },+ "metadata": {+ "type": [+ "string",+ "null"+ ],+ "description": "The metadata of the organization"+ },+ "keepCurrentActiveOrganization": {+ "type": [+ "boolean",+ "null"+ ],+ "description": "Whether to keep the current active organization active after creating a new one. Eg: true"+ },+ "description": {+ "type": [+ "string",+ "null"]}- }+ },+ "required": [+ "name",+ "slug"+ ]}}}},- "parameters": [- {- "in": "path",- "name": "taskId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Task Comments"- },- "post": {- "operationId": "createTaskComment",- "tags": [- "Comments"- ],- "description": "Create a new comment on a task","responses": {"200": {- "description": "Comment created successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "userId": {- "type": "string"- },- "content": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- },- "user": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "image": {- "type": "string",- "nullable": true- }- },- "required": [- "name",- "image"- ]- }- },- "required": [- "id",- "taskId",- "userId",- "content",- "createdAt",- "updatedAt"- ]+ "additionalProperties": {}}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "taskId",- "schema": {- "type": "string"- },- "required": true- }+ }+ }+ },+ "/auth/organization/create-role": {+ "post": {+ "tags": [+ "Organization Management"],+ "operationId": "createOrganizationRole",+ "summary": "Create Organization Role",+ "description": "Create Organization Role","requestBody": {"required": true,"content": {@@ -3644,96 +3643,134 @@"schema": {"type": "object","properties": {- "content": {+ "organizationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "role": {"type": "string",- "minLength": 1+ "description": "The name of the role to create"+ },+ "permission": {+ "type": "string",+ "description": "The permission to assign to the role"+ },+ "additionalFields": {+ "type": [+ "object",+ "null"+ ],+ "additionalProperties": {}}},"required": [- "content"+ "role",+ "permission"]}}}},- "summary": "Create Task Comment"+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }}},- "/comment/{id}": {- "put": {- "operationId": "updateTaskComment",+ "/auth/organization/create-team": {+ "post": {"tags": [- "Comments"+ "Organization Management"],- "description": "Update an existing comment (author only)",+ "operationId": "createOrganizationTeam",+ "summary": "Create Organization Team",+ "description": "Create a new team within an organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string",+ "description": "The name of the team. Eg: \"my-team\""+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization ID which the team will be created in. Defaults to the active organization. Eg: \"organization-id\""+ }+ },+ "required": [+ "name"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Comment updated successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {"id": {- "type": "string"- },- "taskId": {- "type": "string"+ "type": "string",+ "description": "Unique identifier of the created team"},- "userId": {- "type": "string"+ "name": {+ "type": "string",+ "description": "Name of the team"},- "content": {- "type": "string"+ "organizationId": {+ "type": "string",+ "description": "ID of the organization the team belongs to"},"createdAt": {"type": "string",- "format": "date-time"+ "description": "Timestamp when the team was created"},"updatedAt": {"type": "string",- "format": "date-time"- },- "user": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "image": {- "type": "string",- "nullable": true- }- },- "required": [- "name",- "image"- ]+ "description": "Timestamp when the team was last updated"}},"required": ["id",- "taskId",- "userId",- "content",- "createdAt",- "updatedAt"- ]- }- }- }- }- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true+ "name",+ "organizationId",+ "createdAt",+ "updatedAt"+ ]+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"}+ }+ }+ },+ "/auth/organization/delete": {+ "post": {+ "tags": [+ "Organization Management"],+ "operationId": "deleteOrganization",+ "summary": "Delete Organization",+ "description": "Delete an organization","requestBody": {"required": true,"content": {@@ -3741,29 +3778,64 @@"schema": {"type": "object","properties": {- "content": {+ "organizationId": {"type": "string",- "minLength": 1+ "description": "The organization id to delete"}},"required": [- "content"+ "organizationId"]}}}},- "summary": "Update Task Comment"- },- "delete": {- "operationId": "deleteTaskComment",+ "responses": {+ "200": {+ "description": "Success",+ "content": {+ "application/json": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/delete-role": {+ "post": {"tags": [- "Comments"+ "Organization Management"+ ],+ "operationId": "deleteOrganizationRole",+ "summary": "Delete Organization Role",+ "description": "Delete Organization Role",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/get-active-member": {+ "get": {+ "tags": [+ "Organization Management"],- "description": "Delete a comment (author only)",+ "operationId": "getOrganizationActiveMember",+ "summary": "Get Organization Active Member",+ "description": "Get the member details of the active organization","responses": {"200": {- "description": "Comment deleted successfully",+ "description": "Success","content": {"application/json": {"schema": {@@ -3772,157 +3844,97 @@"id": {"type": "string"},- "taskId": {- "type": "string"- },"userId": {"type": "string"},- "content": {+ "organizationId": {"type": "string"},- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- },- "user": {- "type": "object",- "properties": {- "name": {- "type": "string"- },- "image": {- "type": "string",- "nullable": true- }- },- "required": [- "name",- "image"- ]+ "role": {+ "type": "string"}},"required": ["id",- "taskId","userId",- "content",- "createdAt",- "updatedAt"+ "organizationId",+ "role"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }+ }+ }+ },+ "/auth/organization/get-active-member-role": {+ "get": {+ "tags": [+ "Organization Management"],- "summary": "Delete Task Comment"+ "operationId": "getOrganizationActiveMemberRole",+ "summary": "Get Organization Active Member Role",+ "description": "Get Organization Active Member Role",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }}},- "/time-entry/task/{taskId}": {+ "/auth/organization/get-full-organization": {"get": {- "operationId": "getTaskTimeEntries","tags": [- "Time Entries"+ "Organization Management"],- "description": "Get all time entries for a specific task",+ "operationId": "getOrganizationFullOrganization",+ "summary": "Get Organization Full Organization",+ "description": "Get the full organization","responses": {"200": {- "description": "List of time entries for the task",+ "description": "Success","content": {"application/json": {"schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "userId": {- "type": "string",- "nullable": true- },- "description": {- "type": "string",- "nullable": true- },- "startTime": {- "type": "string",- "format": "date-time"- },- "endTime": {- "type": "string",- "format": "date-time"- },- "duration": {- "type": "number",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "taskId",- "userId",- "description",- "startTime",- "duration",- "createdAt",- "updatedAt"- ]- }+ "type": "object",+ "additionalProperties": {}}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/get-invitation": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "getOrganizationInvitation",+ "summary": "Get Organization Invitation",+ "description": "Get an invitation by ID","parameters": [{- "in": "path",- "name": "taskId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "query"}],- "summary": "Get Task Time Entries"- }- },- "/time-entry/{id}": {- "get": {- "operationId": "getTimeEntry",- "tags": [- "Time Entries"- ],- "description": "Get a specific time entry by ID","responses": {"200": {- "description": "Time entry details",+ "description": "Success","content": {"application/json": {"schema": {@@ -3931,139 +3943,143 @@"id": {"type": "string"},- "taskId": {+ "email": {"type": "string"},- "userId": {- "type": "string",- "nullable": true+ "role": {+ "type": "string"},- "description": {- "type": "string",- "nullable": true+ "organizationId": {+ "type": "string"},- "startTime": {- "type": "string",- "format": "date-time"+ "inviterId": {+ "type": "string"},- "endTime": {- "type": "string",- "format": "date-time"+ "status": {+ "type": "string"},- "duration": {- "type": "number",- "nullable": true+ "expiresAt": {+ "type": "string"},- "createdAt": {- "type": "string",- "format": "date-time"+ "organizationName": {+ "type": "string"},- "updatedAt": {- "type": "string",- "format": "date-time"+ "organizationSlug": {+ "type": "string"+ },+ "inviterEmail": {+ "type": "string"}},"required": ["id",- "taskId",- "userId",- "description",- "startTime",- "duration",- "createdAt",- "updatedAt"+ "email",+ "role",+ "organizationId",+ "inviterId",+ "status",+ "expiresAt",+ "organizationName",+ "organizationSlug",+ "inviterEmail"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/get-role": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "getOrganizationRole",+ "summary": "Get Organization Role",+ "description": "Get Organization Role",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/has-permission": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "hasOrganizationPermission",+ "summary": "Has Organization Permission",+ "description": "Check if the user has permission",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "permission": {+ "type": "object",+ "additionalProperties": {},+ "description": "The permission to check"+ },+ "permissions": {+ "type": "object",+ "additionalProperties": {},+ "description": "The permission to check"+ }+ },+ "required": [+ "permissions"+ ]+ }+ }}},- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Time Entry"- },- "put": {- "operationId": "updateTimeEntry",- "tags": [- "Time Entries"- ],- "description": "Update an existing time entry","responses": {"200": {- "description": "Time entry updated successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {- "id": {- "type": "string"- },- "taskId": {+ "error": {"type": "string"},- "userId": {- "type": "string",- "nullable": true- },- "description": {- "type": "string",- "nullable": true- },- "startTime": {- "type": "string",- "format": "date-time"- },- "endTime": {- "type": "string",- "format": "date-time"- },- "duration": {- "type": "number",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"+ "success": {+ "type": "boolean"}},"required": [- "id",- "taskId",- "userId",- "description",- "startTime",- "duration",- "createdAt",- "updatedAt"+ "success"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }+ }+ }+ },+ "/auth/organization/invite-member": {+ "post": {+ "tags": [+ "Organization Management"],+ "operationId": "inviteOrganizationMember",+ "summary": "Invite Organization Member",+ "description": "Create an invitation to an organization","requestBody": {"required": true,"content": {@@ -4071,36 +4087,44 @@"schema": {"type": "object","properties": {- "startTime": {- "type": "string"+ "email": {+ "type": "string",+ "description": "The email address of the user to invite"},- "endTime": {- "type": "string"+ "role": {+ "type": "string",+ "description": "The role(s) to assign to the user. It can be `admin`, `member`, owner. Eg: \"member\""},- "description": {+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization ID to invite the user to"+ },+ "resend": {+ "type": [+ "boolean",+ "null"+ ],+ "description": "Resend the invitation email, if the user is already invited. Eg: true"+ },+ "teamId": {"type": "string"}},"required": [- "startTime"+ "email",+ "role",+ "teamId"]}}}},- "summary": "Update Time Entry"- }- },- "/time-entry": {- "post": {- "operationId": "createTimeEntry",- "tags": [- "Time Entries"- ],- "description": "Create a new time entry for a task","responses": {"200": {- "description": "Time entry created successfully",+ "description": "Success","content": {"application/json": {"schema": {@@ -4109,53 +4133,56 @@"id": {"type": "string"},- "taskId": {+ "email": {"type": "string"},- "userId": {- "type": "string",- "nullable": true+ "role": {+ "type": "string"},- "description": {- "type": "string",- "nullable": true+ "organizationId": {+ "type": "string"},- "startTime": {- "type": "string",- "format": "date-time"+ "inviterId": {+ "type": "string"},- "endTime": {- "type": "string",- "format": "date-time"+ "status": {+ "type": "string"},- "duration": {- "type": "number",- "nullable": true+ "expiresAt": {+ "type": "string"},"createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"+ "type": "string"}},"required": ["id",- "taskId",- "userId",- "description",- "startTime",- "duration",- "createdAt",- "updatedAt"+ "email",+ "role",+ "organizationId",+ "inviterId",+ "status",+ "expiresAt",+ "createdAt"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/leave": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "leaveOrganization",+ "summary": "Leave Organization",+ "description": "Leave Organization","requestBody": {"required": true,"content": {@@ -4163,40 +4190,171 @@"schema": {"type": "object","properties": {- "taskId": {- "type": "string"- },- "startTime": {- "type": "string"- },- "endTime": {- "type": "string"- },- "description": {- "type": "string"+ "organizationId": {+ "type": "string",+ "description": "The organization Id for the member to leave. Eg: \"organization-id\""+ }+ },+ "required": [+ "organizationId"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/list": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "listOrganization",+ "summary": "List Organization",+ "description": "List all organizations",+ "responses": {+ "200": {+ "description": "Success",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {}+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/list-invitations": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "listOrganizationInvitations",+ "summary": "List Organization Invitations",+ "description": "List Organization Invitations",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/list-members": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "listOrganizationMembers",+ "summary": "List Organization Members",+ "description": "List Organization Members",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/list-roles": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "listOrganizationRoles",+ "summary": "List Organization Roles",+ "description": "List Organization Roles",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/list-team-members": {+ "get": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "listOrganizationTeamMembers",+ "summary": "List Organization Team Members",+ "description": "List the members of the given team.",+ "responses": {+ "200": {+ "description": "Success",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Unique identifier of the team member"+ },+ "userId": {+ "type": "string",+ "description": "The user ID of the team member"+ },+ "teamId": {+ "type": "string",+ "description": "The team ID of the team the team member is in"+ },+ "createdAt": {+ "type": "string",+ "description": "Timestamp when the team member was created"+ }+ },+ "required": [+ "id",+ "userId",+ "teamId",+ "createdAt"+ ]}- },- "required": [- "taskId",- "startTime"- ]+ }}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "summary": "Create Time Entry"+ }}},- "/label/task/{taskId}": {+ "/auth/organization/list-teams": {"get": {- "operationId": "getTaskLabels","tags": [- "Labels"+ "Organization Management"],- "description": "Get all labels assigned to a specific task",+ "operationId": "listOrganizationTeams",+ "summary": "List Organization Teams",+ "description": "List all teams in an organization","responses": {"200": {- "description": "List of labels for the task",+ "description": "Success","content": {"application/json": {"schema": {@@ -4205,64 +4363,55 @@"type": "object","properties": {"id": {- "type": "string"+ "type": "string",+ "description": "Unique identifier of the team"},"name": {- "type": "string"- },- "color": {- "type": "string"+ "type": "string",+ "description": "Name of the team"},- "createdAt": {+ "organizationId": {"type": "string",- "format": "date-time"+ "description": "ID of the organization the team belongs to"},- "taskId": {+ "createdAt": {"type": "string",- "nullable": true+ "description": "Timestamp when the team was created"},- "workspaceId": {+ "updatedAt": {"type": "string",- "nullable": true+ "description": "Timestamp when the team was last updated"}},"required": ["id","name",- "color",+ "organizationId","createdAt",- "taskId",- "workspaceId"+ "updatedAt"]}}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "taskId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Task Labels"+ }}},- "/label/workspace/{workspaceId}": {+ "/auth/organization/list-user-invitations": {"get": {- "operationId": "getWorkspaceLabels","tags": [- "Labels"+ "Organization Management"],- "description": "Get all labels for a specific workspace",+ "operationId": "listOrganizationUserInvitations",+ "summary": "List Organization User Invitations",+ "description": "List all invitations a user has received","responses": {"200": {- "description": "List of labels in the workspace",+ "description": "Success","content": {"application/json": {"schema": {@@ -4273,102 +4422,234 @@"id": {"type": "string"},- "name": {+ "email": {"type": "string"},- "color": {+ "role": {"type": "string"},- "createdAt": {- "type": "string",- "format": "date-time"+ "organizationId": {+ "type": "string"},- "taskId": {- "type": "string",- "nullable": true+ "organizationName": {+ "type": "string"},- "workspaceId": {+ "inviterId": {"type": "string",- "nullable": true+ "description": "The ID of the user who created the invitation"+ },+ "teamId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The ID of the team associated with the invitation"+ },+ "status": {+ "type": "string"+ },+ "expiresAt": {+ "type": "string"+ },+ "createdAt": {+ "type": "string"}},"required": ["id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"+ "email",+ "role",+ "organizationId",+ "organizationName",+ "inviterId",+ "status",+ "expiresAt",+ "createdAt"]}}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "workspaceId",- "schema": {- "type": "string"- },- "required": true- }+ }+ }+ },+ "/auth/organization/list-user-teams": {+ "get": {+ "tags": [+ "Organization Management"],- "summary": "Get Workspace Labels"+ "operationId": "listOrganizationUserTeams",+ "summary": "List Organization User Teams",+ "description": "List all teams that the current user is a part of.",+ "responses": {+ "200": {+ "description": "Success",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "type": "object",+ "additionalProperties": {}+ }+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }}},- "/label": {+ "/auth/organization/reject-invitation": {"post": {- "operationId": "createLabel","tags": [- "Labels"+ "Organization Management"],- "description": "Create a new label in a workspace",+ "operationId": "rejectOrganizationInvitation",+ "summary": "Reject Organization Invitation",+ "description": "Reject an invitation to an organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "invitationId": {+ "type": "string",+ "description": "The ID of the invitation to reject"+ }+ },+ "required": [+ "invitationId"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Label created successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "taskId": {- "type": "string",- "nullable": true+ "invitation": {+ "type": "object",+ "additionalProperties": {}},- "workspaceId": {- "type": "string",- "nullable": true+ "member": {+ "type": [+ "object",+ "null"+ ],+ "additionalProperties": {}+ }+ }+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/remove-member": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "removeOrganizationMember",+ "summary": "Remove Organization Member",+ "description": "Remove a member from an organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "memberIdOrEmail": {+ "type": "string",+ "description": "The ID or email of the member to remove"+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The ID of the organization to remove the member from. If not provided, the active organization will be used. Eg: \"org-id\""+ }+ },+ "required": [+ "memberIdOrEmail"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Success",+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "member": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "userId": {+ "type": "string"+ },+ "organizationId": {+ "type": "string"+ },+ "role": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "userId",+ "organizationId",+ "role"+ ]}},"required": [- "id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"+ "member"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/remove-team": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "removeOrganizationTeam",+ "summary": "Remove Organization Team",+ "description": "Remove a team from an organization","requestBody": {"required": true,"content": {@@ -4376,152 +4657,62 @@"schema": {"type": "object","properties": {- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "workspaceId": {- "type": "string"+ "teamId": {+ "type": "string",+ "description": "The team ID of the team to remove. Eg: \"team-id\""},- "taskId": {- "type": "string"+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization ID which the team falls under. If not provided, it will default to the user's active organization. Eg: \"organization-id\""}},"required": [- "name",- "color",- "workspaceId"+ "teamId"]}}}},- "summary": "Create Label"- }- },- "/label/{id}": {- "get": {- "operationId": "getLabel",- "tags": [- "Labels"- ],- "description": "Get a specific label by ID","responses": {"200": {- "description": "Label details",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "taskId": {- "type": "string",- "nullable": true- },- "workspaceId": {+ "message": {"type": "string",- "nullable": true+ "enum": [+ "Team removed successfully."+ ],+ "description": "Confirmation message indicating successful removal"}},"required": [- "id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"+ "message"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Label"- },- "put": {- "operationId": "updateLabel",+ }+ }+ },+ "/auth/organization/remove-team-member": {+ "post": {"tags": [- "Labels"- ],- "description": "Update an existing label",- "responses": {- "200": {- "description": "Label updated successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "taskId": {- "type": "string",- "nullable": true- },- "workspaceId": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"- ]- }- }- }- }- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }+ "Organization Management"],+ "operationId": "removeOrganizationTeamMember",+ "summary": "Remove Organization Team Member",+ "description": "Remove a member from a team","requestBody": {"required": true,"content": {@@ -4529,145 +4720,118 @@"schema": {"type": "object","properties": {- "name": {- "type": "string"+ "teamId": {+ "type": "string",+ "description": "The team the user should be removed from."},- "color": {- "type": "string"+ "userId": {+ "type": "string",+ "description": "The user which should be removed from the team."+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization ID which the team falls under. If not provided, it will default to the user's active organization."}},"required": [- "name",- "color"+ "teamId",+ "userId"]}}}},- "summary": "Update Label"- },- "delete": {- "operationId": "deleteLabel",- "tags": [- "Labels"- ],- "description": "Delete a label by ID","responses": {"200": {- "description": "Label deleted successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "taskId": {- "type": "string",- "nullable": true- },- "workspaceId": {+ "message": {"type": "string",- "nullable": true+ "enum": [+ "Team member removed successfully."+ ],+ "description": "Confirmation message indicating successful removal"}},"required": [- "id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"+ "message"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Delete Label"+ }}},- "/label/{id}/task": {- "put": {- "operationId": "attachLabelToTask",+ "/auth/organization/set-active": {+ "post": {"tags": [- "Labels"+ "Organization Management"],- "description": "Attach an existing label to a task",+ "operationId": "setOrganizationActive",+ "summary": "Set Organization Active",+ "description": "Set the active organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "organizationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "organizationSlug": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization slug to set as active. It can be null to unset the active organization if organizationId is not provided. Eg: \"org-slug\""+ }+ }+ }+ }+ }+ },"responses": {"200": {- "description": "Label attached to task successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object",- "properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "taskId": {- "type": "string",- "nullable": true- },- "workspaceId": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"- ]+ "additionalProperties": {}}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }+ }+ }+ },+ "/auth/organization/set-active-team": {+ "post": {+ "tags": [+ "Organization Management"],+ "operationId": "setOrganizationActiveTeam",+ "summary": "Set Organization Active Team",+ "description": "Set the active team for the current active organization","requestBody": {"required": true,"content": {@@ -4675,255 +4839,232 @@"schema": {"type": "object","properties": {- "taskId": {- "type": "string"+ "teamId": {+ "type": [+ "string",+ "null"+ ]}- },- "required": [- "taskId"- ]+ }}}}},- "summary": "Attach Label To Task"- },- "delete": {- "operationId": "detachLabelFromTask",- "tags": [- "Labels"- ],- "description": "Detach a label from its current task","responses": {"200": {- "description": "Label detached from task successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object",- "properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "color": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "taskId": {- "type": "string",- "nullable": true- },- "workspaceId": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "name",- "color",- "createdAt",- "taskId",- "workspaceId"- ]+ "additionalProperties": {}}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Detach Label From Task"+ }}},- "/notification": {- "get": {- "operationId": "listNotifications",+ "/auth/organization/update": {+ "post": {"tags": [- "Notifications"+ "Organization Management"],- "description": "Get all notifications for the current user",- "responses": {- "200": {- "description": "List of notifications",- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {+ "operationId": "updateOrganization",+ "summary": "Update Organization",+ "description": "Update an organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "data": {"type": "object","properties": {- "id": {- "type": "string"- },- "userId": {- "type": "string"- },- "title": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true+ "description": {+ "type": [+ "string",+ "null"+ ]},- "type": {- "enum": [- "info",- "task_created",- "workspace_created",- "task_status_changed",- "task_assignee_changed",- "time_entry_created",- "due_date_reminder",- "task_overdue",- "task_mention"+ "name": {+ "type": [+ "string",+ "null"],- "type": "string"- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true+ "description": "The name of the organization"},- "isRead": {- "type": "boolean"- },- "resourceId": {- "type": "string"- },- "resourceType": {- "enum": [- "task",- "workspace"+ "slug": {+ "type": [+ "string",+ "null"],- "type": "string"+ "description": "The slug of the organization"},- "createdAt": {- "type": "string",- "format": "date-time"+ "logo": {+ "type": [+ "string",+ "null"+ ],+ "description": "The logo of the organization"},- "updatedAt": {- "type": "string",- "format": "date-time"+ "metadata": {+ "type": [+ "string",+ "null"+ ],+ "description": "The metadata of the organization"}- },- "required": [- "id",- "userId",- "title",- "content",- "type",- "eventData",- "createdAt",- "updatedAt"- ]+ }+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "The organization ID. Eg: \"org-id\""}- }+ },+ "required": [+ "data"+ ]}}}},- "summary": "List Notifications"- },+ "responses": {+ "200": {+ "description": "Success",+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "additionalProperties": {}+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/update-member-role": {"post": {- "operationId": "createNotification","tags": [- "Notifications"+ "Organization Management"],- "description": "Create a new notification for a user",+ "operationId": "updateOrganizationMemberRole",+ "summary": "Update Organization Member Role",+ "description": "Update the role of a member in an organization",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "role": {+ "type": "string",+ "description": "The new role to be applied. This can be a string or array of strings representing the roles. Eg: [\"admin\", \"sale\"]"+ },+ "memberId": {+ "type": "string",+ "description": "The member id to apply the role update to. Eg: \"member-id\""+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ],+ "description": "An optional organization ID which the member is a part of to apply the role update. If not provided, you must provide session headers to get the active organization. Eg: \"organization-id\""+ }+ },+ "required": [+ "role",+ "memberId"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Notification created successfully",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {- "id": {- "type": "string"- },- "userId": {- "type": "string"- },- "title": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "type": {- "enum": [- "info",- "task_created",- "workspace_created",- "task_status_changed",- "task_assignee_changed",- "time_entry_created",- "due_date_reminder",- "task_overdue",- "task_mention"- ],- "type": "string"- },- "eventData": {+ "member": {"type": "object",- "additionalProperties": true,- "nullable": true- },- "isRead": {- "type": "boolean"- },- "resourceId": {- "type": "string"- },- "resourceType": {- "enum": [- "task",- "workspace"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"+ "properties": {+ "id": {+ "type": "string"+ },+ "userId": {+ "type": "string"+ },+ "organizationId": {+ "type": "string"+ },+ "role": {+ "type": "string"+ }+ },+ "required": [+ "id",+ "userId",+ "organizationId",+ "role"+ ]}},"required": [- "id",- "userId",- "title",- "content",- "type",- "eventData",- "createdAt",- "updatedAt"+ "member"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/organization/update-role": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "updateOrganizationRole",+ "summary": "Update Organization Role",+ "description": "Update Organization Role",+ "responses": {+ "200": {+ "description": "Success"+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/auth/organization/update-team": {+ "post": {+ "tags": [+ "Organization Management"+ ],+ "operationId": "updateOrganizationTeam",+ "summary": "Update Organization Team",+ "description": "Update an existing team in an organization","requestBody": {"required": true,"content": {@@ -4931,966 +5072,588 @@"schema": {"type": "object","properties": {- "title": {- "type": "string",- "nullable": true- },- "message": {- "type": "string",- "nullable": true- },- "type": {- "type": "string"+ "teamId": {+ "type": "string",+ "description": "The ID of the team to be updated. Eg: \"team-id\""},- "eventData": {+ "data": {"type": "object",- "additionalProperties": true,- "nullable": true- },- "relatedEntityId": {- "type": "string"- },- "relatedEntityType": {- "type": "string"+ "properties": {+ "id": {+ "type": [+ "string",+ "null"+ ]+ },+ "name": {+ "type": [+ "string",+ "null"+ ]+ },+ "organizationId": {+ "type": [+ "string",+ "null"+ ]+ },+ "createdAt": {+ "type": [+ "string",+ "null"+ ]+ },+ "updatedAt": {+ "type": [+ "string",+ "null"+ ]+ }+ }}},"required": [- "type"+ "teamId",+ "data"]}}}},- "summary": "Create Notification"- }- },- "/notification/{id}/read": {- "patch": {- "operationId": "markNotificationAsRead",- "tags": [- "Notifications"- ],- "description": "Mark a specific notification as read","responses": {"200": {- "description": "Notification marked as read",+ "description": "Success","content": {"application/json": {"schema": {"type": "object","properties": {"id": {- "type": "string"- },- "userId": {- "type": "string"- },- "title": {"type": "string",- "nullable": true+ "description": "Unique identifier of the updated team"},- "content": {+ "name": {"type": "string",- "nullable": true- },- "type": {- "enum": [- "info",- "task_created",- "workspace_created",- "task_status_changed",- "task_assignee_changed",- "time_entry_created",- "due_date_reminder",- "task_overdue",- "task_mention"- ],- "type": "string"- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "isRead": {- "type": "boolean"- },- "resourceId": {- "type": "string"+ "description": "Updated name of the team"},- "resourceType": {- "enum": [- "task",- "workspace"- ],- "type": "string"+ "organizationId": {+ "type": "string",+ "description": "ID of the organization the team belongs to"},"createdAt": {"type": "string",- "format": "date-time"+ "description": "Timestamp when the team was created"},"updatedAt": {"type": "string",- "format": "date-time"+ "description": "Timestamp when the team was last updated"}},"required": ["id",- "userId",- "title",- "content",- "type",- "eventData",+ "name",+ "organizationId","createdAt","updatedAt"]}}}+ },+ "401": {+ "description": "Missing or invalid credentials"}- },+ }+ }+ },+ "/auth/device": {+ "get": {+ "operationId": "getDeviceAuthorizationPage",+ "tags": [+ "Authentication"+ ],+ "summary": "Device authorization page",+ "description": "Better Auth serves this as JSON. A top-level browser navigation is redirected to the web app's device screen instead, so opening the URL by hand shows a page rather than a JSON blob.",+ "security": [],"parameters": [{- "in": "path",- "name": "id","schema": {- "type": "string"+ "type": "string",+ "description": "The device authorization user code."+ },+ "required": false,+ "description": "The device authorization user code.",+ "name": "user_code",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "enum": [+ "1"+ ],+ "description": "Force a redirect to the web UI, for clients that do not send Sec-Fetch-* headers."},- "required": true+ "required": false,+ "description": "Force a redirect to the web UI, for clients that do not send Sec-Fetch-* headers.",+ "name": "ui",+ "in": "query"}],- "summary": "Mark Notification As Read"+ "responses": {+ "200": {+ "description": "Device authorization payload from Better Auth"+ },+ "302": {+ "description": "Redirects the browser to the web app device screen"+ }+ }}},- "/notification/read-all": {- "patch": {- "operationId": "markAllNotificationsAsRead",+ "/mcp/register": {+ "post": {+ "operationId": "registerMcpOAuthClient","tags": [- "Notifications"+ "MCP"],- "description": "Mark all notifications as read for the current user",- "responses": {- "200": {- "description": "All notifications marked as read",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"+ "summary": "Register MCP OAuth client",+ "description": "Dynamically register a public OAuth client for the MCP endpoint. Public clients hold no secret, so authorization is protected by PKCE and an explicit consent step.",+ "security": [],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "redirect_uris": {+ "type": "array",+ "items": {+ "type": "string",+ "maxLength": 2048},- "count": {- "type": "number"- }+ "minItems": 1},- "required": [- "success"- ]- }+ "client_name": {+ "type": "string",+ "maxLength": 100+ },+ "token_endpoint_auth_method": {+ "type": "string",+ "enum": [+ "none"+ ]+ },+ "grant_types": {+ "type": "array",+ "prefixItems": [+ {+ "type": "string",+ "enum": [+ "authorization_code"+ ]+ }+ ]+ },+ "response_types": {+ "type": "array",+ "prefixItems": [+ {+ "type": "string",+ "enum": [+ "code"+ ]+ }+ ]+ }+ },+ "required": [+ "redirect_uris"+ ]}}}},- "summary": "Mark All Notifications As Read"- }- },- "/notification/clear-all": {- "delete": {- "operationId": "clearAllNotifications",- "tags": [- "Notifications"- ],- "description": "Clear all notifications for the current user","responses": {"200": {- "description": "All notifications cleared",+ "description": "Registered OAuth client","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- },- "count": {- "type": "number"- }- },- "required": [- "success"- ]+ "$ref": "#/components/schemas/McpClientRegistration"+ }+ }+ }+ },+ "400": {+ "description": "Invalid client metadata",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthError"}}}}- },- "summary": "Clear All Notifications"+ }}},- "/notification-preferences": {+ "/mcp/authorize": {"get": {- "operationId": "getNotificationPreferences",+ "operationId": "authorizeMcpOAuthClient","tags": [- "Notification Preferences"+ "MCP"],- "description": "Get notification delivery preferences for the current user",- "responses": {- "200": {- "description": "Notification preferences",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "emailAddress": {- "type": "string",- "nullable": true- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "ntfyConfigured": {- "type": "boolean"- },- "ntfyServerUrl": {- "type": "string",- "nullable": true- },- "ntfyTopic": {- "type": "string",- "nullable": true- },- "ntfyTokenConfigured": {- "type": "boolean"- },- "maskedNtfyToken": {- "type": "string",- "nullable": true- },- "gotifyEnabled": {- "type": "boolean"- },- "gotifyConfigured": {- "type": "boolean"- },- "gotifyServerUrl": {- "type": "string",- "nullable": true- },- "gotifyTokenConfigured": {- "type": "boolean"- },- "maskedGotifyToken": {- "type": "string",- "nullable": true- },- "webhookEnabled": {- "type": "boolean"- },- "webhookConfigured": {- "type": "boolean"- },- "webhookUrl": {- "type": "string",- "nullable": true- },- "webhookSecretConfigured": {- "type": "boolean"- },- "maskedWebhookSecret": {- "type": "string",- "nullable": true- },- "workspaces": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "workspaceName": {- "type": "string"- },- "isActive": {- "type": "boolean"- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "gotifyEnabled": {- "type": "boolean"- },- "webhookEnabled": {- "type": "boolean"- },- "projectMode": {- "enum": [- "all",- "selected"- ],- "type": "string"- },- "selectedProjectIds": {- "type": "array",- "items": {- "type": "string"- }- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "workspaceId",- "workspaceName",- "isActive",- "emailEnabled",- "ntfyEnabled",- "gotifyEnabled",- "webhookEnabled",- "projectMode",- "selectedProjectIds",- "createdAt",- "updatedAt"- ]- }- },- "createdAt": {- "nullable": true- },- "updatedAt": {- "nullable": true- }- },- "required": [- "emailAddress",- "emailEnabled",- "ntfyEnabled",- "ntfyConfigured",- "ntfyServerUrl",- "ntfyTopic",- "ntfyTokenConfigured",- "maskedNtfyToken",- "gotifyEnabled",- "gotifyConfigured",- "gotifyServerUrl",- "gotifyTokenConfigured",- "maskedGotifyToken",- "webhookEnabled",- "webhookConfigured",- "webhookUrl",- "webhookSecretConfigured",- "maskedWebhookSecret",- "workspaces",- "createdAt",- "updatedAt"- ]+ "summary": "Start MCP authorization",+ "description": "Begin an MCP OAuth authorization. Redirects the browser to the Kaneo consent page, which then approves or denies the request.",+ "security": [],+ "parameters": [+ {+ "schema": {+ "type": "string",+ "enum": [+ "code"+ ]+ },+ "required": true,+ "name": "response_type",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "client_id",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "maxLength": 2048+ },+ "required": true,+ "name": "redirect_uri",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "description": "PKCE challenge; only S256 is accepted."+ },+ "required": true,+ "description": "PKCE challenge; only S256 is accepted.",+ "name": "code_challenge",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "enum": [+ "S256"+ ]+ },+ "required": true,+ "name": "code_challenge_method",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "state",+ "in": "query"+ }+ ],+ "responses": {+ "302": {+ "description": "Redirect to the Kaneo consent page"+ },+ "400": {+ "description": "Invalid authorization request",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthError"}}}- },- "400": {- "description": "Validation error",+ }+ }+ }+ },+ "/mcp/authorize/request/{requestId}": {+ "get": {+ "operationId": "getMcpAuthorizationRequest",+ "tags": [+ "MCP"+ ],+ "summary": "Get consent request",+ "description": "Get the client name and redirect URI for a pending consent request, so the consent page can show who is asking.",+ "security": [],+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "requestId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Authorization request details","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/McpAuthorizationRequest"}}}},- "401": {- "description": "Unauthorized",+ "400": {+ "description": "Invalid OAuth client","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/OAuthError"}}}},- "403": {- "description": "Forbidden",+ "404": {+ "description": "Unknown or expired authorization request","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/OAuthError"}}}}- },- "summary": "Get Notification Preferences"+ }},- "put": {- "operationId": "updateNotificationPreferences",+ "post": {+ "operationId": "decideMcpAuthorizationRequest","tags": [- "Notification Preferences"+ "MCP"+ ],+ "summary": "Decide consent request",+ "description": "Approve or deny a pending consent request and get the URL to send the browser back to.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "requestId",+ "in": "path"+ }],- "description": "Update global notification delivery preferences",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "approved": {+ "type": "boolean"+ }+ },+ "required": [+ "approved"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Updated notification preferences",+ "description": "OAuth client redirect","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "emailAddress": {- "type": "string",- "nullable": true- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "ntfyConfigured": {- "type": "boolean"- },- "ntfyServerUrl": {- "type": "string",- "nullable": true- },- "ntfyTopic": {- "type": "string",- "nullable": true- },- "ntfyTokenConfigured": {- "type": "boolean"- },- "maskedNtfyToken": {- "type": "string",- "nullable": true- },- "gotifyEnabled": {- "type": "boolean"- },- "gotifyConfigured": {- "type": "boolean"- },- "gotifyServerUrl": {- "type": "string",- "nullable": true- },- "gotifyTokenConfigured": {- "type": "boolean"- },- "maskedGotifyToken": {- "type": "string",- "nullable": true- },- "webhookEnabled": {- "type": "boolean"- },- "webhookConfigured": {- "type": "boolean"- },- "webhookUrl": {- "type": "string",- "nullable": true- },- "webhookSecretConfigured": {- "type": "boolean"- },- "maskedWebhookSecret": {- "type": "string",- "nullable": true- },- "workspaces": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "workspaceName": {- "type": "string"- },- "isActive": {- "type": "boolean"- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "gotifyEnabled": {- "type": "boolean"- },- "webhookEnabled": {- "type": "boolean"- },- "projectMode": {- "enum": [- "all",- "selected"- ],- "type": "string"- },- "selectedProjectIds": {- "type": "array",- "items": {- "type": "string"- }- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "workspaceId",- "workspaceName",- "isActive",- "emailEnabled",- "ntfyEnabled",- "gotifyEnabled",- "webhookEnabled",- "projectMode",- "selectedProjectIds",- "createdAt",- "updatedAt"- ]- }- },- "createdAt": {- "nullable": true- },- "updatedAt": {- "nullable": true- }- },- "required": [- "emailAddress",- "emailEnabled",- "ntfyEnabled",- "ntfyConfigured",- "ntfyServerUrl",- "ntfyTopic",- "ntfyTokenConfigured",- "maskedNtfyToken",- "gotifyEnabled",- "gotifyConfigured",- "gotifyServerUrl",- "gotifyTokenConfigured",- "maskedGotifyToken",- "webhookEnabled",- "webhookConfigured",- "webhookUrl",- "webhookSecretConfigured",- "maskedWebhookSecret",- "workspaces",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/McpAuthorizationDecision"}}}},"400": {- "description": "Validation error",+ "description": "Invalid request or OAuth client","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/OAuthError"}}}},"401": {- "description": "Unauthorized",+ "description": "Authentication required","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/OAuthError"}}}},"403": {- "description": "Forbidden",+ "description": "Untrusted request origin","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/OAuthError"}}}- }- },- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "ntfyServerUrl": {- "type": "string",- "nullable": true- },- "ntfyTopic": {- "type": "string",- "nullable": true- },- "ntfyToken": {- "type": "string",- "nullable": true- },- "gotifyEnabled": {- "type": "boolean"- },- "gotifyServerUrl": {- "type": "string",- "nullable": true- },- "gotifyToken": {- "type": "string",- "nullable": true- },- "webhookEnabled": {- "type": "boolean"- },- "webhookUrl": {- "type": "string",- "nullable": true- },- "webhookSecret": {- "type": "string",- "nullable": true- }+ },+ "404": {+ "description": "Unknown or expired authorization request",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthError"}}}}- },- "summary": "Update Notification Preferences"+ }}},- "/notification-preferences/workspaces/{workspaceId}": {- "put": {- "operationId": "upsertNotificationPreferenceWorkspaceRule",+ "/oauth/id-token": {+ "get": {+ "operationId": "getOAuthIdToken",+ "tags": [+ "Authentication"+ ],+ "summary": "Get OAuth id token",+ "description": "Get the id_token for the current user's custom OAuth account. Returns null when the user signed in another way.",+ "responses": {+ "200": {+ "description": "The id_token if available",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthIdToken"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/billing/webhook": {+ "post": {+ "operationId": "handleBillingWebhook","tags": [- "Notification Preferences"+ "Billing"],- "description": "Create or update a workspace notification rule",+ "summary": "Billing webhook",+ "description": "Receive a Creem subscription event. Authenticated by signature, not by session, and idempotent per event id.",+ "security": [],"responses": {"200": {- "description": "Updated notification preferences",+ "description": "The event was accepted","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "emailAddress": {- "type": "string",- "nullable": true- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "ntfyConfigured": {- "type": "boolean"- },- "ntfyServerUrl": {- "type": "string",- "nullable": true- },- "ntfyTopic": {- "type": "string",- "nullable": true- },- "ntfyTokenConfigured": {- "type": "boolean"- },- "maskedNtfyToken": {- "type": "string",- "nullable": true- },- "gotifyEnabled": {- "type": "boolean"- },- "gotifyConfigured": {- "type": "boolean"- },- "gotifyServerUrl": {- "type": "string",- "nullable": true- },- "gotifyTokenConfigured": {- "type": "boolean"- },- "maskedGotifyToken": {- "type": "string",- "nullable": true- },- "webhookEnabled": {- "type": "boolean"- },- "webhookConfigured": {- "type": "boolean"- },- "webhookUrl": {- "type": "string",- "nullable": true- },- "webhookSecretConfigured": {- "type": "boolean"- },- "maskedWebhookSecret": {- "type": "string",- "nullable": true- },- "workspaces": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "workspaceName": {- "type": "string"- },- "isActive": {- "type": "boolean"- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "gotifyEnabled": {- "type": "boolean"- },- "webhookEnabled": {- "type": "boolean"- },- "projectMode": {- "enum": [- "all",- "selected"- ],- "type": "string"- },- "selectedProjectIds": {- "type": "array",- "items": {- "type": "string"- }- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "workspaceId",- "workspaceName",- "isActive",- "emailEnabled",- "ntfyEnabled",- "gotifyEnabled",- "webhookEnabled",- "projectMode",- "selectedProjectIds",- "createdAt",- "updatedAt"- ]- }- },- "createdAt": {- "nullable": true- },- "updatedAt": {- "nullable": true- }- },- "required": [- "emailAddress",- "emailEnabled",- "ntfyEnabled",- "ntfyConfigured",- "ntfyServerUrl",- "ntfyTopic",- "ntfyTokenConfigured",- "maskedNtfyToken",- "gotifyEnabled",- "gotifyConfigured",- "gotifyServerUrl",- "gotifyTokenConfigured",- "maskedGotifyToken",- "webhookEnabled",- "webhookConfigured",- "webhookUrl",- "webhookSecretConfigured",- "maskedWebhookSecret",- "workspaces",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/BillingWebhookResult"}}}},"400": {- "description": "Validation error",+ "description": "Signature verification failed","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}}},- "401": {- "description": "Unauthorized",+ "404": {+ "description": "Billing is not enabled on this instance",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ }+ },+ "/billing/{workspaceId}": {+ "get": {+ "operationId": "getWorkspaceBilling",+ "tags": [+ "Billing"+ ],+ "summary": "Get workspace billing",+ "description": "Get the billing state and entitlement for a workspace. When the instance has no billing configured this reports billingEnabled: false and an always-active entitlement.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "workspaceId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Billing state for the workspace","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/WorkspaceBilling"}}}},+ "401": {+ "description": "Missing or invalid credentials"+ },"403": {- "description": "Forbidden",+ "description": "No access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}}}- },+ }+ }+ },+ "/billing/{workspaceId}/checkout": {+ "post": {+ "operationId": "createBillingCheckout",+ "tags": [+ "Billing"+ ],+ "summary": "Create checkout",+ "description": "Create a Creem checkout session for a workspace plan and return the URL to redirect the browser to. Workspace owners and admins only.","parameters": [{- "in": "path",- "name": "workspaceId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "workspaceId",+ "in": "path"}],"requestBody": {@@ -5900,829 +5663,195 @@"schema": {"type": "object","properties": {- "isActive": {- "type": "boolean"- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "gotifyEnabled": {- "type": "boolean"- },- "webhookEnabled": {- "type": "boolean"- },- "projectMode": {+ "plan": {+ "type": "string","enum": [- "all",- "selected"- ],- "type": "string"+ "personal",+ "team"+ ]},- "selectedProjectIds": {- "type": "array",- "items": {- "type": "string"- }+ "interval": {+ "type": "string",+ "enum": [+ "monthly",+ "annual"+ ]}},"required": [- "isActive",- "emailEnabled",- "ntfyEnabled",- "gotifyEnabled",- "webhookEnabled",- "projectMode"+ "plan",+ "interval"]}}}},- "summary": "Upsert Notification Preference Workspace Rule"- },- "delete": {- "operationId": "deleteNotificationPreferenceWorkspaceRule",- "tags": [- "Notification Preferences"- ],- "description": "Delete a workspace notification rule","responses": {"200": {- "description": "Updated notification preferences",+ "description": "The checkout session","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "emailAddress": {- "type": "string",- "nullable": true- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "ntfyConfigured": {- "type": "boolean"- },- "ntfyServerUrl": {- "type": "string",- "nullable": true- },- "ntfyTopic": {- "type": "string",- "nullable": true- },- "ntfyTokenConfigured": {- "type": "boolean"- },- "maskedNtfyToken": {- "type": "string",- "nullable": true- },- "gotifyEnabled": {- "type": "boolean"- },- "gotifyConfigured": {- "type": "boolean"- },- "gotifyServerUrl": {- "type": "string",- "nullable": true- },- "gotifyTokenConfigured": {- "type": "boolean"- },- "maskedGotifyToken": {- "type": "string",- "nullable": true- },- "webhookEnabled": {- "type": "boolean"- },- "webhookConfigured": {- "type": "boolean"- },- "webhookUrl": {- "type": "string",- "nullable": true- },- "webhookSecretConfigured": {- "type": "boolean"- },- "maskedWebhookSecret": {- "type": "string",- "nullable": true- },- "workspaces": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "workspaceName": {- "type": "string"- },- "isActive": {- "type": "boolean"- },- "emailEnabled": {- "type": "boolean"- },- "ntfyEnabled": {- "type": "boolean"- },- "gotifyEnabled": {- "type": "boolean"- },- "webhookEnabled": {- "type": "boolean"- },- "projectMode": {- "enum": [- "all",- "selected"- ],- "type": "string"- },- "selectedProjectIds": {- "type": "array",- "items": {- "type": "string"- }- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "workspaceId",- "workspaceName",- "isActive",- "emailEnabled",- "ntfyEnabled",- "gotifyEnabled",- "webhookEnabled",- "projectMode",- "selectedProjectIds",- "createdAt",- "updatedAt"- ]- }- },- "createdAt": {- "nullable": true- },- "updatedAt": {- "nullable": true- }- },- "required": [- "emailAddress",- "emailEnabled",- "ntfyEnabled",- "ntfyConfigured",- "ntfyServerUrl",- "ntfyTopic",- "ntfyTokenConfigured",- "maskedNtfyToken",- "gotifyEnabled",- "gotifyConfigured",- "gotifyServerUrl",- "gotifyTokenConfigured",- "maskedGotifyToken",- "webhookEnabled",- "webhookConfigured",- "webhookUrl",- "webhookSecretConfigured",- "maskedWebhookSecret",- "workspaces",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/BillingCheckout"}}}},"400": {- "description": "Validation error",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- }- },- "401": {- "description": "Unauthorized",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- }- },- "403": {- "description": "Forbidden",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "description": "Invalid plan or interval",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}},- "404": {- "description": "Workspace rule not found",+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "Not a workspace owner or admin","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}}}- },+ }+ }+ },+ "/billing/{workspaceId}/portal": {+ "post": {+ "operationId": "createBillingPortalSession",+ "tags": [+ "Billing"+ ],+ "summary": "Create portal session",+ "description": "Generate a Creem customer portal link for the workspace subscription. Workspace owners and admins only, and only once a billing customer exists.","parameters": [{- "in": "path",- "name": "workspaceId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "workspaceId",+ "in": "path"}],- "summary": "Delete Notification Preference Workspace Rule"- }- },- "/search": {- "get": {- "operationId": "globalSearch",- "tags": [- "Search"- ],- "description": "Search across tasks, projects, workspaces, comments, and activities","responses": {"200": {- "description": "Search results",+ "description": "The portal link","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "tasks": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "position": {- "type": "number",- "nullable": true- },- "number": {- "type": "number",- "nullable": true- },- "userId": {- "type": "string",- "nullable": true- },- "title": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "status": {- "type": "string"- },- "priority": {- "enum": [- "no-priority",- "low",- "medium",- "high",- "urgent"- ],- "type": "string"- },- "startDate": {- "type": "string",- "format": "date-time"- },- "dueDate": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "position",- "number",- "userId",- "title",- "description",- "status",- "priority",- "createdAt"- ]- }- },- "projects": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "slug": {- "type": "string"- },- "icon": {- "type": "string",- "nullable": true- },- "name": {- "type": "string"- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "isPublic": {- "type": "boolean",- "nullable": true- },- "archivedAt": {- "nullable": true- }- },- "required": [- "id",- "workspaceId",- "slug",- "icon",- "name",- "description",- "createdAt",- "isPublic",- "archivedAt"- ]- }- },- "workspaces": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "slug": {- "type": "string"- },- "logo": {- "type": "string",- "nullable": true- },- "metadata": {- "type": "string",- "nullable": true- },- "description": {- "type": "string",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "name",- "slug",- "logo",- "metadata",- "description",- "createdAt"- ]- }- },- "comments": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "userId": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true- },- "externalSource": {- "type": "string",- "nullable": true- },- "externalUrl": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "taskId",- "type",- "createdAt",- "userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"- ]- }- },- "activities": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "type": {- "enum": [- "comment",- "task",- "status_changed",- "priority_changed",- "unassigned",- "assignee_changed",- "due_date_changed",- "title_changed",- "description_changed",- "create"- ],- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "userId": {- "type": "string",- "nullable": true- },- "content": {- "type": "string",- "nullable": true- },- "eventData": {- "type": "object",- "additionalProperties": true,- "nullable": true- },- "externalUserName": {- "type": "string",- "nullable": true- },- "externalUserAvatar": {- "type": "string",- "nullable": true- },- "externalSource": {- "type": "string",- "nullable": true- },- "externalUrl": {- "type": "string",- "nullable": true- }- },- "required": [- "id",- "taskId",- "type",- "createdAt",- "userId",- "content",- "eventData",- "externalUserName",- "externalUserAvatar",- "externalSource",- "externalUrl"- ]- }- }- }+ "$ref": "#/components/schemas/BillingPortal"}}}- }- },- "parameters": [- {- "in": "query",- "name": "q",- "schema": {- "type": "string",- "minLength": 1- },- "required": true- },- {- "in": "query",- "name": "type",- "schema": {- "enum": [- "all",- "tasks",- "projects",- "workspaces",- "comments",- "activities"- ],- "default": "all",- "type": "string"- }- },- {- "in": "query",- "name": "workspaceId",- "schema": {- "type": "string"- }},- {- "in": "query",- "name": "projectId",- "schema": {- "type": "string"+ "400": {+ "description": "No billing customer exists for this workspace yet",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }}},- {- "in": "query",- "name": "limit",- "schema": {- "type": "integer",- "minimum": 1,- "maximum": 50,- "default": 20- }+ "401": {+ "description": "Missing or invalid credentials"},- {- "in": "query",- "name": "userEmail",- "schema": {- "type": "string",- "format": "email"- }- }- ],- "summary": "Global Search"- }- },- "/github-integration/app-info": {- "get": {- "operationId": "getGitHubAppInfo",- "tags": [- "GitHub"- ],- "description": "Get GitHub app configuration information",- "responses": {- "200": {- "description": "GitHub app information",+ "403": {+ "description": "Not a workspace owner or admin","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "appName": {- "type": "string",- "nullable": true- }- },- "required": [- "appName"- ]+ "type": "string"}}}}- },- "summary": "Get Git Hub App Info"+ }}},- "/github-integration/repositories": {+ "/project": {"get": {- "operationId": "listGitHubRepositories",+ "operationId": "listProjects","tags": [- "GitHub"+ "Projects"+ ],+ "summary": "List projects",+ "description": "List a workspace's projects in sidebar order, each with rollup task statistics. Archived projects are excluded unless includeArchived is set.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "workspaceId",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "description": "Pass \"true\" to include archived projects in the list."+ },+ "required": false,+ "description": "Pass \"true\" to include archived projects in the list.",+ "name": "includeArchived",+ "in": "query"+ }],- "description": "List all accessible GitHub repositories","responses": {"200": {- "description": "List of repositories",+ "description": "List of projects","content": {"application/json": {"schema": {"type": "array","items": {- "type": "object",- "properties": {- "id": {- "type": "number"- },- "name": {- "type": "string"- },- "full_name": {- "type": "string"- },- "owner": {- "type": "object",- "properties": {- "login": {- "type": "string"- }- },- "required": [- "login"- ]- },- "private": {- "type": "boolean"- },- "html_url": {- "type": "string"- }- },- "required": [- "id",- "name",- "full_name",- "owner",- "private",- "html_url"- ]+ "$ref": "#/components/schemas/ProjectListItem"}}}}- }- },- "summary": "List Git Hub Repositories"- }- },- "/github-integration/verify": {- "post": {- "operationId": "verifyGitHubInstallation",- "tags": [- "GitHub"- ],- "description": "Verify GitHub app installation for a repository",- "responses": {- "200": {- "description": "Verification result",+ },+ "400": {+ "description": "Workspace ID could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "installed": {- "type": "boolean"- },- "message": {- "type": "string"- }- },- "required": [- "installed"- ]+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ },+ "post": {+ "operationId": "createProject",+ "tags": [+ "Projects"+ ],+ "summary": "Create project",+ "description": "Create a project in a workspace. The slug becomes the prefix of its task identifiers.","requestBody": {"required": true,"content": {@@ -6730,175 +5859,135 @@"schema": {"type": "object","properties": {- "repositoryOwner": {- "type": "string",- "minLength": 1+ "name": {+ "type": "string"},- "repositoryName": {- "type": "string",- "minLength": 1+ "workspaceId": {+ "type": "string"+ },+ "icon": {+ "type": "string"+ },+ "slug": {+ "type": "string"}},"required": [- "repositoryOwner",- "repositoryName"+ "name",+ "workspaceId",+ "icon",+ "slug"]}}}},- "summary": "Verify Git Hub Installation"- }- },- "/github-integration/project/{projectId}": {- "get": {- "operationId": "getGitHubIntegration",- "tags": [- "GitHub"- ],- "description": "Get GitHub integration for a project","responses": {"200": {- "description": "GitHub integration details",+ "description": "The created project",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/Project"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or workspace ID could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:create permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "installationId": {- "type": "number",- "nullable": true- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGitHubIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "repositoryOwner",- "repositoryName",- "installationId",- "isActive",- "createdAt",- "updatedAt"- ]+ "type": "string"}}}}- },+ }+ }+ },+ "/project/{id}": {+ "get": {+ "operationId": "getProject",+ "tags": [+ "Projects"+ ],+ "summary": "Get project",+ "description": "Get a single project by ID.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Get Git Hub Integration"- },- "post": {- "operationId": "createGitHubIntegration",- "tags": [- "GitHub"- ],- "description": "Create a new GitHub integration for a project","responses": {"200": {- "description": "Integration created successfully",+ "description": "Project details","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "installationId": {- "type": "number",- "nullable": true- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGitHubIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "repositoryOwner",- "repositoryName",- "installationId",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Project"+ }+ }+ }+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ },+ "put": {+ "operationId": "updateProject",+ "tags": [+ "Projects"+ ],+ "summary": "Update project",+ "description": "Replace a project's name, icon, slug, description, and visibility.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -6908,251 +5997,141 @@"schema": {"type": "object","properties": {- "repositoryOwner": {- "type": "string",- "minLength": 1+ "name": {+ "type": "string"},- "repositoryName": {- "type": "string",- "minLength": 1+ "icon": {+ "type": "string"+ },+ "slug": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "isPublic": {+ "type": "boolean"}},"required": [- "repositoryOwner",- "repositoryName"+ "name",+ "icon",+ "slug",+ "description",+ "isPublic"]}}}},- "summary": "Create Git Hub Integration"- },- "patch": {- "operationId": "updateGitHubIntegration",- "tags": [- "GitHub"- ],- "description": "Update GitHub integration settings","responses": {"200": {- "description": "Integration updated successfully",+ "description": "The updated project","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "installationId": {- "type": "number",- "nullable": true- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGitHubIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "repositoryOwner",- "repositoryName",- "installationId",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Project"}}}},- "404": {- "description": "Integration not found",+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "error": {- "type": "string"- }- },- "required": [- "error"- ]+ "type": "string"}}}- }- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "isActive": {- "type": "boolean"- },- "commentTaskLinkOnGitHubIssue": {- "type": "boolean"- }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },- "summary": "Update Git Hub Integration"+ }},"delete": {- "operationId": "deleteGitHubIntegration",+ "operationId": "deleteProject","tags": [- "GitHub"+ "Projects"+ ],+ "summary": "Delete project",+ "description": "Permanently delete a project and everything in it. Archive it instead to keep the data.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"+ }],- "description": "Delete GitHub integration for a project","responses": {"200": {- "description": "Integration deleted successfully",+ "description": "The deleted project","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "installationId": {- "type": "number",- "nullable": true- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGitHubIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "repositoryOwner",- "repositoryName",- "installationId",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Project"+ }+ }+ }+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:delete permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/project/reorder": {+ "put": {+ "operationId": "reorderProjects",+ "tags": [+ "Projects"+ ],+ "summary": "Reorder projects",+ "description": "Set the sidebar order of a workspace's projects. The given positions express relative order only -- the workspace is renumbered to 0..n-1.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "workspaceId",+ "in": "query"}],- "summary": "Delete Git Hub Integration"- }- },- "/github-integration/import-issues": {- "post": {- "operationId": "importGitHubIssues",- "tags": [- "GitHub"- ],- "description": "Import GitHub issues as tasks",- "responses": {- "200": {- "description": "Issues imported successfully",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "imported": {- "type": "number"- },- "skipped": {- "type": "number"- },- "errors": {- "type": "array",- "items": {- "type": "string"- }- }- },- "required": [- "imported",- "skipped"- ]- }- }- }- }- },"requestBody": {"required": true,"content": {@@ -7160,371 +6139,331 @@"schema": {"type": "object","properties": {- "projectId": {- "type": "string"+ "projects": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "position": {+ "type": "integer",+ "minimum": 0+ }+ },+ "required": [+ "id",+ "position"+ ]+ },+ "minItems": 1}},"required": [- "projectId"+ "projects"]}}}},- "summary": "Import Git Hub Issues"- }- },- "/gitea-integration/repositories": {- "post": {- "operationId": "listGiteaRepositories",- "tags": [- "Gitea"- ],- "description": "List repositories accessible with a Gitea token","responses": {"200": {- "description": "Repositories",+ "description": "The reordered projects","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "repositories": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "number"- },- "name": {- "type": "string"- },- "full_name": {- "type": "string"- },- "owner": {- "type": "object",- "properties": {- "login": {- "type": "string"- }- },- "required": [- "login"- ]- },- "private": {- "type": "boolean"- },- "html_url": {- "type": "string"- }- },- "required": [- "id",- "name",- "full_name",- "owner",- "private",- "html_url"- ]- }- }- },- "required": [- "repositories"- ]+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Project"+ }}}}- }- },- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "baseUrl": {- "type": "string",- "minLength": 1- },- "accessToken": {- "type": "string",- "minLength": 1- }- },- "required": [- "baseUrl",- "accessToken"- ]+ },+ "400": {+ "description": "Invalid body, or workspace ID could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }}}}- },- "summary": "List Gitea Repositories"+ }}},- "/gitea-integration/verify": {- "post": {- "operationId": "verifyGiteaAccess",+ "/project/{id}/archive": {+ "put": {+ "operationId": "archiveProject","tags": [- "Gitea"+ "Projects"+ ],+ "summary": "Archive project",+ "description": "Hide a project from the default list without deleting it. Reversible with unarchive.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"+ }],- "description": "Verify Gitea token and repository access","responses": {"200": {- "description": "Verification result",+ "description": "The archived project","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "isInstalled": {- "type": "boolean"- },- "hasRequiredPermissions": {- "type": "boolean"- },- "repositoryExists": {- "type": "boolean"- },- "repositoryPrivate": {- "type": "boolean",- "nullable": true- },- "missingPermissions": {- "type": "array",- "items": {- "type": "string"- }- },- "message": {- "type": "string"- }- },- "required": [- "isInstalled",- "hasRequiredPermissions",- "repositoryExists",- "repositoryPrivate",- "missingPermissions",- "message"- ]+ "$ref": "#/components/schemas/Project"}}}- }- },- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "baseUrl": {- "type": "string",- "minLength": 1- },- "accessToken": {- "type": "string",- "minLength": 1- },- "repositoryOwner": {- "type": "string",- "minLength": 1- },- "repositoryName": {- "type": "string",- "minLength": 1- }- },- "required": [- "baseUrl",- "accessToken",- "repositoryOwner",- "repositoryName"- ]+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }}}- }- },- "summary": "Verify Gitea Access"- }- },- "/gitea-integration/project/{projectId}": {- "get": {- "operationId": "getGiteaIntegration",- "tags": [- "Gitea"- ],- "description": "Get Gitea integration for a project",- "responses": {- "200": {- "description": "Gitea integration details",+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "baseUrl": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "maskedAccessToken": {- "type": "string"- },- "webhookUrl": {- "type": "string"- },- "webhookSecret": {- "type": "string"- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGiteaIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "baseUrl",- "repositoryOwner",- "repositoryName",- "maskedAccessToken",- "isActive",- "createdAt",- "updatedAt"- ],- "nullable": true+ "type": "string"}}}}- },+ }+ }+ },+ "/project/{id}/unarchive": {+ "put": {+ "operationId": "unarchiveProject",+ "tags": [+ "Projects"+ ],+ "summary": "Unarchive project",+ "description": "Return an archived project to the default list.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Get Gitea Integration"- },- "post": {- "operationId": "createGiteaIntegration",- "tags": [- "Gitea"- ],- "description": "Create or update Gitea integration for a project","responses": {"200": {- "description": "Integration saved",+ "description": "The restored project","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "baseUrl": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "maskedAccessToken": {- "type": "string"- },- "webhookUrl": {- "type": "string"- },- "webhookSecret": {- "type": "string"- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGiteaIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "baseUrl",- "repositoryOwner",- "repositoryName",- "maskedAccessToken",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Project"+ }+ }+ }+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/tasks/{projectId}": {+ "get": {+ "operationId": "listTasks",+ "tags": [+ "Tasks"+ ],+ "summary": "List tasks",+ "description": "Get a project's board: its columns, each with the tasks in it, plus the archived and planned buckets. Filter and paginate with the query parameters.","parameters": [{- "in": "path",+ "schema": {+ "type": "string"+ },+ "required": true,"name": "projectId",+ "in": "path"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "status",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "priority",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "assigneeId",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "page",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "limit",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "enum": [+ "createdAt",+ "priority",+ "dueDate",+ "position",+ "title",+ "number"+ ]+ },+ "required": false,+ "name": "sortBy",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "enum": [+ "asc",+ "desc"+ ]+ },+ "required": false,+ "name": "sortOrder",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "dueBefore",+ "in": "query"+ },+ {"schema": {"type": "string"},- "required": true+ "required": false,+ "name": "dueAfter",+ "in": "query"+ }+ ],+ "responses": {+ "200": {+ "description": "The project board",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/BoardResponse"+ }+ }+ }+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }}+ }+ }+ },+ "/task/bulk": {+ "patch": {+ "operationId": "bulkUpdateTasks",+ "tags": [+ "Tasks"],+ "summary": "Bulk update tasks",+ "description": "Apply one operation to many tasks at once. Every task must be in the same workspace.","requestBody": {"required": true,"content": {@@ -7532,114 +6471,104 @@"schema": {"type": "object","properties": {- "baseUrl": {- "type": "string",- "minLength": 1- },- "accessToken": {- "type": "string"+ "taskIds": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "minItems": 1},- "repositoryOwner": {+ "operation": {"type": "string",- "minLength": 1+ "enum": [+ "updateStatus",+ "updatePriority",+ "updateAssignee",+ "delete",+ "addLabel",+ "removeLabel",+ "updateDueDate"+ ]},- "repositoryName": {- "type": "string",- "minLength": 1+ "value": {+ "type": [+ "string",+ "null"+ ],+ "description": "The new value for the chosen operation. Unused by `delete`; null clears an assignee or due date."}},"required": [- "baseUrl",- "repositoryOwner",- "repositoryName"+ "taskIds",+ "operation"]}}}},- "summary": "Create Gitea Integration"- },- "patch": {- "operationId": "updateGiteaIntegration",- "tags": [- "Gitea"- ],- "description": "Update Gitea integration settings","responses": {"200": {- "description": "Updated",+ "description": "Bulk operation result","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "baseUrl": {- "type": "string"- },- "repositoryOwner": {- "type": "string"- },- "repositoryName": {- "type": "string"- },- "maskedAccessToken": {- "type": "string"- },- "webhookUrl": {- "type": "string"- },- "webhookSecret": {- "type": "string"- },- "branchPattern": {- "type": "string"- },- "commentTaskLinkOnGiteaIssue": {- "type": "boolean"- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "baseUrl",- "repositoryOwner",- "repositoryName",- "maskedAccessToken",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/BulkTaskResult"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or the tasks span more than one workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing the permission the operation needs",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "No tasks found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/{projectId}": {+ "post": {+ "operationId": "createTask",+ "tags": [+ "Tasks"+ ],+ "summary": "Create task",+ "description": "Add a task to a project. It is placed in the column named by `status`.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "projectId",+ "in": "path"}],"requestBody": {@@ -7649,103 +6578,155 @@"schema": {"type": "object","properties": {- "isActive": {- "type": "boolean"+ "title": {+ "type": "string"},- "commentTaskLinkOnGiteaIssue": {- "type": "boolean"+ "description": {+ "type": "string"+ },+ "startDate": {+ "type": "string"+ },+ "dueDate": {+ "type": "string"+ },+ "priority": {+ "type": "string",+ "enum": [+ "no-priority",+ "low",+ "medium",+ "high",+ "urgent"+ ]+ },+ "status": {+ "type": "string",+ "description": "The target column's slug."+ },+ "userId": {+ "type": "string",+ "description": "Assignee, if any."}- }+ },+ "required": [+ "title",+ "description",+ "priority",+ "status"+ ]}}}},- "summary": "Update Gitea Integration"- },- "delete": {- "operationId": "deleteGiteaIntegration",- "tags": [- "Gitea"- ],- "description": "Delete Gitea integration for a project","responses": {"200": {- "description": "Deleted",+ "description": "The created task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- },- "message": {- "type": "string"- }- },- "required": [- "success",- "message"- ]+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown project",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:create permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/{id}": {+ "get": {+ "operationId": "getTask",+ "tags": [+ "Tasks"+ ],+ "summary": "Get task",+ "description": "Get a single task by ID, with its assignee's name resolved.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Delete Gitea Integration"- }- },- "/gitea-integration/import-issues": {- "post": {- "operationId": "importGiteaIssues",- "tags": [- "Gitea"- ],- "description": "Import Gitea issues as tasks","responses": {"200": {- "description": "Import result",+ "description": "Task details","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "imported": {- "type": "number"- },- "updated": {- "type": "number"- },- "skipped": {- "type": "number"- },- "errors": {- "type": "array",- "items": {- "type": "string"- }- }- },- "required": [- "imported",- "updated",- "skipped"- ]+ "$ref": "#/components/schemas/TaskWithAssignee"+ }+ }+ }+ },+ "400": {+ "description": "Unknown task, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the task's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ },+ "put": {+ "operationId": "updateTask",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task",+ "description": "Replace every field of a task. Use the single-field routes for narrower edits.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],"requestBody": {"required": true,"content": {@@ -7753,232 +6734,159 @@"schema": {"type": "object","properties": {+ "title": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "startDate": {+ "type": "string"+ },+ "dueDate": {+ "type": "string"+ },+ "priority": {+ "type": "string",+ "enum": [+ "no-priority",+ "low",+ "medium",+ "high",+ "urgent"+ ]+ },+ "status": {+ "type": "string"+ },"projectId": {"type": "string"+ },+ "position": {+ "type": "number"+ },+ "userId": {+ "type": "string"}},"required": [- "projectId"+ "title",+ "description",+ "priority",+ "status",+ "projectId",+ "position"]}}}},- "summary": "Import Gitea Issues"- }- },- "/generic-webhook-integration/project/{projectId}": {- "get": {- "operationId": "getGenericWebhookIntegration",- "tags": [- "Generic Webhook"- ],- "description": "Get generic outgoing webhook integration for a project","responses": {"200": {- "description": "Generic webhook integration details",+ "description": "The updated task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string",- "nullable": true- },- "secretConfigured": {- "type": "boolean"- },- "maskedSecret": {- "type": "string",- "nullable": true- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "webhookConfigured",- "maskedWebhookUrl",- "secretConfigured",- "maskedSecret",- "events",- "isActive",- "createdAt",- "updatedAt"- ],- "nullable": true+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update or task:assign permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ },+ "delete": {+ "operationId": "deleteTask",+ "tags": [+ "Tasks"+ ],+ "summary": "Delete task",+ "description": "Permanently delete a task and its comments, labels, and time entries.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Get Generic Webhook Integration"- },- "post": {- "operationId": "createGenericWebhookIntegration",- "tags": [- "Generic Webhook"- ],- "description": "Create or replace a generic outgoing webhook integration","responses": {"200": {- "description": "Generic webhook integration created successfully",+ "description": "The deleted task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string",- "nullable": true- },- "secretConfigured": {- "type": "boolean"- },- "maskedSecret": {- "type": "string",- "nullable": true- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "webhookConfigured",- "maskedWebhookUrl",- "secretConfigured",- "maskedSecret",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Unknown task, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:delete permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/move/{id}": {+ "put": {+ "operationId": "moveTask",+ "tags": [+ "Tasks"+ ],+ "summary": "Move task",+ "description": "Move a task to another project, optionally into a named column. Both projects must be in the same workspace.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -7988,149 +6896,251 @@"schema": {"type": "object","properties": {- "webhookUrl": {- "type": "string",- "minLength": 1- },- "secret": {+ "destinationProjectId": {"type": "string"},- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }+ "destinationStatus": {+ "type": "string",+ "description": "Defaults to the destination project's first column."}},"required": [- "webhookUrl"+ "destinationProjectId"]}}}},- "summary": "Create Generic Webhook Integration"- },- "patch": {- "operationId": "updateGenericWebhookIntegration",+ "responses": {+ "200": {+ "description": "The moved task, with both project ids",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/MoveTaskResult"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Task or destination project not found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ }+ },+ "/task/export/{projectId}": {+ "get": {+ "operationId": "exportTasks","tags": [- "Generic Webhook"+ "Tasks"+ ],+ "summary": "Export tasks",+ "description": "Export a project's tasks, with their labels, as a JSON document.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"+ }],- "description": "Update generic outgoing webhook settings","responses": {"200": {- "description": "Generic webhook integration updated successfully",+ "description": "The exported project and tasks","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string",- "nullable": true- },- "secretConfigured": {- "type": "boolean"- },- "maskedSecret": {- "type": "string",- "nullable": true- },- "events": {+ "$ref": "#/components/schemas/TaskExport"+ }+ }+ }+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ }+ },+ "/task/import/{projectId}": {+ "post": {+ "operationId": "importTasks",+ "tags": [+ "Tasks"+ ],+ "summary": "Import tasks",+ "description": "Import tasks into a project. Each task is reported individually, so a partial import still returns 200.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "tasks": {+ "type": "array",+ "items": {"type": "object","properties": {- "taskCreated": {- "type": "boolean"+ "title": {+ "type": "string"+ },+ "description": {+ "type": "string"},- "taskStatusChanged": {- "type": "boolean"+ "status": {+ "type": "string"},- "taskPriorityChanged": {- "type": "boolean"+ "priority": {+ "type": "string"},- "taskTitleChanged": {- "type": "boolean"+ "startDate": {+ "type": [+ "string",+ "null"+ ]},- "taskDescriptionChanged": {- "type": "boolean"+ "dueDate": {+ "type": [+ "string",+ "null"+ ]},- "taskCommentCreated": {- "type": "boolean"+ "userId": {+ "type": [+ "string",+ "null"+ ]}},"required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"+ "title",+ "status"]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"}- },- "required": [- "id",- "projectId",- "webhookConfigured",- "maskedWebhookUrl",- "secretConfigured",- "maskedSecret",- "events",- "isActive",- "createdAt",- "updatedAt"- ]- }+ }+ },+ "required": [+ "tasks"+ ]}}}},+ "responses": {+ "200": {+ "description": "Per-task import outcome",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TaskImportResult"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown project",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:create permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ }+ },+ "/task/status/{id}": {+ "put": {+ "operationId": "updateTaskStatus",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task status",+ "description": "Move a task to another column in the same project.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -8140,287 +7150,150 @@"schema": {"type": "object","properties": {- "webhookUrl": {+ "status": {"type": "string"- },- "secret": {- "type": "string",- "nullable": true- },- "isActive": {- "type": "boolean"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }}- }+ },+ "required": [+ "status"+ ]}}}},- "summary": "Update Generic Webhook Integration"- },- "delete": {- "operationId": "deleteGenericWebhookIntegration",- "tags": [- "Generic Webhook"- ],- "description": "Delete generic outgoing webhook integration for a project","responses": {"200": {- "description": "Generic webhook integration deleted successfully",+ "description": "The updated task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- }- },- "required": [- "success"- ]+ "$ref": "#/components/schemas/Task"}}}- }- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Delete Generic Webhook Integration"- }- },- "/discord-integration/project/{projectId}": {- "get": {- "operationId": "getDiscordIntegration",- "tags": [- "Discord"- ],- "description": "Get Discord integration for a project",- "responses": {- "200": {- "description": "Discord integration details",+ },+ "400": {+ "description": "Invalid body, or unknown task","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "channelName",- "webhookConfigured",- "maskedWebhookUrl",- "events",- "isActive",- "createdAt",- "updatedAt"- ],- "nullable": true+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/priority/{id}": {+ "put": {+ "operationId": "updateTaskPriority",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task priority",+ "description": "Set a task's priority.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Get Discord Integration"- },- "post": {- "operationId": "createDiscordIntegration",- "tags": [- "Discord"- ],- "description": "Create or replace a Discord integration for a project",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "priority": {+ "type": "string",+ "enum": [+ "no-priority",+ "low",+ "medium",+ "high",+ "urgent"+ ]+ }+ },+ "required": [+ "priority"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Discord integration created successfully",+ "description": "The updated task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "channelName",- "webhookConfigured",- "maskedWebhookUrl",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid priority, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/assignee/{id}": {+ "put": {+ "operationId": "updateTaskAssignee",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task assignee",+ "description": "Assign a task to a workspace member, or send null to unassign it.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -8430,144 +7303,84 @@"schema": {"type": "object","properties": {- "webhookUrl": {- "type": "string",- "minLength": 1- },- "channelName": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }+ "userId": {+ "type": [+ "string",+ "null"+ ],+ "description": "Null unassigns."}},"required": [- "webhookUrl"+ "userId"]}}}},- "summary": "Create Discord Integration"- },- "patch": {- "operationId": "updateDiscordIntegration",- "tags": [- "Discord"- ],- "description": "Update Discord integration settings","responses": {"200": {- "description": "Discord integration updated successfully",+ "description": "The updated task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "channelName",- "webhookConfigured",- "maskedWebhookUrl",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:assign permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Assignee is not a member of the workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/due-date/{id}": {+ "put": {+ "operationId": "updateTaskDueDate",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task due date",+ "description": "Set or clear a task's due date.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -8577,287 +7390,250 @@"schema": {"type": "object","properties": {- "webhookUrl": {+ "dueDate": {"type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "isActive": {- "type": "boolean"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }}}}}}},- "summary": "Update Discord Integration"- },- "delete": {- "operationId": "deleteDiscordIntegration",- "tags": [- "Discord"- ],- "description": "Delete Discord integration for a project","responses": {"200": {- "description": "Discord integration deleted successfully",+ "description": "The updated task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- }- },- "required": [- "success"- ]+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid date, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/title/{id}": {+ "put": {+ "operationId": "updateTaskTitle",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task title",+ "description": "Rename a task.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Delete Discord Integration"- }- },- "/slack-integration/project/{projectId}": {- "get": {- "operationId": "getSlackIntegration",- "tags": [- "Slack"- ],- "description": "Get Slack integration for a project",- "responses": {- "200": {- "description": "Slack integration details",- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "channelName",- "webhookConfigured",- "maskedWebhookUrl",- "events",- "isActive",- "createdAt",- "updatedAt"- ],- "nullable": true+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "title": {+ "type": "string"+ }+ },+ "required": [+ "title"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "The updated task",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/image-upload/{id}": {+ "put": {+ "operationId": "createTaskImageUpload",+ "tags": [+ "Tasks"+ ],+ "summary": "Create image upload URL",+ "description": "Get a presigned URL for uploading an image used in a task description or comment. PUT the bytes to it, then call the finalize route.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],- "summary": "Get Slack Integration"- },- "post": {- "operationId": "createSlackIntegration",- "tags": [- "Slack"- ],- "description": "Create or replace a Slack integration for a project",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "filename": {+ "type": "string"+ },+ "contentType": {+ "type": "string"+ },+ "size": {+ "type": "number"+ },+ "surface": {+ "type": "string",+ "enum": [+ "description",+ "comment"+ ],+ "description": "Where the image is used, which decides how it is scoped."+ }+ },+ "required": [+ "filename",+ "contentType",+ "size",+ "surface"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Slack integration created successfully",+ "description": "The presigned upload","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "channelName",- "webhookConfigured",- "maskedWebhookUrl",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/TaskImageUpload"+ }+ }+ }+ },+ "400": {+ "description": "Unsupported content type, or the file is too large",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Task not found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "503": {+ "description": "Image uploads are not configured on this instance",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/image-upload/{id}/finalize": {+ "post": {+ "operationId": "finalizeTaskImageUpload",+ "tags": [+ "Tasks"+ ],+ "summary": "Finalize image upload",+ "description": "Record an uploaded image as a private asset and return the URL to reference it by.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -8867,144 +7643,102 @@"schema": {"type": "object","properties": {- "webhookUrl": {+ "key": {"type": "string",- "minLength": 1+ "description": "The key returned when the URL was issued."},- "channelName": {+ "filename": {"type": "string"},- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }+ "contentType": {+ "type": "string"+ },+ "size": {+ "type": "number"+ },+ "surface": {+ "type": "string",+ "enum": [+ "description",+ "comment"+ ],+ "description": "Where the image is used, which decides how it is scoped."}},"required": [- "webhookUrl"+ "key",+ "filename",+ "contentType",+ "size",+ "surface"]}}}},- "summary": "Create Slack Integration"- },- "patch": {- "operationId": "updateSlackIntegration",- "tags": [- "Slack"- ],- "description": "Update Slack integration settings","responses": {"200": {- "description": "Slack integration updated successfully",+ "description": "The stored asset","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "webhookConfigured": {- "type": "boolean"- },- "maskedWebhookUrl": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "channelName",- "webhookConfigured",- "maskedWebhookUrl",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/TaskImageAsset"+ }+ }+ }+ },+ "400": {+ "description": "Invalid upload, or the key does not belong to this task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Task not found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/task/description/{id}": {+ "put": {+ "operationId": "updateTaskDescription",+ "tags": [+ "Tasks"+ ],+ "summary": "Update task description",+ "description": "Replace a task's description.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -9014,307 +7748,208 @@"schema": {"type": "object","properties": {- "webhookUrl": {+ "description": {"type": "string"- },- "channelName": {- "type": "string",- "nullable": true- },- "isActive": {- "type": "boolean"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }}- }+ },+ "required": [+ "description"+ ]}}}},- "summary": "Update Slack Integration"- },- "delete": {- "operationId": "deleteSlackIntegration",- "tags": [- "Slack"- ],- "description": "Delete Slack integration for a project","responses": {"200": {- "description": "Slack integration deleted successfully",+ "description": "The updated task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- }- },- "required": [- "success"- ]+ "$ref": "#/components/schemas/Task"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/column/{projectId}": {+ "get": {+ "operationId": "getColumns",+ "tags": [+ "Columns"+ ],+ "summary": "Get columns",+ "description": "Get a project's board columns, ordered by position.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "projectId",+ "in": "path"}],- "summary": "Delete Slack Integration"- }- },- "/telegram-integration/project/{projectId}": {- "get": {- "operationId": "getTelegramIntegration",- "tags": [- "Telegram"- ],- "description": "Get Telegram integration for a project","responses": {"200": {- "description": "Telegram integration details",+ "description": "List of columns ordered by position","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "chatId": {- "type": "string"- },- "threadId": {- "type": "number",- "nullable": true- },- "chatLabel": {- "type": "string",- "nullable": true- },- "botTokenConfigured": {- "type": "boolean"- },- "maskedBotToken": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "chatId",- "threadId",- "chatLabel",- "botTokenConfigured",- "maskedBotToken",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Column"+ }}}}},- "404": {- "description": "Telegram integration not found"+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }}- },+ }+ },+ "post": {+ "operationId": "createColumn",+ "tags": [+ "Columns"+ ],+ "summary": "Create column",+ "description": "Add a column to the end of a project's board. The slug is derived from the name.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "projectId",+ "in": "path"}],- "summary": "Get Telegram Integration"- },- "post": {- "operationId": "createTelegramIntegration",- "tags": [- "Telegram"- ],- "description": "Create or replace a Telegram integration for a project",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "icon": {+ "type": "string"+ },+ "color": {+ "type": "string"+ },+ "isFinal": {+ "type": "boolean"+ }+ },+ "required": [+ "name"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Telegram integration created successfully",+ "description": "The created column","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "chatId": {- "type": "string"- },- "threadId": {- "type": "number",- "nullable": true- },- "chatLabel": {- "type": "string",- "nullable": true- },- "botTokenConfigured": {- "type": "boolean"- },- "maskedBotToken": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "chatId",- "threadId",- "chatLabel",- "botTokenConfigured",- "maskedBotToken",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/Column"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown project",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/column/reorder/{projectId}": {+ "put": {+ "operationId": "reorderColumns",+ "tags": [+ "Columns"+ ],+ "summary": "Reorder columns",+ "description": "Set new positions for a project's columns and return the whole board in its new order.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "projectId",+ "in": "path"}],"requestBody": {@@ -9324,161 +7959,89 @@"schema": {"type": "object","properties": {- "botToken": {- "type": "string",- "minLength": 1- },- "chatId": {- "type": "string",- "minLength": 1- },- "threadId": {- "type": "number"- },- "chatLabel": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"+ "columns": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "position": {+ "type": "number"+ }},- "taskCommentCreated": {- "type": "boolean"- }- }+ "required": [+ "id",+ "position"+ ]+ },+ "description": "Every column keeps its new position. Columns from another project are rejected."}},"required": [- "botToken",- "chatId"+ "columns"]}}}},- "summary": "Create Telegram Integration"- },- "patch": {- "operationId": "updateTelegramIntegration",- "tags": [- "Telegram"- ],- "description": "Update Telegram integration settings","responses": {"200": {- "description": "Telegram integration updated successfully",+ "description": "The reordered columns","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "projectId": {- "type": "string"- },- "chatId": {- "type": "string"- },- "threadId": {- "type": "number",- "nullable": true- },- "chatLabel": {- "type": "string",- "nullable": true- },- "botTokenConfigured": {- "type": "boolean"- },- "maskedBotToken": {- "type": "string"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- },- "required": [- "taskCreated",- "taskStatusChanged",- "taskPriorityChanged",- "taskTitleChanged",- "taskDescriptionChanged",- "taskCommentCreated"- ]- },- "isActive": {- "type": "boolean",- "nullable": true- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "projectId",- "chatId",- "threadId",- "chatLabel",- "botTokenConfigured",- "maskedBotToken",- "events",- "isActive",- "createdAt",- "updatedAt"- ]+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Column"+ }+ }+ }+ }+ },+ "400": {+ "description": "A column does not belong to this project",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/column/{id}": {+ "put": {+ "operationId": "updateColumn",+ "tags": [+ "Columns"+ ],+ "summary": "Update column",+ "description": "Update a column. Omitted fields are left unchanged; icon and color accept null to clear them.","parameters": [{- "in": "path",- "name": "projectId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "id",+ "in": "path"}],"requestBody": {@@ -9488,168 +8051,195 @@"schema": {"type": "object","properties": {- "botToken": {- "type": "string"- },- "chatId": {+ "name": {"type": "string"},- "threadId": {- "type": "number",- "nullable": true+ "icon": {+ "type": [+ "string",+ "null"+ ]},- "chatLabel": {- "type": "string",- "nullable": true+ "color": {+ "type": [+ "string",+ "null"+ ]},- "isActive": {+ "isFinal": {"type": "boolean"- },- "events": {- "type": "object",- "properties": {- "taskCreated": {- "type": "boolean"- },- "taskStatusChanged": {- "type": "boolean"- },- "taskPriorityChanged": {- "type": "boolean"- },- "taskTitleChanged": {- "type": "boolean"- },- "taskDescriptionChanged": {- "type": "boolean"- },- "taskCommentCreated": {- "type": "boolean"- }- }}}}}}},- "summary": "Update Telegram Integration"+ "responses": {+ "200": {+ "description": "The updated column",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/Column"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown column",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }},"delete": {- "operationId": "deleteTelegramIntegration",+ "operationId": "deleteColumn","tags": [- "Telegram"+ "Columns"+ ],+ "summary": "Delete column",+ "description": "Delete an empty column. A column holding tasks is refused until they are moved or deleted.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"+ }],- "description": "Delete Telegram integration for a project","responses": {"200": {- "description": "Telegram integration deleted successfully",+ "description": "The deleted column","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "success": {- "type": "boolean"- }- },- "required": [- "success"- ]+ "$ref": "#/components/schemas/Column"+ }+ }+ }+ },+ "400": {+ "description": "Unknown column, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing project:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "409": {+ "description": "The column still contains tasks",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Delete Telegram Integration"+ }}},- "/task-relation/{taskId}": {+ "/activity/{taskId}": {"get": {- "operationId": "getTaskRelations",+ "operationId": "getActivities","tags": [- "Task Relations"+ "Activity"],- "description": "Get all relations for a task",- "responses": {- "200": {- "description": "Task relations with associated task data",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }- }- },+ "summary": "Get task activity",+ "description": "Get a task's full activity feed, newest first: comments alongside system events such as status and assignee changes.","parameters": [{- "in": "path",- "name": "taskId","schema": {"type": "string"},- "required": true+ "required": true,+ "name": "taskId",+ "in": "path"}],- "summary": "Get Task Relations"- }- },- "/task-relation": {- "post": {- "operationId": "createTaskRelation",- "tags": [- "Task Relations"- ],- "description": "Create a relation between two tasks","responses": {"200": {- "description": "Task relation created successfully",+ "description": "List of activities for the task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "sourceTaskId": {- "type": "string"- },- "targetTaskId": {- "type": "string"- },- "relationType": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "sourceTaskId",- "targetTaskId",- "relationType",- "createdAt"- ]+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Activity"+ }+ }+ }+ }+ },+ "400": {+ "description": "Unknown task, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the task's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },+ }+ }+ },+ "/activity/create": {+ "post": {+ "operationId": "createActivity",+ "tags": [+ "Activity"+ ],+ "summary": "Create activity",+ "description": "Record a system-generated event on a task. Most events are written by the server itself; this exists for importers and integrations.","requestBody": {"required": true,"content": {@@ -9657,232 +8247,148 @@"schema": {"type": "object","properties": {- "sourceTaskId": {+ "taskId": {"type": "string"},- "targetTaskId": {- "type": "string"+ "message": {+ "type": [+ "string",+ "null"+ ],+ "description": "Free-text body. Null for events whose meaning is in eventData."},- "relationType": {- "enum": [- "subtask",- "blocks",- "related"+ "type": {+ "type": "string",+ "description": "The event kind, e.g. status_changed or assignee_changed."+ },+ "eventData": {+ "type": [+ "object",+ "null"],- "type": "string"+ "additionalProperties": {},+ "description": "Type-specific payload stored alongside the event."}},"required": [- "sourceTaskId",- "targetTaskId",- "relationType"+ "taskId",+ "message",+ "type"]}}}},- "summary": "Create Task Relation"- }- },- "/task-relation/{id}": {- "delete": {- "operationId": "deleteTaskRelation",- "tags": [- "Task Relations"- ],- "description": "Delete a task relation","responses": {"200": {- "description": "Task relation deleted successfully",+ "description": "The created activity","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "sourceTaskId": {- "type": "string"- },- "targetTaskId": {- "type": "string"- },- "relationType": {- "type": "string"- },- "createdAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "sourceTaskId",- "targetTaskId",- "relationType",- "createdAt"- ]+ "$ref": "#/components/schemas/Activity"}}}- }- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Delete Task Relation"- }- },- "/external-link/task/{taskId}": {- "get": {- "operationId": "getExternalLinksByTask",- "tags": [- "External Links"- ],- "description": "Get all external links for a task",- "responses": {- "200": {- "description": "External links for the task",+ },+ "400": {+ "description": "Invalid body, or unknown task","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "taskId": {- "type": "string"- },- "integrationId": {- "type": "string"- },- "resourceType": {- "type": "string"- },- "externalId": {- "type": "string"- },- "url": {- "type": "string"- },- "title": {- "type": "string",- "nullable": true- },- "metadata": {- "type": "string",- "format": "date-time"- },- "createdAt": {- "type": "string",- "format": "date-time"- },- "updatedAt": {- "type": "string",- "format": "date-time"- }- },- "required": [- "id",- "taskId",- "integrationId",- "resourceType",- "externalId",- "url",- "title",- "metadata",- "createdAt",- "updatedAt"- ]- }+ "type": "string"}}}- }- },- "parameters": [- {- "in": "path",- "name": "taskId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get External Links By Task"- }- },- "/workflow-rule/{projectId}": {- "get": {- "operationId": "getWorkflowRules",- "tags": [- "Workflow Rules"- ],- "description": "Get all workflow rules for a project",- "responses": {- "200": {- "description": "List of workflow rules",+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object"+ "type": "string"}}}}- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Workflow Rules"- },- "put": {- "operationId": "upsertWorkflowRule",+ }+ }+ },+ "/activity/comment": {+ "post": {+ "operationId": "createComment","tags": [- "Workflow Rules"+ "Activity"],- "description": "Create or update a workflow rule",+ "summary": "Create comment",+ "description": "Add a comment to a task. Equivalent to POST /comment/{taskId}, kept for the activity-feed client.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "taskId": {+ "type": "string"+ },+ "comment": {+ "type": "string"+ }+ },+ "required": [+ "taskId",+ "comment"+ ]+ }+ }+ }+ },"responses": {"200": {- "description": "Workflow rule upserted successfully",+ "description": "The created comment","content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/Activity"+ }+ }+ }+ },+ "400": {+ "description": "Invalid body, or unknown task",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing task:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}}}- },- "parameters": [- {- "in": "path",- "name": "projectId",- "schema": {- "type": "string"- },- "required": true- }+ }+ },+ "put": {+ "operationId": "updateComment",+ "tags": [+ "Activity"],+ "summary": "Update comment",+ "description": "Edit a comment. Only the comment's author may do this.","requestBody": {"required": true,"content": {@@ -9890,314 +8396,87 @@"schema": {"type": "object","properties": {- "integrationType": {- "type": "string"- },- "eventType": {+ "activityId": {"type": "string"},- "columnId": {+ "comment": {"type": "string"}},"required": [- "integrationType",- "eventType",- "columnId"+ "activityId",+ "comment"]}}}},- "summary": "Upsert Workflow Rule"- }- },- "/workflow-rule/{id}": {- "delete": {- "operationId": "deleteWorkflowRule",- "tags": [- "Workflow Rules"- ],- "description": "Delete a workflow rule","responses": {"200": {- "description": "Workflow rule deleted successfully",+ "description": "The updated comment","content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/Activity"}}}- }- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Delete Workflow Rule"- }- },- "/invitation/pending": {- "get": {- "operationId": "getUserPendingInvitations",- "tags": [- "Invitations"- ],- "description": "Get all pending invitations for the current user",- "responses": {- "200": {- "description": "List of pending invitations",+ },+ "400": {+ "description": "Invalid body, or unknown activity","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "email": {- "type": "string"- },- "workspaceId": {- "type": "string"- },- "workspaceName": {- "type": "string"- },- "inviterName": {- "type": "string"- },- "expiresAt": {- "type": "string"- },- "createdAt": {- "type": "string"- },- "status": {- "type": "string"- }- },- "required": [- "id",- "email",- "workspaceId",- "workspaceName",- "inviterName",- "expiresAt",- "createdAt",- "status"- ]- }+ "type": "string"}}}- }- },- "summary": "Get User Pending Invitations"- }- },- "/invitation/{id}": {- "get": {- "operationId": "getInvitationDetails",- "tags": [- "Invitations"- ],- "description": "Get details of a specific invitation by ID",- "responses": {- "200": {- "description": "Invitation details",+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "Not the author, or no access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "valid": {- "type": "boolean"- },- "invitation": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "email": {- "type": "string"- },- "workspaceName": {- "type": "string"- },- "inviterName": {- "type": "string"- },- "expiresAt": {- "type": "string"- },- "status": {- "type": "string"- },- "expired": {- "type": "boolean"- }- },- "required": [- "id",- "email",- "workspaceName",- "inviterName",- "expiresAt",- "status",- "expired"- ]- },- "error": {- "type": "string"- }- },- "required": [- "valid"- ]+ "type": "string"}}}- }- },- "parameters": [- {- "in": "path",- "name": "id",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Invitation Details"- }- },- "/workspace/{workspaceId}/members": {- "get": {- "operationId": "getWorkspaceMembers",- "tags": [- "Workspaces"- ],- "description": "Get all members of a workspace",- "responses": {- "200": {- "description": "List of workspace members",+ },+ "404": {+ "description": "Comment not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "name": {- "type": "string"- },- "email": {- "type": "string"- },- "image": {- "type": "string",- "nullable": true- },- "role": {- "type": "string"- }- },- "required": [- "id",- "name",- "email",- "image",- "role"- ]- }+ "type": "string"}}}}- },- "parameters": [- {- "in": "path",- "name": "workspaceId",- "schema": {- "type": "string"- },- "required": true- }- ],- "summary": "Get Workspace Members"- }- },- "/auth/organization/create": {- "post": {- "tags": [- "Organization Management"- ],- "description": "Create an organization",- "security": [- {- "bearerAuth": []- }- ],- "parameters": [],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "name": {- "type": "string",- "description": "The name of the organization"- },- "slug": {- "type": "string",- "description": "The slug of the organization"- },- "userId": {- "type": "string",- "description": "The user id of the organization creator. If not provided, the current user will be used. Should only be used by admins or when called by the server. server-only. Eg: \"user-id\"",- "nullable": true- },- "logo": {- "type": "string",- "description": "The logo of the organization",- "nullable": true- },- "metadata": {- "type": "string",- "description": "The metadata of the organization",- "nullable": true- },- "keepCurrentActiveOrganization": {- "type": "boolean",- "description": "Whether to keep the current active organization active after creating a new one. Eg: true",- "nullable": true- },- "description": {- "type": "string",- "nullable": true+ }+ },+ "delete": {+ "operationId": "deleteComment",+ "tags": [+ "Activity"+ ],+ "summary": "Delete comment",+ "description": "Delete a comment. Only the comment's author may do this.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "activityId": {+ "type": "string"}},"required": [- "name",- "slug"+ "activityId"]}}@@ -10205,134 +8484,125 @@},"responses": {"200": {- "description": "Success",+ "description": "The deleted comment","content": {"application/json": {"schema": {- "allOf": [- {- "$ref": "#/components/schemas/Organization"- }- ],- "type": "object",- "description": "The organization that was created"+ "$ref": "#/components/schemas/Activity"}}}},"400": {+ "description": "Invalid body, or unknown activity","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "Not the author, or no access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Comment not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/comment/{taskId}": {+ "get": {+ "operationId": "getTaskComments",+ "tags": [+ "Comments"+ ],+ "summary": "Get task comments",+ "description": "Get every comment on a task, oldest first, each with its author's name and avatar.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "taskId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "List of comments for the task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Comment"}}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown task, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No access to the task's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "createOrganization",- "summary": "Create Organization"- }- },- "/auth/organization/update": {+ }+ },"post": {+ "operationId": "createTaskComment","tags": [- "Organization Management"+ "Comments"],- "description": "Update an organization",- "security": [+ "summary": "Create task comment",+ "description": "Add a comment to a task. Mentions in the content notify the mentioned users, and the assignee is notified too. Returns the stored activity row, which carries no author object -- read the list route for that.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "taskId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -10340,43 +8610,27 @@"schema": {"type": "object","properties": {- "data": {- "type": "object",- "properties": {- "description": {- "type": "string",- "nullable": true- },- "name": {- "type": "string",- "description": "The name of the organization",- "nullable": true- },- "slug": {- "type": "string",- "description": "The slug of the organization",- "nullable": true- },- "logo": {- "type": "string",- "description": "The logo of the organization",- "nullable": true- },- "metadata": {- "type": "string",- "description": "The metadata of the organization",- "nullable": true- }- }+ "content": {+ "type": "string",+ "minLength": 1},- "organizationId": {+ "externalUserName": {+ "type": "string",+ "maxLength": 120,+ "description": "Attribution for an imported comment. Ignored unless externalSource is also given."+ },+ "externalSource": {"type": "string",- "description": "The organization ID. Eg: \"org-id\"",- "nullable": true+ "enum": [+ "planka",+ "trello",+ "jira"+ ],+ "description": "The tool the comment was imported from."}},"required": [- "data"+ "content"]}}@@ -10384,134 +8638,59 @@},"responses": {"200": {- "description": "Success",+ "description": "The created comment","content": {"application/json": {"schema": {- "allOf": [- {- "$ref": "#/components/schemas/Organization"- }- ],- "type": "object",- "description": "The updated organization"+ "$ref": "#/components/schemas/Activity"}}}},"400": {+ "description": "Invalid body, or unknown task","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing task:update permission","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "updateOrganization",- "summary": "Update Organization"+ }}},- "/auth/organization/delete": {- "post": {+ "/comment/{id}": {+ "put": {+ "operationId": "updateTaskComment","tags": [- "Organization Management"+ "Comments"],- "description": "Delete an organization",- "security": [+ "summary": "Update task comment",+ "description": "Edit a comment. Only the comment's author may do this.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -10519,13 +8698,13 @@"schema": {"type": "object","properties": {- "organizationId": {+ "content": {"type": "string",- "description": "The organization id to delete"+ "minLength": 1}},"required": [- "organizationId"+ "content"]}}@@ -10533,538 +8712,510 @@},"responses": {"200": {- "description": "Success",+ "description": "The updated comment","content": {"application/json": {"schema": {- "type": "string",- "description": "The organization id that was deleted"+ "$ref": "#/components/schemas/Activity"}}}},"400": {+ "description": "Invalid body, or unknown comment","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "Not the author, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Comment not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteTaskComment",+ "tags": [+ "Comments"+ ],+ "summary": "Delete task comment",+ "description": "Delete a comment. Only the comment's author may do this.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The deleted comment","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/Activity"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown comment, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "Not the author, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "404": {+ "description": "Comment not found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }}- },- "operationId": "deleteOrganization",- "summary": "Delete Organization"+ }}},- "/auth/organization/set-active": {- "post": {+ "/time-entry/task/{taskId}": {+ "get": {+ "operationId": "getTaskTimeEntries","tags": [- "Organization Management"+ "Time Entries"],- "description": "Set the active organization",- "operationId": "setOrganizationActive",- "security": [+ "summary": "Get task time entries",+ "description": "Get every time entry logged against a task.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "taskId",+ "in": "path"}],- "parameters": [],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "organizationId": {- "type": "string",- "nullable": true- },- "organizationSlug": {- "type": "string",- "description": "The organization slug to set as active. It can be null to unset the active organization if organizationId is not provided. Eg: \"org-slug\"",- "nullable": true- }- }- }- }- }- },"responses": {"200": {- "description": "Success",+ "description": "List of time entries for the task","content": {"application/json": {"schema": {- "allOf": [- {- "$ref": "#/components/schemas/Organization"- }- ],- "type": "object",- "description": "The organization"+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/TimeEntry"+ }}}}},"400": {+ "description": "Unknown task, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the task's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}+ }+ }+ }+ }+ },+ "/time-entry/{id}": {+ "get": {+ "operationId": "getTimeEntry",+ "tags": [+ "Time Entries"+ ],+ "summary": "Get time entry",+ "description": "Get a single time entry by ID.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Time entry details","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/TimeEntry"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "400": {+ "description": "Unknown entry, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "429": {+ "403": {+ "description": "No access to the entry's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "put": {+ "operationId": "updateTimeEntry",+ "tags": [+ "Time Entries"+ ],+ "summary": "Update time entry",+ "description": "Replace a time entry's start, end, and description. Setting endTime closes a running entry and fills in its duration.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "startTime": {+ "type": "string",+ "format": "date-time",+ "example": "2026-01-31T09:00:00Z"+ },+ "endTime": {+ "type": "string",+ "format": "date-time",+ "example": "2026-01-31T09:00:00Z"+ },+ "description": {+ "type": "string"}- }+ },+ "required": [+ "startTime"+ ]}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}},- "summary": "Set Organization Active"- }- },- "/auth/organization/get-full-organization": {- "get": {- "tags": [- "Organization Management"- ],- "description": "Get the full organization",- "operationId": "getOrganizationFullOrganization",- "security": [- {- "bearerAuth": []- }- ],- "parameters": [],"responses": {"200": {- "description": "Success",+ "description": "The updated time entry","content": {"application/json": {"schema": {- "allOf": [- {- "$ref": "#/components/schemas/Organization"- }- ],- "type": "object",- "description": "The organization"+ "$ref": "#/components/schemas/TimeEntry"}}}},"400": {+ "description": "Invalid timestamps, or unknown entry","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ }+ }+ }+ }+ },+ "/time-entry": {+ "post": {+ "operationId": "createTimeEntry",+ "tags": [+ "Time Entries"+ ],+ "summary": "Create time entry",+ "description": "Log time against a task. Omit endTime to start a running entry that can be closed later with an update.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "taskId": {+ "type": "string"+ },+ "startTime": {+ "type": "string",+ "format": "date-time",+ "example": "2026-01-31T09:00:00Z"+ },+ "endTime": {+ "type": "string",+ "format": "date-time",+ "example": "2026-01-31T09:00:00Z",+ "description": "Omit to start an open-ended entry that is still running."+ },+ "description": {+ "type": "string"+ }+ },+ "required": [+ "taskId",+ "startTime"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "The created time entry","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/TimeEntry"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Invalid timestamps, or unknown task","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No workspace access, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "summary": "Get Organization Full Organization"+ }}},- "/auth/organization/list": {+ "/label/task/{taskId}": {"get": {+ "operationId": "getTaskLabels","tags": [- "Organization Management"+ "Labels"],- "description": "List all organizations",- "security": [+ "summary": "Get task labels",+ "description": "Get all labels assigned to a specific task",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "taskId",+ "in": "path"}],- "parameters": [],"responses": {"200": {- "description": "Success",+ "description": "List of labels for the task","content": {"application/json": {"schema": {"type": "array","items": {- "$ref": "#/components/schemas/Organization"+ "$ref": "#/components/schemas/Label"}}}}},"400": {+ "description": "Unknown task, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No access to the task's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/label/workspace/{workspaceId}": {+ "get": {+ "operationId": "getWorkspaceLabels",+ "tags": [+ "Labels"+ ],+ "summary": "Get workspace labels",+ "description": "Get all labels for a specific workspace",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "workspaceId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "List of labels in the workspace","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Label"}}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Workspace ID could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganization",- "summary": "List Organization"+ }}},- "/auth/organization/invite-member": {+ "/label": {"post": {+ "operationId": "createLabel","tags": [- "Organization Management"- ],- "description": "Create an invitation to an organization",- "operationId": "inviteOrganizationMember",- "security": [- {- "bearerAuth": []- }+ "Labels"],- "parameters": [],+ "summary": "Create label",+ "description": "Create a new label in a workspace","requestBody": {"required": true,"content": {@@ -11072,32 +9223,23 @@"schema": {"type": "object","properties": {- "email": {- "type": "string",- "description": "The email address of the user to invite"- },- "role": {- "type": "string",- "description": "The role(s) to assign to the user. It can be `admin`, `member`, owner. Eg: \"member\""+ "name": {+ "type": "string"},- "organizationId": {- "type": "string",- "description": "The organization ID to invite the user to",- "nullable": true+ "color": {+ "type": "string"},- "resend": {- "type": "boolean",- "description": "Resend the invitation email, if the user is already invited. Eg: true",- "nullable": true+ "workspaceId": {+ "type": "string"},- "teamId": {+ "taskId": {"type": "string"}},"required": [- "email",- "role",- "teamId"+ "name",+ "color",+ "workspaceId"]}}@@ -11105,162 +9247,122 @@},"responses": {"200": {- "description": "Success",+ "description": "Label created successfully","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "email": {- "type": "string"- },- "role": {- "type": "string"- },- "organizationId": {- "type": "string"- },- "inviterId": {- "type": "string"- },- "status": {- "type": "string"- },- "expiresAt": {- "type": "string"- },- "createdAt": {- "type": "string"- }- },- "required": [- "id",- "email",- "role",- "organizationId",- "inviterId",- "status",- "expiresAt",- "createdAt"- ]+ "$ref": "#/components/schemas/Label"}}}},"400": {+ "description": "Invalid body, or workspace ID could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing label:create permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Task not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/label/{id}": {+ "get": {+ "operationId": "getLabel",+ "tags": [+ "Labels"+ ],+ "summary": "Get label",+ "description": "Get a specific label by ID",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Label details","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/Label"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown label, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No access to the label's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "summary": "Invite Organization Member"- }- },- "/auth/organization/cancel-invitation": {- "post": {+ }+ },+ "put": {+ "operationId": "updateLabel","tags": [- "Organization Management"+ "Labels"],- "security": [+ "summary": "Update label",+ "description": "Update an existing label",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -11268,132 +9370,139 @@"schema": {"type": "object","properties": {- "invitationId": {- "type": "string",- "description": "The ID of the invitation to cancel"+ "name": {+ "type": "string"+ },+ "color": {+ "type": "string"}},"required": [- "invitationId"+ "name",+ "color"]}}}},"responses": {- "400": {+ "200": {+ "description": "Label updated successfully","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/Label"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Invalid body, or unknown label","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing label:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteLabel",+ "tags": [+ "Labels"+ ],+ "summary": "Delete label",+ "description": "Delete a label by ID",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Label deleted successfully","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/Label"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown label, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing label:delete permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "The label's task no longer exists",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "cancelOrganizationInvitation",- "summary": "Cancel Organization Invitation"+ }}},- "/auth/organization/accept-invitation": {- "post": {+ "/label/{id}/task": {+ "put": {+ "operationId": "attachLabelToTask","tags": [- "Organization Management"+ "Labels"],- "description": "Accept an invitation to an organization",- "security": [+ "summary": "Attach label to task",+ "description": "Attach an existing label to a task",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -11401,13 +9510,12 @@"schema": {"type": "object","properties": {- "invitationId": {- "type": "string",- "description": "The ID of the invitation to accept"+ "taskId": {+ "type": "string"}},"required": [- "invitationId"+ "taskId"]}}@@ -11415,314 +9523,486 @@},"responses": {"200": {- "description": "Success",+ "description": "Label attached to task successfully","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "invitation": {- "type": "object"- },- "member": {- "type": "object"- }- }+ "$ref": "#/components/schemas/Label"}}}},"400": {+ "description": "Unknown label, or label and task belong to different workspaces","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing label:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Task not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "delete": {+ "operationId": "detachLabelFromTask",+ "tags": [+ "Labels"+ ],+ "summary": "Detach label from task",+ "description": "Detach a label from its current task",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Label detached from task successfully","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/Label"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown label, or label is not assigned to a task","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing label:update permission",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }},- "500": {+ "404": {+ "description": "Task not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "acceptOrganizationInvitation",- "summary": "Accept Organization Invitation"+ }}},- "/auth/organization/get-invitation": {+ "/notification": {"get": {+ "operationId": "listNotifications","tags": [- "Organization Management"+ "Notifications"],- "description": "Get an invitation by ID",- "security": [- {- "bearerAuth": []+ "summary": "List notifications",+ "description": "Get every notification for the current user, read and unread.",+ "responses": {+ "200": {+ "description": "List of notifications",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Notification"+ }+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"}+ }+ },+ "post": {+ "operationId": "createNotification",+ "tags": [+ "Notifications"],- "parameters": [- {- "name": "id",- "in": "query",- "schema": {- "type": "string",- "description": "The ID of the invitation to get"- },- "required": true+ "summary": "Create notification",+ "description": "Create a notification for the current user. Most notifications are raised by the server from task and workspace events; this exists for integrations. Returns null when the user has turned off this notification category in their preferences.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "title": {+ "type": [+ "string",+ "null"+ ]+ },+ "message": {+ "type": [+ "string",+ "null"+ ],+ "description": "Stored as the notification's content."+ },+ "type": {+ "type": "string"+ },+ "eventData": {+ "type": [+ "object",+ "null"+ ],+ "additionalProperties": {}+ },+ "relatedEntityId": {+ "type": "string",+ "description": "Stored as resourceId: the task or workspace being pointed at."+ },+ "relatedEntityType": {+ "type": "string",+ "description": "Stored as resourceType: `task` or `workspace`."+ }+ },+ "required": [+ "type"+ ]+ }+ }}- ],+ },"responses": {"200": {- "description": "Success",+ "description": "The created notification, or null when the user has muted this notification type","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "email": {- "type": "string"- },- "role": {- "type": "string"- },- "organizationId": {- "type": "string"- },- "inviterId": {- "type": "string"- },- "status": {- "type": "string"- },- "expiresAt": {- "type": "string"- },- "organizationName": {- "type": "string"- },- "organizationSlug": {- "type": "string"+ "allOf": [+ {+ "$ref": "#/components/schemas/Notification"},- "inviterEmail": {- "type": "string"+ {+ "type": [+ "object",+ "null"+ ]}- },- "required": [- "id",- "email",- "role",- "organizationId",- "inviterId",- "status",- "expiresAt",- "organizationName",- "organizationSlug",- "inviterEmail"]}}}},- "400": {+ "400": {+ "description": "Invalid request",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/notification/{id}/read": {+ "patch": {+ "operationId": "markNotificationAsRead",+ "tags": [+ "Notifications"+ ],+ "summary": "Mark notification read",+ "description": "Mark one notification as read. Scoped to the current user, so another user's notification is not found.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The updated notification",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/Notification"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "404": {+ "description": "Notification not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."- },- "401": {+ }+ }+ }+ }+ },+ "/notification/read-all": {+ "patch": {+ "operationId": "markAllNotificationsAsRead",+ "tags": [+ "Notifications"+ ],+ "summary": "Mark all read",+ "description": "Mark every notification for the current user as read.",+ "responses": {+ "200": {+ "description": "All notifications marked as read","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/NotificationBulkResult"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/notification/clear-all": {+ "delete": {+ "operationId": "clearAllNotifications",+ "tags": [+ "Notifications"+ ],+ "summary": "Clear all",+ "description": "Permanently delete every notification for the current user. This cannot be undone.",+ "responses": {+ "200": {+ "description": "All notifications cleared","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/NotificationBulkResult"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/notification-preferences": {+ "get": {+ "operationId": "getNotificationPreferences",+ "tags": [+ "Notification Preferences"+ ],+ "summary": "Get notification preferences",+ "description": "Get how the current user is notified, globally and per workspace. Configured secrets are reported as booleans plus a masked preview, never in full.",+ "responses": {+ "200": {+ "description": "Notification preferences","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/NotificationPreferences"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "401": {+ "description": "Missing or invalid credentials"+ }+ }+ },+ "put": {+ "operationId": "updateNotificationPreferences",+ "tags": [+ "Notification Preferences"+ ],+ "summary": "Update notification preferences",+ "description": "Update the global delivery settings. Omitted fields are left unchanged; a secret sent as null is cleared.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "emailEnabled": {+ "type": "boolean"+ },+ "ntfyEnabled": {+ "type": "boolean"+ },+ "ntfyServerUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "ntfyTopic": {+ "type": [+ "string",+ "null"+ ]+ },+ "ntfyToken": {+ "type": [+ "string",+ "null"+ ]+ },+ "gotifyEnabled": {+ "type": "boolean"+ },+ "gotifyServerUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "gotifyToken": {+ "type": [+ "string",+ "null"+ ]+ },+ "webhookEnabled": {+ "type": "boolean"+ },+ "webhookUrl": {+ "type": [+ "string",+ "null"+ ]+ },+ "webhookSecret": {+ "type": [+ "string",+ "null"+ ]+ },+ "taskAssignmentEnabled": {+ "type": "boolean"+ },+ "taskCommentEnabled": {+ "type": "boolean"+ },+ "taskStatusChangeEnabled": {+ "type": "boolean"+ },+ "dueDateReminderEnabled": {+ "type": "boolean"+ },+ "dueDateReminderLeadTimeMinutes": {+ "type": "integer",+ "minimum": 5,+ "maximum": 43200,+ "description": "Between 5 minutes and 30 days."+ }+ }+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "The updated preferences","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/NotificationPreferences"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "400": {+ "description": "Invalid request","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "operationId": "getOrganizationInvitation",- "summary": "Get Organization Invitation"+ }}},- "/auth/organization/reject-invitation": {- "post": {+ "/notification-preferences/workspaces/{workspaceId}": {+ "put": {+ "operationId": "upsertNotificationPreferenceWorkspaceRule","tags": [- "Organization Management"+ "Notification Preferences"],- "description": "Reject an invitation to an organization",- "security": [+ "summary": "Upsert workspace rule",+ "description": "Create or replace the notification rule for one workspace, overriding the global settings there.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "workspaceId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -11730,407 +10010,471 @@"schema": {"type": "object","properties": {- "invitationId": {+ "isActive": {+ "type": "boolean"+ },+ "emailEnabled": {+ "type": "boolean"+ },+ "ntfyEnabled": {+ "type": "boolean"+ },+ "gotifyEnabled": {+ "type": "boolean"+ },+ "webhookEnabled": {+ "type": "boolean"+ },+ "projectMode": {"type": "string",- "description": "The ID of the invitation to reject"+ "enum": [+ "all",+ "selected"+ ]+ },+ "selectedProjectIds": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Required in practice when projectMode is `selected`."}},"required": [- "invitationId"+ "isActive",+ "emailEnabled",+ "ntfyEnabled",+ "gotifyEnabled",+ "webhookEnabled",+ "projectMode"]}}}- },+ },+ "responses": {+ "200": {+ "description": "The updated preferences",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/NotificationPreferences"+ }+ }+ }+ },+ "400": {+ "description": "Invalid request",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteNotificationPreferenceWorkspaceRule",+ "tags": [+ "Notification Preferences"+ ],+ "summary": "Delete workspace rule",+ "description": "Remove a workspace's rule so the workspace falls back to the global settings.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "workspaceId",+ "in": "path"+ }+ ],"responses": {"200": {- "description": "Success",+ "description": "The updated preferences","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "invitation": {- "type": "object"- },- "member": {- "type": "object",- "nullable": true- }- }+ "$ref": "#/components/schemas/NotificationPreferences"}}}},- "400": {+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "404": {+ "description": "Workspace rule not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}+ }+ }+ }+ }+ },+ "/search": {+ "get": {+ "operationId": "globalSearch",+ "tags": [+ "Search"+ ],+ "summary": "Global search",+ "description": "Search across tasks, projects, workspaces, comments, and activities in one workspace. Results are ranked by relevance and returned as a single flat list, each entry tagged with its `type`.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1},- "description": "Unauthorized. Due to missing or invalid authentication."+ "required": true,+ "name": "q",+ "in": "query"},- "403": {+ {+ "schema": {+ "type": "string",+ "enum": [+ "all",+ "tasks",+ "projects",+ "workspaces",+ "comments",+ "activities"+ ],+ "default": "all"+ },+ "required": false,+ "name": "type",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "minLength": 1+ },+ "required": true,+ "name": "workspaceId",+ "in": "query"+ },+ {+ "schema": {+ "type": "string"+ },+ "required": false,+ "name": "projectId",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "default": "20"+ },+ "required": false,+ "name": "limit",+ "in": "query"+ },+ {+ "schema": {+ "type": "string",+ "format": "email"+ },+ "required": false,+ "name": "userEmail",+ "in": "query"+ }+ ],+ "responses": {+ "200": {+ "description": "Ranked search results","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/SearchResponse"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "400": {+ "description": "Invalid query, or workspace ID could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "429": {+ "403": {+ "description": "No access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {+ }+ }+ }+ }+ },+ "/github-integration/app-info": {+ "get": {+ "operationId": "getGitHubAppInfo",+ "tags": [+ "GitHub"+ ],+ "summary": "Get GitHub app info",+ "description": "Get the GitHub App this instance is configured with, so the client can build an install link.",+ "responses": {+ "200": {+ "description": "GitHub app information","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GitHubAppInfo"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "operationId": "rejectOrganizationInvitation",- "summary": "Reject Organization Invitation"+ }}},- "/auth/organization/list-invitations": {+ "/github-integration/repositories/{projectId}": {"get": {+ "operationId": "listGitHubRepositories","tags": [- "Organization Management"+ "GitHub"],- "security": [+ "summary": "List GitHub repositories",+ "description": "List the repositories reachable through the installed GitHub App, for picking one to link.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"responses": {- "400": {+ "200": {+ "description": "Repositories reachable through the installed App","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/GitHubRepositoryList"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ }+ }+ }+ }+ },+ "/github-integration/verify": {+ "post": {+ "operationId": "verifyGitHubInstallation",+ "tags": [+ "GitHub"+ ],+ "summary": "Verify GitHub installation",+ "description": "Check that the GitHub App is installed on a repository and holds the permissions Kaneo needs. Always 200 -- problems are reported in the body so the client can guide the user.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "projectId": {+ "type": "string",+ "minLength": 1+ },+ "repositoryOwner": {+ "type": "string",+ "minLength": 1+ },+ "repositoryName": {+ "type": "string",+ "minLength": 1+ }+ },+ "required": [+ "projectId",+ "repositoryOwner",+ "repositoryName"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Verification result","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GitHubVerificationResult"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganizationInvitations",- "summary": "List Organization Invitations"+ }}},- "/auth/organization/get-active-member": {+ "/github-integration/project/{projectId}": {"get": {+ "operationId": "getGitHubIntegration","tags": [- "Organization Management"+ "GitHub"],- "description": "Get the member details of the active organization",- "security": [+ "summary": "Get GitHub integration",+ "description": "Get the GitHub integration for a project, or null when none is configured.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"responses": {"200": {- "description": "Success",+ "description": "GitHub integration details, or null","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "userId": {- "type": "string"- },- "organizationId": {- "type": "string"- },- "role": {- "type": "string"- }- },- "required": [- "id",- "userId",- "organizationId",- "role"- ]+ "$ref": "#/components/schemas/GitHubIntegration"}}}},"400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No access to the project's workspace","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "getOrganizationActiveMember",- "summary": "Get Organization Active Member"- }- },- "/auth/organization/check-slug": {+ }+ },"post": {+ "operationId": "createGitHubIntegration","tags": [- "Organization Management"+ "GitHub"],- "security": [+ "summary": "Create GitHub integration",+ "description": "Link a project to a GitHub repository.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -12138,132 +10482,76 @@"schema": {"type": "object","properties": {- "slug": {+ "repositoryOwner": {"type": "string",- "description": "The organization slug to check. Eg: \"my-org\""+ "minLength": 1+ },+ "repositoryName": {+ "type": "string",+ "minLength": 1}},"required": [- "slug"+ "repositoryOwner",+ "repositoryName"]}}}},"responses": {- "400": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."- },- "401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {+ "200": {+ "description": "The stored integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/CreatedGitHubIntegration"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ "401": {+ "description": "Missing or invalid credentials"},- "500": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "checkOrganizationSlug",- "summary": "Check Organization Slug"- }- },- "/auth/organization/remove-member": {- "post": {+ }+ },+ "patch": {+ "operationId": "updateGitHubIntegration","tags": [- "Organization Management"+ "GitHub"],- "description": "Remove a member from an organization",- "security": [+ "summary": "Update GitHub integration",+ "description": "Update the GitHub integration. Omitted fields keep their current value.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -12271,176 +10559,143 @@"schema": {"type": "object","properties": {- "memberIdOrEmail": {- "type": "string",- "description": "The ID or email of the member to remove"+ "isActive": {+ "type": "boolean"},- "organizationId": {- "type": "string",- "description": "The ID of the organization to remove the member from. If not provided, the active organization will be used. Eg: \"org-id\"",- "nullable": true+ "commentTaskLinkOnGitHubIssue": {+ "type": "boolean"}- },- "required": [- "memberIdOrEmail"- ]+ }}}}},"responses": {"200": {- "description": "Success",+ "description": "The updated integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "member": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "userId": {- "type": "string"- },- "organizationId": {- "type": "string"- },- "role": {- "type": "string"- }- },- "required": [- "id",- "userId",- "organizationId",- "role"- ]- }- },- "required": [- "member"- ]+ "$ref": "#/components/schemas/GitHubIntegration"}}}},"400": {+ "description": "The resulting config failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Integration not found","content": {"application/json": {"schema": {"type": "object","properties": {- "message": {+ "error": {"type": "string"}},"required": [- "message"+ "error"]}}+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteGitHubIntegration",+ "tags": [+ "GitHub"+ ],+ "summary": "Delete GitHub integration",+ "description": "Unlink a project from its GitHub repository.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The integration was removed","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GitHubDeleteResult"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "429": {+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "404": {+ "description": "GitHub integration not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "removeOrganizationMember",- "summary": "Remove Organization Member"+ }}},- "/auth/organization/update-member-role": {+ "/github-integration/import-issues": {"post": {+ "operationId": "importGitHubIssues","tags": [- "Organization Management"- ],- "description": "Update the role of a member in an organization",- "operationId": "updateOrganizationMemberRole",- "security": [- {- "bearerAuth": []- }+ "GitHub"],- "parameters": [],+ "summary": "Import GitHub issues",+ "description": "Import the linked repository's issues as tasks. Issues that already have a task are skipped.","requestBody": {"required": true,"content": {@@ -12448,23 +10703,12 @@"schema": {"type": "object","properties": {- "role": {- "type": "string",- "description": "The new role to be applied. This can be a string or array of strings representing the roles. Eg: [\"admin\", \"sale\"]"- },- "memberId": {- "type": "string",- "description": "The member id to apply the role update to. Eg: \"member-id\""- },- "organizationId": {- "type": "string",- "description": "An optional organization ID which the member is a part of to apply the role update. If not provided, you must provide session headers to get the active organization. Eg: \"organization-id\"",- "nullable": true+ "projectId": {+ "type": "string"}},"required": [- "role",- "memberId"+ "projectId"]}}@@ -12472,154 +10716,59 @@},"responses": {"200": {- "description": "Success",+ "description": "Import summary","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "member": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "userId": {- "type": "string"- },- "organizationId": {- "type": "string"- },- "role": {- "type": "string"- }- },- "required": [- "id",- "userId",- "organizationId",- "role"- ]- }- },- "required": [- "member"- ]+ "$ref": "#/components/schemas/IssueImportResult"}}}},- "400": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."- },- "401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "400": {+ "description": "projectId is required","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "429": {+ "403": {+ "description": "No workspace access, or missing task:create permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "404": {+ "description": "Project not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "summary": "Update Organization Member Role"+ }}},- "/auth/organization/leave": {+ "/gitea-integration/repositories": {"post": {+ "operationId": "listGiteaRepositories","tags": [- "Organization Management"- ],- "security": [- {- "bearerAuth": []- }+ "Gitea"],- "parameters": [],+ "summary": "List Gitea repositories",+ "description": "List the repositories a Gitea token can reach, for picking one to link. Sent as a POST because the token travels in the body rather than the URL.","requestBody": {"required": true,"content": {@@ -12627,531 +10776,586 @@"schema": {"type": "object","properties": {- "organizationId": {+ "projectId": {"type": "string",- "description": "The organization Id for the member to leave. Eg: \"organization-id\""+ "minLength": 1+ },+ "baseUrl": {+ "type": "string",+ "format": "uri"+ },+ "accessToken": {+ "type": "string",+ "minLength": 1}},"required": [- "organizationId"+ "projectId",+ "baseUrl",+ "accessToken"]}}}},"responses": {- "400": {+ "200": {+ "description": "Accessible repositories","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/GiteaRepositoryList"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ }+ }+ }+ }+ },+ "/gitea-integration/verify": {+ "post": {+ "operationId": "verifyGiteaAccess",+ "tags": [+ "Gitea"+ ],+ "summary": "Verify Gitea access",+ "description": "Check that the base URL is a Gitea instance and that the token can reach the repository with the permissions Kaneo needs. Always 200 -- problems are reported in the body.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "projectId": {+ "type": "string",+ "minLength": 1+ },+ "baseUrl": {+ "type": "string",+ "format": "uri"+ },+ "accessToken": {+ "type": "string",+ "minLength": 1+ },+ "repositoryOwner": {+ "type": "string",+ "minLength": 1+ },+ "repositoryName": {+ "type": "string",+ "minLength": 1+ }+ },+ "required": [+ "projectId",+ "baseUrl",+ "accessToken",+ "repositoryOwner",+ "repositoryName"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "Verification result","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GiteaVerificationResult"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "leaveOrganization",- "summary": "Leave Organization"+ }}},- "/auth/organization/list-user-invitations": {+ "/gitea-integration/project/{projectId}": {"get": {+ "operationId": "getGiteaIntegration","tags": [- "Organization Management"+ "Gitea"],- "description": "List all invitations a user has received",- "security": [+ "summary": "Get Gitea integration",+ "description": "Get the Gitea integration for a project, or null when none is configured. The webhook secret is included only for callers with workspace:manage_settings.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"responses": {"200": {- "description": "Success",- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string"- },- "email": {- "type": "string"- },- "role": {- "type": "string"- },- "organizationId": {- "type": "string"- },- "organizationName": {- "type": "string"- },- "inviterId": {- "type": "string",- "description": "The ID of the user who created the invitation"- },- "teamId": {- "type": "string",- "description": "The ID of the team associated with the invitation",- "nullable": true- },- "status": {- "type": "string"- },- "expiresAt": {- "type": "string"- },- "createdAt": {- "type": "string"- }- },- "required": [- "id",- "email",- "role",- "organizationId",- "organizationName",- "inviterId",- "status",- "expiresAt",- "createdAt"- ]- }- }- }- }- },- "400": {+ "description": "Gitea integration details, or null","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/GiteaIntegration"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No access to the project's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "post": {+ "operationId": "createGiteaIntegration",+ "tags": [+ "Gitea"+ ],+ "summary": "Create Gitea integration",+ "description": "Link a project to a Gitea repository, creating the webhook Gitea will post events to.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "baseUrl": {+ "type": "string",+ "minLength": 1+ },+ "accessToken": {+ "type": "string",+ "description": "Omit to keep the token already stored for this project."+ },+ "repositoryOwner": {+ "type": "string",+ "minLength": 1+ },+ "repositoryName": {+ "type": "string",+ "minLength": 1+ }+ },+ "required": [+ "baseUrl",+ "repositoryOwner",+ "repositoryName"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "The stored integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GiteaIntegration"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganizationUserInvitations",- "summary": "List Organization User Invitations"- }- },- "/auth/organization/list-members": {- "get": {+ }+ },+ "patch": {+ "operationId": "updateGiteaIntegration","tags": [- "Organization Management"+ "Gitea"],- "security": [+ "summary": "Update Gitea integration",+ "description": "Update the Gitea integration. Omitted fields keep their current value.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "isActive": {+ "type": "boolean"+ },+ "commentTaskLinkOnGiteaIssue": {+ "type": "boolean"+ }+ }+ }+ }+ }+ },"responses": {- "400": {+ "200": {+ "description": "The updated integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/GiteaIntegration"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }+ },+ "400": {+ "description": "The resulting config failed validation",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Integration not found","content": {"application/json": {"schema": {"type": "object","properties": {- "message": {+ "error": {"type": "string"}},"required": [- "message"+ "error"]}}+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteGiteaIntegration",+ "tags": [+ "Gitea"+ ],+ "summary": "Delete Gitea integration",+ "description": "Unlink a project from its Gitea repository.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The integration was removed","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GiteaDeleteResult"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "404": {+ "description": "Gitea integration not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganizationMembers",- "summary": "List Organization Members"+ }}},- "/auth/organization/get-active-member-role": {- "get": {+ "/gitea-integration/import-issues": {+ "post": {+ "operationId": "importGiteaIssues","tags": [- "Organization Management"+ "Gitea"],- "security": [- {- "bearerAuth": []+ "summary": "Import Gitea issues",+ "description": "Import the linked repository's issues as tasks. Issues that already have a task are refreshed rather than duplicated.",+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "projectId": {+ "type": "string"+ }+ },+ "required": [+ "projectId"+ ]+ }+ }}- ],- "parameters": [],+ },"responses": {- "400": {+ "200": {+ "description": "Import summary","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/GiteaImportResult"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "projectId is required","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing task:create permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},"404": {+ "description": "Project not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/generic-webhook-integration/project/{projectId}": {+ "get": {+ "operationId": "getGenericWebhookIntegration",+ "tags": [+ "Generic Webhook"+ ],+ "summary": "Get webhook integration",+ "description": "Get the outgoing webhook integration for a project, or null when none is configured.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Not Found. The requested resource was not found."- },- "429": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Webhook integration details, or null","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/GenericWebhookIntegration"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }}- },- "operationId": "getOrganizationActiveMemberRole",- "summary": "Get Organization Active Member Role"- }- },- "/auth/organization/create-team": {+ }+ },"post": {+ "operationId": "createGenericWebhookIntegration","tags": [- "Organization Management"+ "Generic Webhook"],- "description": "Create a new team within an organization",- "security": [+ "summary": "Create webhook integration",+ "description": "Create or replace the outgoing webhook for a project. Kaneo POSTs the selected task events to this URL, signed with the secret when one is set.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -13159,18 +11363,64 @@"schema": {"type": "object","properties": {- "name": {+ "webhookUrl": {"type": "string",- "description": "The name of the team. Eg: \"my-team\""+ "minLength": 1},- "organizationId": {+ "secret": {"type": "string",- "description": "The organization ID which the team will be created in. Defaults to the active organization. Eg: \"organization-id\"",- "nullable": true+ "description": "Optional HMAC secret used to sign outgoing deliveries."+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ },+ "taskDeleted": {+ "type": "boolean"+ },+ "taskMoved": {+ "type": "boolean"+ },+ "taskDueDateChanged": {+ "type": "boolean"+ },+ "taskAssigneeChanged": {+ "type": "boolean"+ },+ "taskUnassigned": {+ "type": "boolean"+ },+ "dueDateReminder": {+ "type": "boolean"+ }+ }+ },+ "dueDateReminderLeadTimeMinutes": {+ "type": "integer",+ "minimum": 5,+ "maximum": 43200,+ "description": "Between 5 minutes and 30 days."}},"required": [- "name"+ "webhookUrl"]}}@@ -13178,318 +11428,318 @@},"responses": {"200": {- "description": "Team created successfully",+ "description": "The stored integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string",- "description": "Unique identifier of the created team"- },- "name": {- "type": "string",- "description": "Name of the team"- },- "organizationId": {- "type": "string",- "description": "ID of the organization the team belongs to"- },- "createdAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team was created"- },- "updatedAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team was last updated"+ "$ref": "#/components/schemas/GenericWebhookIntegration"+ }+ }+ }+ },+ "400": {+ "description": "The webhook URL failed validation",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ },+ "patch": {+ "operationId": "updateGenericWebhookIntegration",+ "tags": [+ "Generic Webhook"+ ],+ "summary": "Update webhook integration",+ "description": "Update the outgoing webhook. Omitted fields keep their current value, event toggles merge into the existing set, and a null secret clears it.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "webhookUrl": {+ "type": "string"+ },+ "secret": {+ "type": [+ "string",+ "null"+ ],+ "description": "Send null to remove the signing secret."+ },+ "isActive": {+ "type": "boolean"+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ },+ "taskDeleted": {+ "type": "boolean"+ },+ "taskMoved": {+ "type": "boolean"+ },+ "taskDueDateChanged": {+ "type": "boolean"+ },+ "taskAssigneeChanged": {+ "type": "boolean"+ },+ "taskUnassigned": {+ "type": "boolean"+ },+ "dueDateReminder": {+ "type": "boolean"+ }}},- "required": [- "id",- "name",- "organizationId",- "createdAt",- "updatedAt"- ]+ "dueDateReminderLeadTimeMinutes": {+ "type": "integer",+ "minimum": 5,+ "maximum": 43200,+ "description": "Between 5 minutes and 30 days."+ }}}}- },- "400": {+ }+ },+ "responses": {+ "200": {+ "description": "The updated integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/GenericWebhookIntegration"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "The resulting config failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},"404": {+ "description": "Webhook integration not found","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "createOrganizationTeam",- "summary": "Create Organization Team"- }- },- "/auth/organization/list-teams": {- "get": {+ }+ },+ "delete": {+ "operationId": "deleteGenericWebhookIntegration","tags": [- "Organization Management"+ "Generic Webhook"],- "description": "List all teams in an organization",- "security": [+ "summary": "Delete webhook integration",+ "description": "Remove the outgoing webhook from a project.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"responses": {"200": {- "description": "Teams retrieved successfully",+ "description": "The integration was removed","content": {"application/json": {"schema": {- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "type": "string",- "description": "Unique identifier of the team"- },- "name": {- "type": "string",- "description": "Name of the team"- },- "organizationId": {- "type": "string",- "description": "ID of the organization the team belongs to"- },- "createdAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team was created"- },- "updatedAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team was last updated"- }- },- "required": [- "id",- "name",- "organizationId",- "createdAt",- "updatedAt"- ]+ "type": "object",+ "properties": {+ "success": {+ "type": "boolean"+ }},- "description": "Array of team objects within the organization"+ "required": [+ "success"+ ]}}}},"400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Webhook integration not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/discord-integration/project/{projectId}": {+ "get": {+ "operationId": "getDiscordIntegration",+ "tags": [+ "Discord"+ ],+ "summary": "Get Discord integration",+ "description": "Get the Discord integration for a project, or null when none is configured.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Discord integration details, or null","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/DiscordIntegration"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No access to the project's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganizationTeams",- "summary": "List Organization Teams"- }- },- "/auth/organization/remove-team": {+ }+ },"post": {+ "operationId": "createDiscordIntegration","tags": [- "Organization Management"+ "Discord"],- "description": "Remove a team from an organization",- "security": [+ "summary": "Create Discord integration",+ "description": "Create or replace the Discord integration for a project. The webhook URL is verified before it is stored.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -13497,18 +11747,39 @@"schema": {"type": "object","properties": {- "teamId": {+ "webhookUrl": {"type": "string",- "description": "The team ID of the team to remove. Eg: \"team-id\""+ "minLength": 1},- "organizationId": {- "type": "string",- "description": "The organization ID which the team falls under. If not provided, it will default to the user's active organization. Eg: \"organization-id\"",- "nullable": true+ "channelName": {+ "type": "string"+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ }+ }}},"required": [- "teamId"+ "webhookUrl"]}}@@ -13516,140 +11787,57 @@},"responses": {"200": {- "description": "Team removed successfully",+ "description": "The stored integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string",- "description": "Confirmation message indicating successful removal",- "enum": [- "Team removed successfully."- ]- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/DiscordIntegration"}}}},"400": {+ "description": "The webhook URL failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "removeOrganizationTeam",- "summary": "Remove Organization Team"- }- },- "/auth/organization/update-team": {- "post": {+ }+ },+ "patch": {+ "operationId": "updateDiscordIntegration","tags": [- "Organization Management"+ "Discord"],- "description": "Update an existing team in an organization",- "security": [+ "summary": "Update Discord integration",+ "description": "Update the Discord integration. Omitted fields keep their current value, and event toggles are merged into the existing set.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -13657,199 +11845,235 @@"schema": {"type": "object","properties": {- "teamId": {- "type": "string",- "description": "The ID of the team to be updated. Eg: \"team-id\""+ "webhookUrl": {+ "type": "string"},- "data": {+ "channelName": {+ "type": [+ "string",+ "null"+ ]+ },+ "isActive": {+ "type": "boolean"+ },+ "events": {"type": "object","properties": {- "id": {- "type": "string",- "nullable": true+ "taskCreated": {+ "type": "boolean"},- "name": {- "type": "string",- "nullable": true+ "taskStatusChanged": {+ "type": "boolean"},- "organizationId": {- "type": "string",- "nullable": true+ "taskPriorityChanged": {+ "type": "boolean"},- "createdAt": {- "type": "string",- "nullable": true+ "taskTitleChanged": {+ "type": "boolean"},- "updatedAt": {- "type": "string",- "nullable": true+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"}}}- },- "required": [- "teamId",- "data"- ]+ }}}}},"responses": {"200": {- "description": "Team updated successfully",+ "description": "The updated integration","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "id": {- "type": "string",- "description": "Unique identifier of the updated team"- },- "name": {- "type": "string",- "description": "Updated name of the team"- },- "organizationId": {- "type": "string",- "description": "ID of the organization the team belongs to"- },- "createdAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team was created"- },- "updatedAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team was last updated"- }- },- "required": [- "id",- "name",- "organizationId",- "createdAt",- "updatedAt"- ]+ "$ref": "#/components/schemas/DiscordIntegration"}}}},"400": {+ "description": "The resulting config failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "404": {+ "description": "Discord integration not found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteDiscordIntegration",+ "tags": [+ "Discord"+ ],+ "summary": "Delete Discord integration",+ "description": "Remove the Discord integration from a project.",+ "parameters": [+ {+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The integration was removed","content": {"application/json": {"schema": {"type": "object","properties": {- "message": {- "type": "string"+ "success": {+ "type": "boolean"}},"required": [- "message"+ "success"]}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "400": {+ "description": "Unknown project, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},"404": {+ "description": "Discord integration not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/slack-integration/project/{projectId}": {+ "get": {+ "operationId": "getSlackIntegration",+ "tags": [+ "Slack"+ ],+ "summary": "Get Slack integration",+ "description": "Get the Slack integration for a project, or null when none is configured.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Not Found. The requested resource was not found."- },- "429": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Slack integration details, or null","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/SlackIntegration"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }}- },- "operationId": "updateOrganizationTeam",- "summary": "Update Organization Team"- }- },- "/auth/organization/set-active-team": {+ }+ },"post": {+ "operationId": "createSlackIntegration","tags": [- "Organization Management"+ "Slack"],- "description": "Set the active team for the current active organization",- "security": [+ "summary": "Create Slack integration",+ "description": "Create or replace the Slack integration for a project. The webhook URL is verified before it is stored.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -13857,433 +12081,440 @@"schema": {"type": "object","properties": {- "teamId": {+ "webhookUrl": {"type": "string",- "nullable": true+ "minLength": 1+ },+ "channelName": {+ "type": "string"+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ }+ }}- }+ },+ "required": [+ "webhookUrl"+ ]}}}},"responses": {"200": {- "description": "Success",+ "description": "The stored integration","content": {"application/json": {"schema": {- "allOf": [- {- "$ref": "#/components/schemas/Team"- }- ],- "type": "object",- "description": "The team"+ "$ref": "#/components/schemas/SlackIntegration"}}}},"400": {+ "description": "The webhook URL failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "setOrganizationActiveTeam",- "summary": "Set Organization Active Team"- }- },- "/auth/organization/list-user-teams": {- "get": {+ }+ },+ "patch": {+ "operationId": "updateSlackIntegration","tags": [- "Organization Management"+ "Slack"],- "description": "List all teams that the current user is a part of.",- "security": [+ "summary": "Update Slack integration",+ "description": "Update the Slack integration. Omitted fields keep their current value, and event toggles are merged into the existing set.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "webhookUrl": {+ "type": "string"+ },+ "channelName": {+ "type": [+ "string",+ "null"+ ]+ },+ "isActive": {+ "type": "boolean"+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ }+ }+ }+ }+ }+ }}- ],- "parameters": [],+ },"responses": {"200": {- "description": "Teams retrieved successfully",+ "description": "The updated integration","content": {"application/json": {"schema": {- "type": "array",- "items": {- "allOf": [- {- "$ref": "#/components/schemas/Team"- }- ],- "type": "object",- "description": "The team"- },- "description": "Array of team objects within the organization"+ "$ref": "#/components/schemas/SlackIntegration"}}}},"400": {+ "description": "The resulting config failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Slack integration not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "delete": {+ "operationId": "deleteSlackIntegration",+ "tags": [+ "Slack"+ ],+ "summary": "Delete Slack integration",+ "description": "Remove the Slack integration from a project.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The integration was removed","content": {"application/json": {"schema": {"type": "object","properties": {- "message": {- "type": "string"+ "success": {+ "type": "boolean"}- }+ },+ "required": [+ "success"+ ]}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "404": {+ "description": "Slack integration not found",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }}- },- "operationId": "listOrganizationUserTeams",- "summary": "List Organization User Teams"+ }}},- "/auth/organization/list-team-members": {+ "/telegram-integration/project/{projectId}": {"get": {+ "operationId": "getTelegramIntegration","tags": [- "Organization Management"+ "Telegram"],- "description": "List the members of the given team.",- "security": [+ "summary": "Get Telegram integration",+ "description": "Get the Telegram integration for a project, or null when none is configured.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"responses": {"200": {- "description": "Teams retrieved successfully",+ "description": "Telegram integration details, or null","content": {"application/json": {"schema": {- "type": "array",- "items": {- "type": "object",- "description": "The team member",- "properties": {- "id": {- "type": "string",- "description": "Unique identifier of the team member"- },- "userId": {- "type": "string",- "description": "The user ID of the team member"- },- "teamId": {- "type": "string",- "description": "The team ID of the team the team member is in"- },- "createdAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team member was created"- }- },- "required": [- "id",- "userId",- "teamId",- "createdAt"- ]- },- "description": "Array of team member objects within the team"+ "$ref": "#/components/schemas/TelegramIntegration"}}}},"400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No access to the project's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ },+ "post": {+ "operationId": "createTelegramIntegration",+ "tags": [+ "Telegram"+ ],+ "summary": "Create Telegram integration",+ "description": "Create or replace the Telegram integration for a project. The bot token and chat are verified with Telegram before they are stored.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "botToken": {+ "type": "string",+ "minLength": 1,+ "description": "A Telegram bot token, in the form 123456789:AA..."+ },+ "chatId": {+ "type": "string",+ "minLength": 1+ },+ "threadId": {+ "type": "number"+ },+ "chatLabel": {+ "type": "string"+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ }}}+ },+ "required": [+ "botToken",+ "chatId"+ ]+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "The stored integration",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TelegramIntegration"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "The bot token or chat failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganizationTeamMembers",- "summary": "List Organization Team Members"- }- },- "/auth/organization/add-team-member": {- "post": {+ }+ },+ "patch": {+ "operationId": "updateTelegramIntegration","tags": [- "Organization Management"+ "Telegram"],- "description": "The newly created member",- "security": [+ "summary": "Update Telegram integration",+ "description": "Update the Telegram integration. Omitted fields keep their current value; threadId and chatLabel accept null to clear them.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],"requestBody": {"required": true,"content": {@@ -14291,342 +12522,239 @@"schema": {"type": "object","properties": {- "teamId": {- "type": "string",- "description": "The team the user should be a member of."+ "botToken": {+ "type": "string"},- "userId": {- "type": "string",- "description": "The user Id which represents the user to be added as a member."+ "chatId": {+ "type": "string"},- "organizationId": {- "type": "string",- "description": "The organization ID which the team falls under. If not provided, it will default to the user's active organization.",- "nullable": true+ "threadId": {+ "type": [+ "number",+ "null"+ ]+ },+ "chatLabel": {+ "type": [+ "string",+ "null"+ ]+ },+ "isActive": {+ "type": "boolean"+ },+ "events": {+ "type": "object",+ "properties": {+ "taskCreated": {+ "type": "boolean"+ },+ "taskStatusChanged": {+ "type": "boolean"+ },+ "taskPriorityChanged": {+ "type": "boolean"+ },+ "taskTitleChanged": {+ "type": "boolean"+ },+ "taskDescriptionChanged": {+ "type": "boolean"+ },+ "taskCommentCreated": {+ "type": "boolean"+ }+ }}- },- "required": [- "teamId",- "userId"- ]+ }}}}},"responses": {"200": {- "description": "Team member created successfully",+ "description": "The updated integration","content": {"application/json": {"schema": {- "type": "object",- "description": "The team member",- "properties": {- "id": {- "type": "string",- "description": "Unique identifier of the team member"- },- "userId": {- "type": "string",- "description": "The user ID of the team member"- },- "teamId": {- "type": "string",- "description": "The team ID of the team the team member is in"- },- "createdAt": {- "type": "string",- "format": "date-time",- "description": "Timestamp when the team member was created"- }- },- "required": [- "id",- "userId",- "teamId",- "createdAt"- ]+ "$ref": "#/components/schemas/TelegramIntegration"}}}},"400": {+ "description": "The resulting config failed validation","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},"404": {+ "description": "Telegram integration not found","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "addOrganizationTeamMember",- "summary": "Add Organization Team Member"- }- },- "/auth/organization/remove-team-member": {- "post": {+ }+ },+ "delete": {+ "operationId": "deleteTelegramIntegration","tags": [- "Organization Management"+ "Telegram"],- "description": "Remove a member from a team",- "security": [+ "summary": "Delete Telegram integration",+ "description": "Remove the Telegram integration from a project.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "teamId": {- "type": "string",- "description": "The team the user should be removed from."- },- "userId": {- "type": "string",- "description": "The user which should be removed from the team."- },- "organizationId": {- "type": "string",- "description": "The organization ID which the team falls under. If not provided, it will default to the user's active organization.",- "nullable": true- }- },- "required": [- "teamId",- "userId"- ]- }- }- }- },"responses": {"200": {- "description": "Team member removed successfully",+ "description": "The integration was removed","content": {"application/json": {"schema": {"type": "object","properties": {- "message": {- "type": "string",- "description": "Confirmation message indicating successful removal",- "enum": [- "Team member removed successfully."- ]+ "success": {+ "type": "boolean"}},"required": [- "message"+ "success"]}}}},"400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No workspace access, or missing workspace:manage_settings","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }},- "403": {+ "404": {+ "description": "Telegram integration not found","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/task-relation/{taskId}": {+ "get": {+ "operationId": "getTaskRelations",+ "tags": [+ "Task Relations"+ ],+ "summary": "Get task relations",+ "description": "Get every relation where the task is the source or the target, each with a summary of both linked tasks. Relations pointing outside the caller's workspace are omitted.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "taskId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Task relations with the linked task summaries","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/TaskRelationWithTasks"}}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown task, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No access to the task's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "removeOrganizationTeamMember",- "summary": "Remove Organization Team Member"+ }}},- "/auth/organization/create-role": {+ "/task-relation": {"post": {+ "operationId": "createTaskRelation","tags": [- "Organization Management"- ],- "security": [- {- "bearerAuth": []- }+ "Task Relations"],- "parameters": [],+ "summary": "Create task relation",+ "description": "Link two tasks. Authorization is scoped to the source task's workspace.","requestBody": {"required": true,"content": {@@ -14634,616 +12762,531 @@"schema": {"type": "object","properties": {- "organizationId": {- "type": "string",- "nullable": true+ "sourceTaskId": {+ "type": "string"},- "role": {- "type": "string",- "description": "The name of the role to create"+ "targetTaskId": {+ "type": "string"},- "permission": {+ "relationType": {"type": "string",- "description": "The permission to assign to the role"- },- "additionalFields": {- "type": "object",- "properties": {},- "nullable": true+ "enum": [+ "subtask",+ "blocks",+ "related"+ ]}},"required": [- "role",- "permission"+ "sourceTaskId",+ "targetTaskId",+ "relationType"]}}}},"responses": {- "400": {+ "200": {+ "description": "The created relation","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/TaskRelation"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Invalid body, or the relation already exists","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},"404": {+ "description": "Source task not found","content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {- "content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "createOrganizationRole",- "summary": "Create Organization Role"+ }}},- "/auth/organization/delete-role": {- "post": {+ "/task-relation/{id}": {+ "delete": {+ "operationId": "deleteTaskRelation","tags": [- "Organization Management"+ "Task Relations"],- "security": [+ "summary": "Delete task relation",+ "description": "Remove a link between two tasks. Returns the deleted relation.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"}],- "parameters": [],"responses": {- "400": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."- },- "401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "200": {+ "description": "The deleted relation",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/TaskRelation"}}- },- "description": "Not Found. The requested resource was not found."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "429": {+ "403": {+ "description": "No workspace access, or missing task:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "404": {+ "description": "Task relation not found, or its source task is gone","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "deleteOrganizationRole",- "summary": "Delete Organization Role"+ }}},- "/auth/organization/list-roles": {+ "/external-link/task/{taskId}": {"get": {+ "operationId": "getExternalLinksByTask","tags": [- "Organization Management"+ "External Links"],- "security": [+ "summary": "Get task external links",+ "description": "Get all links from a task to resources in connected integrations, such as GitHub or Gitea issues.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "taskId",+ "in": "path"}],- "parameters": [],"responses": {- "400": {+ "200": {+ "description": "External links for the task","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ExternalLink"+ }}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Unknown task, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No access to the task's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/workflow-rule/{projectId}": {+ "get": {+ "operationId": "getWorkflowRules",+ "tags": [+ "Workflow Rules"+ ],+ "summary": "Get workflow rules",+ "description": "Get every workflow rule for a project. A rule moves a task to a column when an integration event fires.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "projectId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "List of workflow rules","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/WorkflowRule"}}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {+ "400": {+ "description": "Unknown project, or its workspace could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {+ "401": {+ "description": "Missing or invalid credentials"+ },+ "403": {+ "description": "No access to the project's workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "listOrganizationRoles",- "summary": "List Organization Roles"- }- },- "/auth/organization/get-role": {- "get": {+ }+ },+ "put": {+ "operationId": "upsertWorkflowRule","tags": [- "Organization Management"+ "Workflow Rules"],- "security": [+ "summary": "Upsert workflow rule",+ "description": "Create a workflow rule, or update the target column of the existing rule for the same integration and event.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "projectId",+ "in": "path"}],- "parameters": [],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "object",+ "properties": {+ "integrationType": {+ "type": "string"+ },+ "eventType": {+ "type": "string"+ },+ "columnId": {+ "type": "string"+ }+ },+ "required": [+ "integrationType",+ "eventType",+ "columnId"+ ]+ }+ }+ }+ },"responses": {- "400": {+ "200": {+ "description": "The created or updated rule","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/WorkflowRuleRow"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},- "401": {+ "400": {+ "description": "Invalid body, or unknown project","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Unauthorized. Due to missing or invalid authentication."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},"403": {+ "description": "No workspace access, or missing project:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}+ }+ }+ }+ }+ },+ "/workflow-rule/{id}": {+ "delete": {+ "operationId": "deleteWorkflowRule",+ "tags": [+ "Workflow Rules"+ ],+ "summary": "Delete workflow rule",+ "description": "Delete a workflow rule. Returns the rule that was removed.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {+ "required": true,+ "name": "id",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "The deleted rule","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/WorkflowRuleRow"}}- },- "description": "Not Found. The requested resource was not found."+ }+ },+ "400": {+ "description": "Unknown rule, or its workspace could not be determined",+ "content": {+ "text/plain": {+ "schema": {+ "type": "string"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials"},- "429": {+ "403": {+ "description": "No workspace access, or missing project:update permission","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."- },- "500": {+ }+ }+ }+ }+ },+ "/invitation/pending": {+ "get": {+ "operationId": "getUserPendingInvitations",+ "tags": [+ "Invitations"+ ],+ "summary": "Get pending invitations",+ "description": "Get the current user's unexpired, unaccepted invitations. Returns an empty list until the user's email is verified.",+ "responses": {+ "200": {+ "description": "List of pending invitations","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/PendingInvitation"}}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }+ },+ "401": {+ "description": "Missing or invalid credentials"}- },- "operationId": "getOrganizationRole",- "summary": "Get Organization Role"+ }}},- "/auth/organization/update-role": {- "post": {+ "/invitation/{id}": {+ "get": {+ "operationId": "getInvitationDetails","tags": [- "Organization Management"+ "Invitations"],- "security": [+ "summary": "Get invitation details",+ "description": "Look up an invitation by ID. Always 200 -- an unusable invitation is reported with valid: false and a reason rather than an error status.",+ "parameters": [{- "bearerAuth": []+ "schema": {+ "type": "string"+ },+ "required": true,+ "name": "id",+ "in": "path"}],- "parameters": [],"responses": {- "400": {+ "200": {+ "description": "Invitation details","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "$ref": "#/components/schemas/InvitationDetails"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }+ "description": "Missing or invalid credentials"+ }+ }+ }+ },+ "/workspace/{workspaceId}/members": {+ "get": {+ "operationId": "getWorkspaceMembers",+ "tags": [+ "Workspaces"+ ],+ "summary": "Get workspace members",+ "description": "Get all members of a workspace, with their role.",+ "parameters": [+ {+ "schema": {+ "type": "string"},- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {+ "required": true,+ "name": "workspaceId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "List of workspace members","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/WorkspaceMember"}}}- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."+ }},- "404": {+ "400": {+ "description": "Workspace ID could not be determined","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Not Found. The requested resource was not found."+ }},- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ "401": {+ "description": "Missing or invalid credentials"},- "500": {+ "403": {+ "description": "No access to the workspace","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "type": "string"}}- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ }}- },- "operationId": "updateOrganizationRole",- "summary": "Update Organization Role"+ }}},- "/auth/organization/has-permission": {- "post": {+ "/user/avatar": {+ "put": {+ "operationId": "uploadUserAvatar","tags": [- "Organization Management"- ],- "description": "Check if the user has permission",- "security": [- {- "bearerAuth": []- }+ "User"],- "parameters": [],+ "summary": "Upload avatar",+ "description": "Store a base64 encoded avatar (PNG, JPEG, or WebP, up to 512KB) for the current user and return its public URL. Replaces any existing avatar.","requestBody": {+ "required": true,"content": {"application/json": {"schema": {"type": "object","properties": {- "permission": {- "type": "object",- "description": "The permission to check",- "deprecated": true+ "contentType": {+ "type": "string",+ "description": "One of image/png, image/jpeg, or image/webp.",+ "example": "image/png"},- "permissions": {- "type": "object",- "description": "The permission to check"+ "data": {+ "type": "string",+ "description": "Base64 encoded image bytes."}},"required": [- "permissions"+ "contentType",+ "data"]}}@@ -15251,131 +13294,54 @@},"responses": {"200": {- "description": "Success",+ "description": "Avatar stored","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "error": {- "type": "string"- },- "success": {- "type": "boolean"- }- },- "required": [- "success"- ]+ "$ref": "#/components/schemas/UserAvatar"}}}},"400": {+ "description": "Unsupported content type, malformed base64, or too large","content": {- "application/json": {+ "text/plain": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]+ "type": "string"}}- },- "description": "Bad Request. Usually due to missing parameters, or invalid parameters."+ }},"401": {+ "description": "Missing or invalid credentials"+ }+ }+ },+ "delete": {+ "operationId": "deleteUserAvatar",+ "tags": [+ "User"+ ],+ "summary": "Delete avatar",+ "description": "Remove the uploaded avatar of the current user. Succeeds even when there was nothing to remove.",+ "responses": {+ "200": {+ "description": "Avatar removed","content": {"application/json": {"schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- },- "required": [- "message"- ]- }- }- },- "description": "Unauthorized. Due to missing or invalid authentication."- },- "403": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Forbidden. You do not have permission to access this resource or to perform this action."- },- "404": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Not Found. The requested resource was not found."- },- "429": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }+ "$ref": "#/components/schemas/UserAvatarDeleted"}}- },- "description": "Too Many Requests. You have exceeded the rate limit. Try again later."+ }},- "500": {- "content": {- "application/json": {- "schema": {- "type": "object",- "properties": {- "message": {- "type": "string"- }- }- }- }- },- "description": "Internal Server Error. This is a problem with the server that you cannot fix."+ "401": {+ "description": "Missing or invalid credentials"}- },- "operationId": "hasOrganizationPermission",- "summary": "Check Organization Permission"+ }}}},- "tags": [- {- "name": "Organization Management"- }- ]+ "webhooks": {}}diff --git a/apps/web/src/fetchers/billing/get-billing.ts b/apps/web/src/fetchers/billing/get-billing.tsindex b8baad36f..207247c29 100644--- a/apps/web/src/fetchers/billing/get-billing.ts+++ b/apps/web/src/fetchers/billing/get-billing.ts@@ -2,7 +2,8 @@ import { client } from "@kaneo/libs";import type { InferResponseType } from "hono/client";export type GetBillingResponse = InferResponseType<- (typeof client)["billing"][":workspaceId"]["$get"]+ (typeof client)["billing"][":workspaceId"]["$get"],+ 200>;export async function getBilling(workspaceId: string) {diff --git a/apps/web/src/fetchers/config/get-config.ts b/apps/web/src/fetchers/config/get-config.tsindex c7c906172..16f777a97 100644--- a/apps/web/src/fetchers/config/get-config.ts+++ b/apps/web/src/fetchers/config/get-config.ts@@ -2,7 +2,8 @@ import { client } from "@kaneo/libs";import type { InferResponseType } from "hono/client";export type GetConfigResponse = InferResponseType<- (typeof client)["config"]["$get"]+ (typeof client)["config"]["$get"],+ 200>;export async function getConfig() {diff --git a/apps/web/src/fetchers/github-integration/get-app-info.ts b/apps/web/src/fetchers/github-integration/get-app-info.tsindex 4681a6233..4b7353c3d 100644--- a/apps/web/src/fetchers/github-integration/get-app-info.ts+++ b/apps/web/src/fetchers/github-integration/get-app-info.ts@@ -2,7 +2,8 @@ import { client } from "@kaneo/libs";import type { InferResponseType } from "hono";export type GitHubAppInfo = InferResponseType<- (typeof client)["github-integration"]["app-info"]["$get"]+ (typeof client)["github-integration"]["app-info"]["$get"],+ 200>;export default async function getGitHubAppInfo(): Promise<GitHubAppInfo> {diff --git a/apps/web/src/fetchers/github-integration/list-repositories.ts b/apps/web/src/fetchers/github-integration/list-repositories.tsindex f4eb25dc1..468400240 100644--- a/apps/web/src/fetchers/github-integration/list-repositories.ts+++ b/apps/web/src/fetchers/github-integration/list-repositories.ts@@ -2,7 +2,8 @@ import { client } from "@kaneo/libs";import type { InferResponseType } from "hono";export type ListRepositoriesResponse = InferResponseType<- (typeof client)["github-integration"]["repositories"][":projectId"]["$get"]+ (typeof client)["github-integration"]["repositories"][":projectId"]["$get"],+ 200>;async function listRepositories(diff --git a/apps/web/src/fetchers/oauth/get-id-token.ts b/apps/web/src/fetchers/oauth/get-id-token.tsindex 083227f34..936d07de5 100644--- a/apps/web/src/fetchers/oauth/get-id-token.ts+++ b/apps/web/src/fetchers/oauth/get-id-token.ts@@ -2,7 +2,8 @@ import { client } from "@kaneo/libs";import type { InferResponseType } from "hono/client";export type GetIdTokenResponse = InferResponseType<- (typeof client)["oauth"]["id-token"]["$get"]+ (typeof client)["oauth"]["id-token"]["$get"],+ 200>;export async function getIdToken() {diff --git a/apps/web/src/fetchers/task/get-tasks.ts b/apps/web/src/fetchers/task/get-tasks.tsindex c87f8ea76..b00eb5a02 100644--- a/apps/web/src/fetchers/task/get-tasks.ts+++ b/apps/web/src/fetchers/task/get-tasks.ts@@ -3,6 +3,8 @@ import { client } from "@kaneo/libs";async function getTasks(projectId: string) {const response = await client.task.tasks[":projectId"].$get({param: { projectId },+ // No filters: the route returns the whole board on a single page.+ query: {},});if (!response.ok) {diff --git a/apps/web/src/types/notification.ts b/apps/web/src/types/notification.tsindex 3094c719d..104ca8858 100644--- a/apps/web/src/types/notification.ts+++ b/apps/web/src/types/notification.ts@@ -2,7 +2,7 @@ import type { client } from "@kaneo/libs";import type { InferResponseType } from "hono/client";export type Notification = Extract<- InferResponseType<(typeof client)["notification"]["$get"]>[number],+ InferResponseType<(typeof client)["notification"]["$get"], 200>[number],{ id: string }>;diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 5594e1c23..ab4ec1802 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -107,9 +107,9 @@ importers:'@hono/node-ws':specifier: ^1.3.1- '@hono/standard-validator':- specifier: ^0.4.0- version: 0.4.0(@standard-schema/[email protected])([email protected])+ '@hono/zod-openapi':+ specifier: ^1.6.1+ version: 1.6.1([email protected])([email protected])'@kaneo/email':specifier: workspace:*version: link:../../packages/email@@ -140,9 +140,6 @@ importers:'@sentry/profiling-node':specifier: ^10.70.0version: 10.70.0(@opentelemetry/[email protected](@opentelemetry/[email protected]))- '@valibot/to-json-schema':- specifier: ^1.7.1- version: 1.7.1([email protected]([email protected]))bcryptjs:specifier: ^3.0.2version: 3.0.3@@ -164,9 +161,6 @@ importers:hono:specifier: '>=4.12.25'version: 4.12.34- hono-openapi:- specifier: ^1.3.1- version: 1.3.1(@hono/[email protected](@standard-schema/[email protected])([email protected]))(@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]))(@standard-community/[email protected](@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]))(@standard-schema/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))(@types/[email protected])([email protected])([email protected])ioredis:specifier: ^6.0.0version: 6.0.0@@ -203,7 +197,7 @@ importers:version: 7.0.2vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))apps/site:dependencies:@@ -369,7 +363,7 @@ importers:version: 5.4.0([email protected])'@tailwindcss/vite':specifier: ^4.3.3- version: 4.3.3([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.3.3([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@tanstack/react-query':specifier: ^5.101.4version: 5.101.4([email protected])@@ -384,7 +378,7 @@ importers:version: 1.167.1(@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@tanstack/[email protected])([email protected])([email protected]([email protected]))([email protected])'@tanstack/router-plugin':specifier: ^1.168.26- version: 1.168.28(@tanstack/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 1.168.28(@tanstack/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@tiptap/core':specifier: ^3.29.2version: 3.29.2(@tiptap/[email protected])@@ -444,7 +438,7 @@ importers:version: 2.0.7'@vitejs/plugin-react':specifier: ^6.0.5- version: 6.0.5(@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 6.0.5(@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))babel-plugin-react-compiler:specifier: ^1.0.0version: 1.0.0@@ -562,7 +556,7 @@ importers:version: link:../../packages/permissions'@rolldown/plugin-babel':specifier: ^0.2.3- version: 0.2.3(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 0.2.3(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@tailwindcss/postcss':specifier: ^4.3.3version: 4.3.3@@ -601,10 +595,10 @@ importers:version: 7.0.2vite:specifier: ^8.2.0+ version: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))packages/email:dependencies:@@ -644,7 +638,7 @@ importers:version: 7.0.2vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))packages/libs:devDependencies:@@ -671,10 +665,10 @@ importers:version: 7.0.2vite:specifier: ^8.2.0+ version: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))packages/mcp:dependencies:@@ -708,7 +702,7 @@ importers:version: 7.0.2vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))packages/permissions:dependencies:@@ -724,10 +718,10 @@ importers:version: 7.0.2vite:specifier: ^8.2.0+ version: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))packages/planka-import:dependencies:@@ -752,7 +746,7 @@ importers:version: 7.0.2vitest:specifier: ^4.1.10- version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ version: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))packages/typescript-config: {}@@ -787,6 +781,11 @@ packages:resolution: {integrity: sha512-93Z1N+BQNXysodoicpOIyNh2drHfz/CTf9nnT0FEx72GJcIiwgydD7tGAr78j41LsYn3hlRn+LdGPuBLn1Bl8Q==}engines: {node: ^22.13.0 || >=24.0.0}+ '@asteasolutions/[email protected]':+ resolution: {integrity: sha512-pLMeRgRYS7/vZIgAAkOe2P6+XGTifR1MT9pqDoxZ11EmcJJ+DPmdPqLN8ZZF4U8R9KHCCQCS9c2wtuE8wSrfkw==}+ peerDependencies:+ zod: ^4.0.0+'@aws-sdk/[email protected]':resolution: {integrity: sha512-CGznePoL+1oWCSzqmkvlYMpWQEZohPR3LntjKXXfVH+oh6Kd8d+yHLkjpiAGwPIHAxFe4OAq3aKfRnv/wqWIyA==}engines: {node: '>=20.0.0'}@@ -1623,11 +1622,18 @@ packages:'@hono/node-server': '>=1.19.13'hono: '>=4.12.25'- '@hono/[email protected]':- resolution: {integrity: sha512-MxOm1asDh9j7c1D0KiWwppSbFgAQxTRO4YEhjMrJn3lF1BIcXenPdgjSGKDRfQmZdaTaMA8slQLETgVOKyJxFw==}+ '@hono/[email protected]':+ resolution: {integrity: sha512-z1xS3FZxl4bBkU3kMIsQsLtsqxPTha5XZCsDEPMSZ6+3RRBQI7KED1GeoDpq2WueXCacsNIjcB0MtCnEHY7ahQ==}+ engines: {node: '>=16.0.0'}peerDependencies:- '@standard-schema/spec': ^1.0.0hono: '>=4.12.25'+ zod: ^4.0.0++ '@hono/[email protected]':+ resolution: {integrity: sha512-n0ZSXmCiHVIp4Y5wlOOyZCeTd/rsawA/qW1cipB8QOYKZ9N8Tk0nZUZCXho9cu374AN4JpDNKioNKBJ/W+LBug==}+ peerDependencies:+ hono: '>=4.12.25'+ zod: ^3.25.0 || ^4.0.0'@hookform/[email protected]':resolution: {integrity: sha512-8wS/P4UDr5sQDe4nFaV51TVyfDPrWgNIXweqG0Bs9Z5LSuzKLb+RQNPvkN2oHM5SRrJyWrVH/F+LOUcFjUyvwQ==}@@ -3773,67 +3779,6 @@ packages:'@socket.io/[email protected]':resolution: {integrity: sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==}- '@standard-community/[email protected]':- resolution: {integrity: sha512-4+ZPorwDRt47i+O7RjyuaxHRK/37QY/LmgxlGrRrSTLYoFatEOzvqIc85GTlM18SFZ5E91C+v0o/M37wZPpUHA==}- peerDependencies:- '@standard-schema/spec': ^1.0.0- '@types/json-schema': ^7.0.15- '@valibot/to-json-schema': ^1.3.0- arktype: ^2.1.20- effect: '>=3.20.0'- quansync: ^0.2.11- sury: ^10.0.0- typebox: ^1.0.17- valibot: '>=1.4.2'- zod: ^3.25.0 || ^4.0.0- zod-to-json-schema: ^3.24.5- peerDependenciesMeta:- '@valibot/to-json-schema':- optional: true- arktype:- optional: true- effect:- optional: true- sury:- optional: true- typebox:- optional: true- valibot:- optional: true- zod:- optional: true- zod-to-json-schema:- optional: true-- '@standard-community/[email protected]':- resolution: {integrity: sha512-htj+yldvN1XncyZi4rehbf9kLbu8os2Ke/rfqoZHCMHuw34kiF3LP/yQPdA0tQ940y8nDq3Iou8R3wG+AGGyvg==}- peerDependencies:- '@standard-community/standard-json': ^0.3.5- '@standard-schema/spec': ^1.0.0- arktype: ^2.1.20- effect: '>=3.20.0'- openapi-types: ^12.1.3- sury: ^10.0.0- typebox: ^1.0.0- valibot: '>=1.4.2'- zod: ^3.25.0 || ^4.0.0- zod-openapi: ^4- peerDependenciesMeta:- arktype:- optional: true- effect:- optional: true- sury:- optional: true- typebox:- optional: true- valibot:- optional: true- zod:- optional: true- zod-openapi:- optional: true-'@standard-schema/[email protected]':resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==}@@ -4463,9 +4408,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==}- '@types/[email protected]':- resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}-'@types/[email protected]':resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}@@ -4649,11 +4591,6 @@ packages:'@upsetjs/[email protected]':resolution: {integrity: sha512-WbBhLrooyePuQ1VZxrJjtLvTc4NVfpOyKx0sKqioq9bX1C1m7Jgykkn8gLrtwumBioXIqam8DLxp88Adbue6Hw==}- '@valibot/[email protected]':- resolution: {integrity: sha512-3qkmU6KXWh8GIThEAW3kuRHPQBMjWkKy+Ppz3WkUucx53DTpOa6siMn4xDGSOhlVyMrDaJTCTMLYPZVAIk1P0A==}- peerDependencies:- valibot: '>=1.4.2'-'@vitejs/[email protected]':resolution: {integrity: sha512-BOVzne/NL162sMdResB25mUv+vWMF5NoAjNf09TeGlE7ZpszZWSD3winycicLJw72yeVsoCn/2kOhEuCvEShMA==}engines: {node: ^20.19.0 || >=22.12.0}@@ -6191,21 +6128,6 @@ packages:resolution: {integrity: sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==}engines: {node: '>=12.0.0'}- resolution: {integrity: sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw==}- peerDependencies:- '@hono/standard-validator': ^0.2.0- '@standard-community/standard-json': ^0.3.5- '@standard-community/standard-openapi': ^0.2.9- '@types/json-schema': ^7.0.15- hono: '>=4.12.25'- openapi-types: ^12.1.3- peerDependenciesMeta:- '@hono/standard-validator':- optional: true- hono:- optional: true-resolution: {integrity: sha512-GqXJqY/xJkJmuloTrnV1ZEXG3fqte+VjkUqoRNZXcrUidiUOP4fMSIHHY4tsqZBK++kVyWmt/AAfSUuy57/eSA==}engines: {node: '>=16.9.0'}@@ -7352,8 +7274,8 @@ packages:resolution: {integrity: sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw==}engines: {node: '>=20'}- resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}+ resolution: {integrity: sha512-XW9MOldkhoICNeXVzzmXzmOW5G73ppOEGmh7fLCqHjgfdEYCGGN+00MlVCeUZgovjjfC56j9tvtDt1zGabNjjA==}resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}@@ -7716,9 +7638,6 @@ packages:resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==}engines: {node: '>=0.6'}- resolution: {integrity: sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==}-resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}@@ -8856,6 +8775,11 @@ packages:resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}+ resolution: {integrity: sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==}+ engines: {node: '>= 14.6'}+ hasBin: true+resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==}engines: {node: '>=10'}@@ -8981,6 +8905,11 @@ snapshots:is-potential-custom-element-name: 1.0.1lru-cache: 11.5.2+ '@asteasolutions/[email protected]([email protected])':+ dependencies:+ openapi3-ts: 4.6.1+ zod: 4.4.3+'@aws-sdk/[email protected]':dependencies:'@aws-sdk/core': 3.977.6@@ -9884,10 +9813,18 @@ snapshots:- bufferutil- utf-8-validate+ dependencies:+ '@asteasolutions/zod-to-openapi': 9.1.0([email protected])+ '@hono/zod-validator': 0.9.0([email protected])([email protected])+ hono: 4.12.34+ openapi3-ts: 4.6.1+ zod: 4.4.3+dependencies:- '@standard-schema/spec': 1.1.0hono: 4.12.34+ zod: 4.4.3'@hookform/[email protected](@standard-schema/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])':dependencies:@@ -11494,14 +11431,14 @@ snapshots:'@rolldown/[email protected]':optional: true- '@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@babel/core': 7.29.7picomatch: 4.0.5rolldown: 1.2.3optionalDependencies:'@babel/runtime': 7.29.7+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])'@rolldown/[email protected]': {}@@ -11953,28 +11890,6 @@ snapshots:'@socket.io/[email protected]': {}- '@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])':- dependencies:- '@standard-schema/spec': 1.1.0- '@types/json-schema': 7.0.15- quansync: 0.2.11- optionalDependencies:- '@valibot/to-json-schema': 1.7.1([email protected]([email protected]))- effect: 3.22.1- valibot: 1.4.2([email protected])- zod: 4.4.3- zod-to-json-schema: 3.25.2([email protected])-- '@standard-community/[email protected](@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]))(@standard-schema/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])':- dependencies:- '@standard-community/standard-json': 0.3.5(@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])- '@standard-schema/spec': 1.1.0- openapi-types: 12.1.3- optionalDependencies:- effect: 3.22.1- valibot: 1.4.2([email protected])- zod: 4.4.3-'@standard-schema/[email protected]': {}'@standard-schema/[email protected]': {}@@ -12052,12 +11967,12 @@ snapshots:postcss: 8.5.25tailwindcss: 4.3.3- '@tailwindcss/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@tailwindcss/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@tailwindcss/node': 4.3.3'@tailwindcss/oxide': 4.3.3tailwindcss: 4.3.3+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])'@tanstack/[email protected]': {}@@ -12142,7 +12057,7 @@ snapshots:transitivePeerDependencies:- supports-color- '@tanstack/[email protected](@tanstack/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@tanstack/[email protected](@tanstack/[email protected]([email protected]([email protected]))([email protected]))([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@babel/core': 7.29.7'@babel/template': 7.29.7@@ -12151,11 +12066,11 @@ snapshots:'@tanstack/router-generator': 1.167.26'@tanstack/router-utils': 1.162.2chokidar: 5.0.0- unplugin: 3.3.0([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ unplugin: 3.3.0([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))zod: 4.4.3optionalDependencies:+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])transitivePeerDependencies:- '@farmfe/core'- '@rspack/core'@@ -12641,8 +12556,6 @@ snapshots:dependencies:'@types/unist': 3.0.3- '@types/[email protected]': {}-'@types/[email protected]':dependencies:'@types/unist': 3.0.3@@ -12771,16 +12684,12 @@ snapshots:d3-selection: 3.0.0d3-transition: 3.0.1([email protected])- dependencies:- valibot: 1.4.2([email protected])-- '@vitejs/[email protected](@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@vitejs/[email protected](@rolldown/[email protected](@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@rolldown/pluginutils': 1.0.1+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])optionalDependencies:- '@rolldown/plugin-babel': 0.2.3(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ '@rolldown/plugin-babel': 0.2.3(@babel/[email protected])(@babel/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))babel-plugin-react-compiler: 1.0.0'@vitest/[email protected]([email protected])':@@ -12795,7 +12704,7 @@ snapshots:obug: 2.1.4std-env: 4.2.0tinyrainbow: 3.1.0- vitest: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ vitest: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@vitest/[email protected]':dependencies:@@ -12806,14 +12715,14 @@ snapshots:chai: 6.2.2tinyrainbow: 3.1.0- '@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ '@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@vitest/spy': 4.1.10estree-walker: 3.0.3magic-string: 0.30.21optionalDependencies:msw: 2.12.10(@types/[email protected])([email protected])+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])'@vitest/[email protected]':dependencies:@@ -13029,7 +12938,7 @@ snapshots:react: 19.2.8react-dom: 19.2.8([email protected])solid-js: 1.9.10- vitest: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ vitest: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))transitivePeerDependencies:- '@cloudflare/workers-types'- '@opentelemetry/api'@@ -14282,16 +14191,6 @@ snapshots:- [email protected](@hono/[email protected](@standard-schema/[email protected])([email protected]))(@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]))(@standard-community/[email protected](@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]))(@standard-schema/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]))(@types/[email protected])([email protected])([email protected]):- dependencies:- '@standard-community/standard-json': 0.3.5(@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])- '@standard-community/standard-openapi': 0.2.9(@standard-community/[email protected](@standard-schema/[email protected])(@types/[email protected])(@valibot/[email protected]([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]))(@standard-schema/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])- '@types/json-schema': 7.0.15- openapi-types: 12.1.3- optionalDependencies:- '@hono/standard-validator': 0.4.0(@standard-schema/[email protected])([email protected])- hono: 4.12.34-@@ -15381,7 +15280,9 @@ snapshots:powershell-utils: 0.1.0wsl-utils: 0.3.1- [email protected]: {}+ dependencies:+ yaml: 2.9.0dependencies:@@ -15760,8 +15661,6 @@ snapshots:es-define-property: 1.0.1side-channel: 1.1.1- [email protected]: {}-[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected]):@@ -16867,7 +16766,7 @@ snapshots:- [email protected]([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])):+ [email protected]([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:'@jridgewell/remapping': 2.3.5picomatch: 4.0.5@@ -16876,7 +16775,7 @@ snapshots:esbuild: 0.28.1rolldown: 1.2.3rollup: 4.59.0+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])optional: true@@ -16935,7 +16834,7 @@ snapshots:'@types/unist': 3.0.3vfile-message: 4.0.3- [email protected](@types/[email protected])([email protected])([email protected])([email protected]):+ [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:lightningcss: 1.33.0picomatch: 4.0.5@@ -16948,11 +16847,12 @@ snapshots:fsevents: 2.3.3jiti: 2.7.0tsx: 4.23.9+ yaml: 2.9.0- [email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])):+ [email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:'@vitest/expect': 4.1.10- '@vitest/mocker': 4.1.10([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ '@vitest/mocker': 4.1.10([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@vitest/pretty-format': 4.1.10'@vitest/runner': 4.1.10'@vitest/snapshot': 4.1.10@@ -16969,7 +16869,7 @@ snapshots:tinyexec: 1.2.4tinyglobby: 0.2.17tinyrainbow: 3.1.0+ vite: 8.2.1(@types/[email protected])([email protected])([email protected])([email protected])([email protected])why-is-node-running: 2.3.0optionalDependencies:'@opentelemetry/api': 1.9.1@@ -17082,6 +16982,8 @@ snapshots:+ [email protected]: {}+diff --git a/tests/api-integration/openapi.test.ts b/tests/api-integration/openapi.test.tsindex 5896fd30f..f2b0d33e2 100644--- a/tests/api-integration/openapi.test.ts+++ b/tests/api-integration/openapi.test.ts@@ -1,32 +1,122 @@-import { describe, expect, it } from "vitest";+import { beforeAll, describe, expect, it } from "vitest";import { createApp } from "../../apps/api/src/index";-describe("API integration: openapi", () => {- it("serves a merged OpenAPI document", async () => {- const { app } = createApp();-- const response = await app.request("/api/openapi");-- expect(response.status).toBe(200);- const payload = (await response.json()) as {- openapi: string;- info?: { title?: string };- paths?: Record<string, unknown>;- components?: {- securitySchemes?: Record<string, unknown>;- };- };-- expect(payload.openapi).toBe("3.0.3");- expect(payload.info?.title).toBe("Kaneo API");- expect(payload.paths?.["/config"]).toBeTruthy();- expect(- Object.keys(payload.paths || {}).some((path) =>- path.startsWith("/auth/"),- ),- ).toBe(true);- expect(payload.components?.securitySchemes).toMatchObject({- bearerAuth: expect.any(Object),+type Operation = {+ operationId?: string;+ summary?: string;+ responses: Record<string, unknown>;+ security?: unknown[];+};+type Spec = {+ openapi: string;+ info: { title: string; version: string };+ paths: Record<string, Record<string, Operation>>;+ security?: Array<Record<string, unknown>>;+ components: {+ schemas: Record<string, unknown>;+ securitySchemes: Record<string, { type: string; scheme?: string }>;+ };+};++const HTTP_METHODS = ["get", "post", "put", "patch", "delete"];++function operations(spec: Spec): Array<[string, string, Operation]> {+ const out: Array<[string, string, Operation]> = [];+ for (const [path, item] of Object.entries(spec.paths)) {+ for (const [method, operation] of Object.entries(item)) {+ if (HTTP_METHODS.includes(method)) out.push([method, path, operation]);+ }+ }+ return out;+}++let spec: Spec;++beforeAll(async () => {+ const { app } = createApp();+ const response = await app.request("/api/openapi");+ expect(response.status).toBe(200);+ spec = (await response.json()) as Spec;+});++describe("Kaneo API OpenAPI spec", () => {+ it("is a valid OpenAPI 3.1 document", () => {+ expect(spec.openapi).toBe("3.1.0");+ expect(spec.info.title).toBe("Kaneo API");+ });++ it("requires bearer auth globally", () => {+ expect(spec.components.securitySchemes.bearerAuth).toMatchObject({+ type: "http",+ scheme: "bearer",});+ expect(spec.security).toContainEqual({ bearerAuth: [] });+ });++ it("documents the routes the clients depend on", () => {+ const keys = new Set(+ operations(spec).map(+ ([method, path]) => `${method.toUpperCase()} ${path}`,+ ),+ );+ for (const op of [+ "GET /config",+ "GET /label/{id}",+ "POST /label",+ "GET /project",+ "GET /task/tasks/{projectId}",+ "PATCH /task/bulk",+ "GET /search",+ "GET /notification",+ "POST /auth/organization/create",+ ]) {+ expect(keys.has(op), `missing operation ${op}`).toBe(true);+ }+ });++ it("gives every operation a unique operationId and a summary", () => {+ const ids: string[] = [];+ for (const [method, path, operation] of operations(spec)) {+ expect(+ operation.operationId,+ `${method} ${path} has no operationId`,+ ).toBeTruthy();+ expect(+ operation.summary,+ `${method} ${path} has no summary`,+ ).toBeTruthy();+ ids.push(operation.operationId as string);+ }+ expect(new Set(ids).size, "operationIds must be unique").toBe(ids.length);+ });++ it("names its entity schemas as reusable components", () => {+ expect(Object.keys(spec.components.schemas)).toEqual(+ expect.arrayContaining([+ "Task",+ "Project",+ "Label",+ "Column",+ "Comment",+ "Activity",+ "TimeEntry",+ "Notification",+ "Config",+ "SearchResult",+ "WorkspaceMember",+ ]),+ );+ });++ it("documents a 401 on every operation that requires auth", () => {+ const missing: string[] = [];+ for (const [method, path, operation] of operations(spec)) {+ const isPublic =+ Array.isArray(operation.security) && operation.security.length === 0;+ if (isPublic) continue;+ if (!operation.responses["401"])+ missing.push(`${method.toUpperCase()} ${path}`);+ }+ expect(missing).toEqual([]);});});diff --git a/tests/api/utils/openapi-spec.test.ts b/tests/api/utils/openapi-spec.test.tsindex df9b491a3..199a1ffc2 100644--- a/tests/api/utils/openapi-spec.test.ts+++ b/tests/api/utils/openapi-spec.test.ts@@ -1,343 +1,25 @@import { describe, expect, it } from "vitest";-import {- dedupeOperationIds,- ensureOperationSummaries,- markOptionalSchemaFieldsNullable,- mergeOpenApiSpecs,- normalizeApiServerUrl,- normalizeEmptyAndEnumSchemas,- normalizeEmptyRequiredArrays,- normalizeMalformedPropertySchemas,- normalizeNullableSchemasForOpenApi30,- normalizeOrganizationAuthOperations,-} from "../../../apps/api/src/utils/openapi-spec";+import { normalizeApiServerUrl } from "../../../apps/api/src/utils/openapi-spec";-describe("openapi spec helpers", () => {- it("normalizes API server urls", () => {- expect(normalizeApiServerUrl("https://api.kaneo.app")).toBe(- "https://api.kaneo.app/api",- );- expect(normalizeApiServerUrl("https://api.kaneo.app/api/")).toBe(- "https://api.kaneo.app/api",+describe("normalizeApiServerUrl", () => {+ it("appends /api when the base has no api suffix", () => {+ expect(normalizeApiServerUrl("https://cloud.kaneo.app")).toBe(+ "https://cloud.kaneo.app/api",);});- it("normalizes organization auth operations and prunes components", () => {- const authSpec = {- paths: {- "/organization/list-members": {- get: {- operationId: "oldId",- summary: "Old summary",- responses: {- 200: {- content: {- "application/json": {- schema: { $ref: "#/components/schemas/MemberList" },- },- },- },- },- },- },- "/session/get": {- get: {- operationId: "ignored",- },- },- },- security: [{ bearerAuth: [] }],- components: {- securitySchemes: {- bearerAuth: { type: "http", scheme: "bearer" },- },- schemas: {- MemberList: {- type: "object",- properties: {- data: {- $ref: "#/components/schemas/Member",- },- },- },- Member: {- type: "object",- properties: {- id: { type: "string" },- },- },- Ignored: {- type: "object",- },- },- },- };-- const normalized = normalizeOrganizationAuthOperations(authSpec);-- expect(Object.keys(normalized.paths as Record<string, unknown>)).toEqual([- "/auth/organization/list-members",- ]);-- const operation = (- normalized.paths as Record<- string,- Record<string, Record<string, unknown>>- >- )["/auth/organization/list-members"].get;-- expect(operation.operationId).toBe("listOrganizationMembers");- expect(operation.summary).toBe("List Organization Members");- expect(operation.tags).toEqual(["Organization Management"]);-- const schemaNames = Object.keys(- (- normalized.components as {- schemas?: Record<string, unknown>;- }- ).schemas || {},+ it("leaves a URL that already ends with /api alone", () => {+ expect(normalizeApiServerUrl("https://cloud.kaneo.app/api")).toBe(+ "https://cloud.kaneo.app/api",);- expect(schemaNames).toEqual(["MemberList", "Member"]);});- it("normalizes organization invitation and team schemas", () => {- const normalized = normalizeOrganizationAuthOperations({- paths: {- "/organization/get-invitation": {- get: {- parameters: [- { name: "id", in: "query", schema: { type: "string" } },- ],- },- },- "/organization/update-team": {- post: {- requestBody: {- content: {- "application/json": {- schema: {- properties: {- data: {- properties: {- id: {- type: "string",- default: "generated-team-id",- nullable: true,- },- },- },- },- },- },- },- },- },- },- },- });- const paths = normalized.paths as Record<- string,- Record<string, Record<string, unknown>>- >;- const invitationParameters = paths["/auth/organization/get-invitation"].get- .parameters as Record<string, unknown>[];- expect(invitationParameters[0]?.required).toBe(true);-- const requestBody = paths["/auth/organization/update-team"].post- .requestBody as {- content: {- "application/json": {- schema: {- properties: {- data: { properties: { id: Record<string, unknown> } };- };- };- };- };- };- expect(- requestBody.content["application/json"].schema.properties.data.properties- .id,- ).toEqual({ type: "string", nullable: true });- });-- it("merges hono and auth specs", () => {- const merged = mergeOpenApiSpecs(- {- openapi: "3.1.0",- info: { title: "API" },- paths: { "/tasks": { get: { operationId: "getTasks" } } },- tags: [{ name: "Tasks" }],- components: {- schemas: { Task: { type: "object" } },- },- },- {- paths: { "/auth/session": { get: { operationId: "getSession" } } },- tags: [{ name: "Auth" }],- components: {- securitySchemes: { bearerAuth: { type: "http" } },- schemas: { Session: { type: "object" } },- },- },+ it("strips trailing slashes before appending", () => {+ expect(normalizeApiServerUrl("https://cloud.kaneo.app///")).toBe(+ "https://cloud.kaneo.app/api",);-- expect(merged.openapi).toBe("3.1.0");- expect(Object.keys(merged.paths)).toEqual(["/tasks", "/auth/session"]);- expect(merged.tags).toEqual([{ name: "Tasks" }, { name: "Auth" }]);- expect(merged.components.schemas).toEqual({- Task: { type: "object" },- Session: { type: "object" },- });- expect(merged.components.securitySchemes).toEqual({- bearerAuth: { type: "http" },- });- });-- it("dedupes operation ids using method and path", () => {- const spec = dedupeOperationIds({- paths: {- "/tasks": {- get: { operationId: "getTask" },- },- "/tasks/{id}": {- get: { operationId: "getTask" },- },- },- });-- expect(- (spec.paths as Record<string, Record<string, { operationId: string }>>)[- "/tasks/{id}"- ].get.operationId,- ).toBe("getTask_get_tasks_id");- });-- it("normalizes nullable schemas and empty required arrays", () => {- const spec = normalizeEmptyRequiredArrays(- normalizeNullableSchemasForOpenApi30({- components: {- schemas: {- Example: {- type: ["string", "null"],- required: [],- },- ExampleAnyOf: {- anyOf: [{ type: "null" }, { type: "number", minimum: 1 }],- },- },- },- }),- );-- expect(- (- spec.components as {- schemas: Record<string, Record<string, unknown>>;- }- ).schemas.Example,- ).toEqual({- type: "string",- nullable: true,- });-- expect(- (- spec.components as {- schemas: Record<string, Record<string, unknown>>;- }- ).schemas.ExampleAnyOf,- ).toEqual({- type: "number",- minimum: 1,- nullable: true,- });- });-- it("keeps empty properties maps valid after removing malformed schemas", () => {- const spec = normalizeEmptyAndEnumSchemas(- normalizeMalformedPropertySchemas({- components: {- schemas: {- Example: {- type: "object",- properties: {- additionalFields: {- type: "object",- properties: { type: "object" },- },- },- },- },- },- }),- );-- expect(- (- spec.components as {- schemas: Record<- string,- { properties: Record<string, Record<string, unknown>> }- >;- }- ).schemas.Example.properties.additionalFields.properties,- ).toEqual({});- });-- it("marks optional schema fields nullable and fills missing summaries", () => {- const spec = ensureOperationSummaries(- markOptionalSchemaFieldsNullable({- paths: {- "/tasks": {- get: {- operationId: "listWorkspaceTasks",- },- },- },- components: {- schemas: {- Task: {- type: "object",- required: ["id"],- properties: {- id: { type: "string" },- title: { type: "string" },- estimate: { type: "number", nullable: true },- },- },- },- },- }),+ expect(normalizeApiServerUrl("https://cloud.kaneo.app/api/")).toBe(+ "https://cloud.kaneo.app/api",);-- expect(- (- spec.components as {- schemas: Record<- string,- { properties: Record<string, Record<string, unknown>> }- >;- }- ).schemas.Task.properties.title.nullable,- ).toBe(true);- expect(- (- spec.components as {- schemas: Record<- string,- { properties: Record<string, Record<string, unknown>> }- >;- }- ).schemas.Task.properties.id.nullable,- ).toBeUndefined();- expect(- (- spec.paths as Record<- string,- Record<string, { summary?: string; operationId: string }>- >- )["/tasks"].get.summary,- ).toBe("List Workspace Tasks");});});