mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
feat(documents): add Recently deleted for deleted documents
Deleting a document only stamps a tombstone and the purge removes it
after 30 days, but the only way back was the undo toast, gone a few
seconds after the delete. Recently deleted lists the deleted documents
of the record with type, filing date, where an import came from, when
each was deleted and how long it has left, and offers Restore, Restore
all and Delete now.
GET /api/documents/inbound/deleted lists them (owner-only, capped at 200
with the list-cap meta). POST /api/documents/inbound/{id}/purge removes
one deleted document for good through the same function the nightly
purge runs, so its import keys and aliases still move into the ledger
and an importer re-sending it is still answered "deleted"; a live
document answers 409 documents.inbound.notDeleted. The usage read gains
deletedCount, 0 under a grant. The restore route and bulk restore
share one restore, which now also clears ledger entries for the
document's own keys.
The vault header shows a quiet "Recently deleted (n)" link only while
something is in it, and the delete toasts and confirmations say that
deleted documents stay there for 30 days. The purge's queue facts and
grace window move to document-purge-queue.ts so the worker registry
still loads none of the work.
Refs #1275
This commit is contained in:
1 parent
1ea14e9100
commit
4752115d7d
44 files changed
+2277
-270
No files matched your search
@@ -878,44 +878,14 @@ export interface DocumentBulkResultDto {
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
/** The usage endpoint payload the UI reads before offering an upload. */
|
||||
export interface DocumentUsageDto {
|
||||
usedBytes: number;
|
||||
quotaBytes: number;
|
||||
maxFileBytes: number;
|
||||
acceptedExtensions: string[];
|
||||
/**
|
||||
* Episodes carrying at least one LIVE document link — the vault filter
|
||||
* bar's condition chips. Sourced server-side so a chip exists even when
|
||||
* every linked document sits pages deep in the timeline.
|
||||
*/
|
||||
linkedEpisodes: DocumentConditionLinkDto[];
|
||||
/**
|
||||
* Procedures and surgeries (visits of kind PROCEDURE) carrying at least one
|
||||
* LIVE document link — the filter bar's procedure choices, sourced
|
||||
* server-side for the same reason as `linkedEpisodes`. Empty when the
|
||||
* caller's grant does not cover the visits section, because the label is
|
||||
* the visit's own text.
|
||||
*/
|
||||
linkedProcedures: DocumentLinkedProcedureDto[];
|
||||
/**
|
||||
* Whether the AI "Suggest details" action can run for this caller — true when
|
||||
* a provider (vision, or text + local OCR) is configured. The UI hides the
|
||||
* action when false so it never offers what the endpoint would 422.
|
||||
*/
|
||||
assistAvailable: boolean;
|
||||
/**
|
||||
* Content-search index state: whether indexing is available to the caller
|
||||
* (`enabled`, same provider precondition as assist), how many live documents
|
||||
* are indexed, and the live-document total — so the UI can gauge coverage and
|
||||
* offer the "index all documents" backfill.
|
||||
*/
|
||||
contentIndex: {
|
||||
enabled: boolean;
|
||||
indexedCount: number;
|
||||
totalCount: number;
|
||||
};
|
||||
}
|
||||
// The usage and Recently deleted payloads live in their own module; kept
|
||||
// importable from here like every other vault DTO.
|
||||
export type {
|
||||
DeletedDocumentDto,
|
||||
DeletedDocumentListDto,
|
||||
DocumentPurgeDto,
|
||||
DocumentUsageDto,
|
||||
} from "@/lib/documents/vault-read-dtos";
|
||||
|
||||
/** Where a document read egresses, vendor-blind. */
|
||||
export type DocumentEgressClass = "local" | "external";
|
||||
|
||||
Reference in new issue
Block a user