anything-llm icon indicating copy to clipboard operation
anything-llm copied to clipboard

Add API endpoint for updating pin status

Open yond1994 opened this issue 1 year ago • 0 comments

Pull Request Type

  • [x] ✨ feat
  • [ ] 🐛 fix
  • [ ] ♻️ refactor
  • [ ] 💄 style
  • [ ] 🔨 chore
  • [ ] 📝 docs

Relevant Issues

resolves #1051

What is in this change?

This pull request introduces a new API endpoint to update the pin status of a document within a workspace.

Key Changes:

  1. New Endpoint:

    • Path: /workspace/:slug/update-pin
    • Method: POST
    • Description: Allows users to add or remove the pin status of a specified document in a workspace.
  2. Endpoint Details:

    • Parameters:
      • slug: Unique identifier of the workspace (in path).
      • Authorization: Token (in header).
    • Request Body:
      {
        "docPath": "custom-documents/my-pdf.pdf-hash.json",
        "pinStatus": true
      }
      
    • Responses:
      • 200 OK: Pin status updated successfully.
      • 404 Not Found: Document not found.
      • 500 Internal Server Error: Internal server error.
  3. Documentation:

    • Added the new endpoint to openapi.json for easy reference in Swagger UI at http://localhost:3001/api-docs.

    These changes enhance document management by allowing users to efficiently update pin statuses via the API.


Developer Validations

  • [x] I ran yarn lint from the root of the repo & committed changes
  • [x] Relevant documentation has been updated
  • [x] I have tested my code functionality
  • [x] Docker build succeeds locally

yond1994 avatar May 18 '24 15:05 yond1994