Add API support for creating post comments #71

Closed
opened 2026-05-25 16:03:25 -05:00 by caradoc · 2 comments
Collaborator

Goal

Allow compatible Slugkit implementations to create a local comment on an existing post through the management API, so the slug CLI can support a post-comment workflow without depending on website or protocol-specific routes.

Requirements

  • Add a protected API operation for creating a comment on a post by slug.
  • Define the request and response schema in the OpenAPI contract.
  • Store created comments through the shared comment/domain layer, not by calling website or federation/protocol routes.
  • Treat the created comment as authored by the site/website actor or configured local author according to implementation policy.
  • Make the created comment available through existing comment listing routes for the post.
  • Keep protocol distribution optional and implementation-specific; unsupported distribution must not prevent local comment creation unless the implementation explicitly requires it.
  • Document the workflow in the route specs and CLI specs.

Acceptance criteria

  • POST /api/v1/posts/{slug}/comments is documented in OpenAPI with an operation ID, request schema, response schema, auth requirement, validation errors, 404, and shared error responses.
  • A valid request creates a comment associated with the target post.
  • Missing posts return the shared NOT_FOUND error shape.
  • Invalid or empty comment content returns the shared VALIDATION_ERROR shape.
  • Created comments appear in GET /api/v1/posts/{slug}/comments.
  • The route uses shared comment services/repositories rather than making internal HTTP calls to website or protocol routes.
  • A matching CLI workflow is specified for creating a comment on a post.

Dependencies

  • None
## Goal Allow compatible Slugkit implementations to create a local comment on an existing post through the management API, so the `slug` CLI can support a post-comment workflow without depending on website or protocol-specific routes. ## Requirements - Add a protected API operation for creating a comment on a post by slug. - Define the request and response schema in the OpenAPI contract. - Store created comments through the shared comment/domain layer, not by calling website or federation/protocol routes. - Treat the created comment as authored by the site/website actor or configured local author according to implementation policy. - Make the created comment available through existing comment listing routes for the post. - Keep protocol distribution optional and implementation-specific; unsupported distribution must not prevent local comment creation unless the implementation explicitly requires it. - Document the workflow in the route specs and CLI specs. ## Acceptance criteria - [ ] `POST /api/v1/posts/{slug}/comments` is documented in OpenAPI with an operation ID, request schema, response schema, auth requirement, validation errors, `404`, and shared error responses. - [ ] A valid request creates a comment associated with the target post. - [ ] Missing posts return the shared `NOT_FOUND` error shape. - [ ] Invalid or empty comment content returns the shared `VALIDATION_ERROR` shape. - [ ] Created comments appear in `GET /api/v1/posts/{slug}/comments`. - [ ] The route uses shared comment services/repositories rather than making internal HTTP calls to website or protocol routes. - [ ] A matching CLI workflow is specified for creating a comment on a post. ## Dependencies - None
Author
Collaborator

Synced from todu comment by @todu on 2026-05-26T12:03:03.609Z

Review update

  • PR: #72
  • Result: approved
  • Verification: make check passed and Forgejo CI CI / build-lint-test (pull_request) passed.
  • Acceptance criteria: 7/7 met.
  • Follow-up: waiting for explicit human merge approval.
_Synced from todu comment by @todu on 2026-05-26T12:03:03.609Z_ ### Review update - PR: https://forge.caradoc.com/erik/slugkit/pulls/72 - Result: approved - Verification: `make check` passed and Forgejo CI `CI / build-lint-test (pull_request)` passed. - Acceptance criteria: 7/7 met. - Follow-up: waiting for explicit human merge approval.
caradoc 2026-05-26 12:56:49 -05:00
Author
Collaborator

Synced from todu comment by @todu on 2026-05-26T17:52:40.820Z

Completed

  • Implemented protected POST /api/v1/posts/{slug}/comments with OpenAPI operation posts.comments.create, request/response schemas, auth, validation, 404, and shared error responses.
  • Added local post-comment creation through shared comment code and repository/database access, with created comments visible from existing post comment listing.
  • Added slug comments create <post-slug> --content <text> and updated API/CLI specs.
  • Verified in PR #72 with make check and passing Forgejo CI.
  • Merged PR #72 into main.
_Synced from todu comment by @todu on 2026-05-26T17:52:40.820Z_ ### Completed - Implemented protected `POST /api/v1/posts/{slug}/comments` with OpenAPI operation `posts.comments.create`, request/response schemas, auth, validation, `404`, and shared error responses. - Added local post-comment creation through shared comment code and repository/database access, with created comments visible from existing post comment listing. - Added `slug comments create <post-slug> --content <text>` and updated API/CLI specs. - Verified in PR #72 with `make check` and passing Forgejo CI. - Merged PR #72 into `main`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit#71
No description provided.