initial commit
This commit is contained in:
90
.setup/data/collections.ts
Normal file
90
.setup/data/collections.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
export default [
|
||||
{
|
||||
$id: "shares",
|
||||
$read: [],
|
||||
$write: [],
|
||||
name: "Shares",
|
||||
enabled: true,
|
||||
permission: "document",
|
||||
attributes: [
|
||||
{
|
||||
key: "securityID",
|
||||
type: "string",
|
||||
status: "available",
|
||||
required: false,
|
||||
array: false,
|
||||
size: 255,
|
||||
default: null,
|
||||
},
|
||||
{
|
||||
key: "createdAt",
|
||||
type: "integer",
|
||||
status: "available",
|
||||
required: true,
|
||||
array: false,
|
||||
min: 0,
|
||||
max: 9007199254740991,
|
||||
default: null,
|
||||
},
|
||||
{
|
||||
key: "expiresAt",
|
||||
type: "integer",
|
||||
status: "available",
|
||||
required: true,
|
||||
array: false,
|
||||
min: 0,
|
||||
max: 9007199254740991,
|
||||
default: null,
|
||||
},
|
||||
{
|
||||
key: "visitorCount",
|
||||
type: "integer",
|
||||
status: "available",
|
||||
required: false,
|
||||
array: false,
|
||||
min: 0,
|
||||
max: 9007199254740991,
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
key: "enabled",
|
||||
type: "boolean",
|
||||
status: "available",
|
||||
required: false,
|
||||
array: false,
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
indexes: [],
|
||||
},
|
||||
{
|
||||
$id: "shareSecurity",
|
||||
$read: [],
|
||||
$write: [],
|
||||
name: "ShareSecurity",
|
||||
enabled: true,
|
||||
permission: "document",
|
||||
attributes: [
|
||||
{
|
||||
key: "password",
|
||||
type: "string",
|
||||
status: "available",
|
||||
required: false,
|
||||
array: false,
|
||||
size: 128,
|
||||
default: null,
|
||||
},
|
||||
{
|
||||
key: "maxVisitors",
|
||||
type: "integer",
|
||||
status: "available",
|
||||
required: false,
|
||||
array: false,
|
||||
min: 0,
|
||||
max: 9007199254740991,
|
||||
default: null,
|
||||
},
|
||||
],
|
||||
indexes: [],
|
||||
},
|
||||
];
|
||||
46
.setup/data/functions.ts
Normal file
46
.setup/data/functions.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
export default () => {
|
||||
const host = process.env["APPWRITE_HOST"].replace(
|
||||
"localhost",
|
||||
"host.docker.internal"
|
||||
);
|
||||
return [
|
||||
{
|
||||
$id: "createShare",
|
||||
execute: ["role:all"],
|
||||
name: "Create Share",
|
||||
runtime: "node-16.0",
|
||||
vars: {
|
||||
APPWRITE_FUNCTION_ENDPOINT: host,
|
||||
APPWRITE_FUNCTION_API_KEY: process.env["APPWRITE_FUNCTION_API_KEY"],
|
||||
},
|
||||
events: [],
|
||||
schedule: "",
|
||||
timeout: 15,
|
||||
},
|
||||
{
|
||||
$id: "finishShare",
|
||||
execute: ["role:all"],
|
||||
name: "Finish Share",
|
||||
runtime: "node-16.0",
|
||||
deployment: "625db8ded97874b96590",
|
||||
vars: {
|
||||
APPWRITE_FUNCTION_ENDPOINT: host,
|
||||
APPWRITE_FUNCTION_API_KEY: process.env["APPWRITE_FUNCTION_API_KEY"],
|
||||
},
|
||||
events: [],
|
||||
schedule: "",
|
||||
timeout: 15,
|
||||
},
|
||||
{
|
||||
$id: "cleanShares",
|
||||
name: "Clean Shares",
|
||||
runtime: "node-16.0",
|
||||
path: "functions/cleanShares",
|
||||
entrypoint: "src/index.js",
|
||||
execute: ["role:all"],
|
||||
events: [],
|
||||
schedule: "30,59 * * * *",
|
||||
timeout: 60,
|
||||
},
|
||||
];
|
||||
};
|
||||
Reference in New Issue
Block a user