mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add /attachments/updateUsed DocApi endpoint to soft delete all unused attachments in document
Summary: Builds on https://phab.getgrist.com/D3352 Add DocStorage.scanAttachmentsForUsageChanges to do fancy JSON query to find all attachment metadata rows whose soft deletion status needs updating. Add ActiveDoc.updateUsedAttachments which uses the above and then applies the appropriate user action if needed to soft delete/undelete metadata rows. Add endpoint in DocApi calling ActiveDoc method. Test Plan: Added DocApi test Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3357
This commit is contained in:
@@ -230,6 +230,12 @@ export class DocWorkerApi {
|
||||
.send(fileData);
|
||||
}));
|
||||
|
||||
// Mostly for testing
|
||||
this._app.post('/api/docs/:docId/attachments/updateUsed', canEdit, withDoc(async (activeDoc, req, res) => {
|
||||
await activeDoc.updateUsedAttachments();
|
||||
res.json(null);
|
||||
}));
|
||||
|
||||
// Adds records given in a column oriented format,
|
||||
// returns an array of row IDs
|
||||
this._app.post('/api/docs/:docId/tables/:tableId/data', canEdit,
|
||||
|
||||
Reference in New Issue
Block a user