Path: blob/master/src/packages/next/pages/api/v2/compute/cloud-filesystem/edit.ts
1452 views
/*1Edit properties of cloud file system2*/34import getAccountId from "lib/account/get-account";5import {6userEditCloudFilesystem,7FIELDS,8} from "@cocalc/server/compute/cloud-filesystem/edit";9import getParams from "lib/api/get-params";10import type { EditCloudFilesystem } from "@cocalc/util/db-schema/cloud-filesystems";1112export default async function handle(req, res) {13try {14res.json(await get(req));15} catch (err) {16res.json({ error: `${err.message}` });17return;18}19}2021async function get(req) {22const account_id = await getAccountId(req);23if (!account_id) {24throw Error("must be signed in");25}26const params = getParams(req);27const { id } = params;28const opts: Partial<EditCloudFilesystem> = {};29for (const field of FIELDS) {30const x = params[field];31if (x !== undefined) {32opts[field] = x;33}34}3536return await userEditCloudFilesystem({37...(opts as EditCloudFilesystem),38account_id,39id,40});41}424344