CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/purchases/set-project-quota.ts
Views: 687
1
import getAccountId from "lib/account/get-account";
2
import getParams from "lib/api/get-params";
3
import setProjectQuota from "@cocalc/server/purchases/set-project-quota";
4
import { OkStatus } from "lib/api/status";
5
6
export default async function handle(req, res) {
7
try {
8
res.json(await get(req));
9
} catch (err) {
10
res.json({ error: `${err.message}` });
11
return;
12
}
13
}
14
15
async function get(req) {
16
const account_id = await getAccountId(req);
17
if (account_id == null) {
18
throw Error("must be signed in");
19
}
20
const { project_id, quota } = getParams(req);
21
await setProjectQuota({ account_id, project_id, quota });
22
return OkStatus;
23
}
24
25