Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API endpoint to remove a document from one folder index and add to another #55

Closed
reganwolfrom opened this issue Oct 15, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@reganwolfrom
Copy link
Member

As folders hold a list of documents within, moving a document from one folder to another would require an API call to remove the document from the source folder and add to the destination folder.

Example endpoint:

POST /documents/{id}/move
{"sourceFolder": "Client ABC", "destinationFolder": "Client ABC/Client ABC Workspace"}

NOTE: if we want to use move as the resource, we can also include siteId in future, allowing a move between folders, sites, or both, e.g., sourceSiteId

@reganwolfrom reganwolfrom added the enhancement New feature or request label Oct 15, 2022
@mfriesen
Copy link
Member

mfriesen commented Oct 15, 2022

To keep the document secondary indexing flexible my proposal would be to create an API under

POST /indices/{indexType}/{operation}

So in this case there would be a
POST /indices/folder/move
{
"source":"",
"target":""
}

This would allow other types of indexing to be created with relative ease.

mfriesen pushed a commit that referenced this issue Oct 22, 2022
mfriesen pushed a commit that referenced this issue Oct 22, 2022
mfriesen pushed a commit that referenced this issue Oct 24, 2022
@mfriesen mfriesen added this to the v1.9.0 milestone Oct 25, 2022
mfriesen pushed a commit that referenced this issue Oct 25, 2022
mfriesen pushed a commit that referenced this issue Oct 25, 2022
@reganwolfrom
Copy link
Member Author

@mfriesen after deleting documents (DELETE /documents/{id}), there is a list of "folders", one for each deleted document, returning on the root folder.

Screen Shot 2022-10-25 at 12 39 26 PM

{
      "path": "Document List.xlsx",
      "folder": true,
      "tags": {
        
      }
    },
    {
      "path": "Financial Sample.xlsx",
      "folder": true,
      "tags": {
        
      }
    },

mfriesen pushed a commit that referenced this issue Oct 26, 2022
@reganwolfrom
Copy link
Member Author

reganwolfrom commented Oct 27, 2022

@mfriesen when moving from a folder to root, specifying "" as the target gives a 400:
{"errors":[{"key":"target","error":"attribute is required"}]}

But when providing "/" as the target, a new folder "f#" is created in DynamoDB, and the document is moved to this folder.
Screen Shot 2022-10-27 at 4 25 02 PM

Based on other concepts of root that we are using, i.e., the absence of a folder being no folder ("") instead of a root of "/", I think the blank target should be admissible. In addition, the "/" folder should not be created if "/" is provided as a destination.

Conversely, we can use "/" to signify root, and would also avoid creating the "/" folder.

@mfriesen
Copy link
Member

Also need to support adding the same file multiple times to a folder

mfriesen added a commit that referenced this issue Dec 17, 2022
* #71 - Added Document Meta Data / Document Versioning

* Added https://typesense.org  full text search

* #55 - Add API endpoint to remove a document from one folder index and add to another

* #71 - Added Document Versioning DynamoDb Service

* #75 - Ability to delete a folder

* #74 - Fix folders index to sort folders to the top

* #73 - Add ability to get a list of all tags in siteId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants