Merged in feature/add-deletes (pull request #214)

support delete for client, document and folder

* support delete

for client, document and folder

* remove batch cancel conflict

not used


Approved-by: Jacob Mathison
This commit is contained in:
Jay Brown
2026-03-04 18:30:13 +00:00
parent 62b5de5722
commit 09c61ea9b4
28 changed files with 3438 additions and 632 deletions
+177 -24
View File
@@ -159,6 +159,57 @@ paths:
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
delete:
operationId: deleteClient
tags:
- ClientService
summary: Hard-delete a client and all its data
description: >-
Permanently deletes a client and all associated data including documents,
folders, collectors, batch uploads, and sync records. Source documents in
S3 are NOT deleted but their paths are logged. This operation is
irreversible. Requires confirm=true query parameter.
security:
- jwtAuth: []
parameters:
- name: confirm
in: query
description: Must be set to true to confirm deletion
required: true
schema:
type: boolean
- name: verbose
in: query
required: false
description: When true, returns S3 paths of orphaned source documents in the response body
schema:
type: boolean
default: false
responses:
"200":
description: Client deleted successfully (verbose mode).
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
content:
application/json:
schema:
$ref: "#/components/schemas/DeleteResponse"
"204":
description: Client deleted successfully.
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
# Query paths have been removed - see remove_query_plan.md
@@ -505,30 +556,6 @@ paths:
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
delete:
operationId: cancelDocumentBatch
tags:
- DocumentsService
summary: Cancel a batch upload
description: Cancels a batch upload that is currently processing
security:
- jwtAuth: []
responses:
"204":
description: Batch upload cancelled successfully
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
/document/{id}:
parameters:
@@ -571,6 +598,50 @@ paths:
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
delete:
operationId: deleteDocument
tags:
- DocumentsService
summary: Hard-delete a document
description: >-
Permanently deletes a document and all dependent data including entries,
cleans, text extractions, field extractions, labels, and results. Source
documents in S3 are NOT deleted but their paths are logged.
security:
- jwtAuth: []
parameters:
- name: verbose
in: query
required: false
description: When true, returns S3 paths of orphaned source documents in the response body
schema:
type: boolean
default: false
responses:
"200":
description: Document deleted successfully (verbose mode).
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
content:
application/json:
schema:
$ref: "#/components/schemas/DeleteResponse"
"204":
description: Document deleted successfully.
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
/folders:
post:
@@ -652,6 +723,62 @@ paths:
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
delete:
operationId: deleteFolder
tags:
- FolderService
summary: Hard-delete a folder tree
description: >-
Permanently deletes a folder and all its child folders recursively. The
root folder (path '/') cannot be deleted. If the folder tree contains
documents, include_documents=true is required or a 409 Conflict is
returned. When include_documents=true, all documents in the tree are
also permanently deleted. Source documents in S3 are NOT deleted but
their paths are logged.
security:
- jwtAuth: []
parameters:
- name: include_documents
in: query
required: false
description: When true, also deletes all documents in the folder tree
schema:
type: boolean
default: false
- name: verbose
in: query
required: false
description: When true, returns S3 paths of orphaned source documents in the response body
schema:
type: boolean
default: false
responses:
"200":
description: Folder tree deleted successfully (verbose mode).
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
content:
application/json:
schema:
$ref: "#/components/schemas/DeleteResponse"
"204":
description: Folder tree deleted successfully.
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"409":
$ref: "#/components/responses/Conflict"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
/folders/{folderId}/documents:
parameters:
@@ -4817,3 +4944,29 @@ components:
maximum: 2147483647
description: Total number of items
example: 150
DeleteResponse:
description: Response for hard-delete operations when verbose=true
type: object
required:
- deletedDocuments
properties:
deletedDocuments:
type: array
description: S3 paths of orphaned source documents (only populated when verbose=true)
maxItems: 100000
items:
type: object
required:
- documentId
- s3Path
properties:
documentId:
type: string
format: uuid
maxLength: 36
description: ID of the deleted document
s3Path:
type: string
maxLength: 1024
description: Full S3 path (s3://bucket/key) of the orphaned source file