⚡ 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
fix(api): document activity comment rejection
Tin7a42197a67a9
diff --git a/apps/api/src/activity/index.ts b/apps/api/src/activity/index.tsindex 4e87d54d8..16e63c599 100644--- a/apps/api/src/activity/index.ts+++ b/apps/api/src/activity/index.ts@@ -13,6 +13,7 @@ import getActivities from "./controllers/get-activities";import updateComment from "./controllers/update-comment";const activityCommentContentSchema = v.pipe(v.string(), v.maxLength(10_000));+const activityErrorSchema = v.object({ message: v.string() });const activity = new Hono<{Variables: {@@ -55,6 +56,12 @@ const activity = new Hono<{"application/json": { schema: resolver(activitySchema) },},},+ 400: {+ description: "Comment activities must use the comment endpoint",+ content: {+ "application/json": { schema: resolver(activityErrorSchema) },+ },+ },},}),validator(@@ -73,7 +80,10 @@ const activity = new Hono<{const { taskId, userId, message, type, eventData } = c.req.valid("json");if (type === "comment") {throw new HTTPException(400, {- message: "Use the comment endpoint to create comments",+ res: c.json(+ { message: "Use the comment endpoint to create comments" },+ 400,+ ),});}const activity = await createActivity(diff --git a/tests/api-integration/comment.test.ts b/tests/api-integration/comment.test.tsindex b2c0e9d02..659dc7349 100644--- a/tests/api-integration/comment.test.ts+++ b/tests/api-integration/comment.test.ts@@ -200,5 +200,9 @@ describe("API integration: task comments", () => {});expect(response.status).toBe(400);+ expect(response.headers.get("content-type")).toContain("application/json");+ expect(await response.json()).toEqual({+ message: "Use the comment endpoint to create comments",+ });});});