mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add API endpoint to get site usage summary
Summary: The summary includes a count of documents that are approaching limits, in grace period, or delete-only. The endpoint is only accessible to site owners, and is currently unused. A follow-up diff will add usage banners to the site home page, which will use the response from the endpoint to communicate usage information to owners. Test Plan: Browser and server tests. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3420
This commit is contained in:
@@ -146,6 +146,15 @@ export class ApiServer {
|
||||
return sendReply(req, res, query);
|
||||
}));
|
||||
|
||||
// GET /api/orgs/:oid/usage
|
||||
// Get usage summary of all un-deleted documents in the organization.
|
||||
// Only accessible to org owners.
|
||||
this._app.get('/api/orgs/:oid/usage', expressWrap(async (req, res) => {
|
||||
const org = getOrgKey(req);
|
||||
const usage = await this._dbManager.getOrgUsageSummary(getScope(req), org);
|
||||
return sendOkReply(req, res, usage);
|
||||
}));
|
||||
|
||||
// POST /api/orgs
|
||||
// Body params: name (required), domain
|
||||
// Create a new org.
|
||||
@@ -194,7 +203,7 @@ export class ApiServer {
|
||||
return sendReply(req, res, query);
|
||||
}));
|
||||
|
||||
// // DELETE /api/workspaces/:wid
|
||||
// DELETE /api/workspaces/:wid
|
||||
// Delete the specified workspace and all included docs.
|
||||
this._app.delete('/api/workspaces/:wid', expressWrap(async (req, res) => {
|
||||
const wsId = integerParam(req.params.wid, 'wid');
|
||||
|
||||
Reference in New Issue
Block a user