initial commit

This commit is contained in:
Elias Schneider
2022-04-25 15:15:17 +02:00
commit 61be87b72a
72 changed files with 11502 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "appwrite-function",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"node-appwrite": "^5.0.0"
}
}

View File

@@ -0,0 +1,22 @@
const sdk = require("node-appwrite")
module.exports = async function (req, res) {
const client = new sdk.Client();
let database = new sdk.Database(client);
client
.setEndpoint(req.env["APPWRITE_FUNCTION_ENDPOINT"])
.setProject(req.env["APPWRITE_FUNCTION_PROJECT_ID"])
.setKey(req.env["APPWRITE_FUNCTION_API_KEY"])
.setSelfSigned(true);
const payload = JSON.parse(req.payload);
database.updateDocument("shares", payload.id, {
enabled: true
})
res.json({
id: payload.id,
});
};