42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { Client, Account, Databases, Functions, ID, Teams } from 'appwrite';
|
|
|
|
const client = new Client();
|
|
|
|
function initAppwriteClient(endpoint: string, projectId: string) {
|
|
client.setEndpoint(endpoint).setProject(projectId);
|
|
}
|
|
|
|
type AppwriteIDConfig = {
|
|
databaseId: string;
|
|
collection: {
|
|
boat: string;
|
|
reservation: string;
|
|
interval: string;
|
|
intervalTemplate: string;
|
|
// task, taskTags, skillTags — parked; collections not yet created in bab_prod
|
|
};
|
|
function: {
|
|
userinfo: string;
|
|
};
|
|
};
|
|
|
|
const AppwriteIds: AppwriteIDConfig = {
|
|
databaseId: 'bab_prod',
|
|
collection: {
|
|
boat: 'boat',
|
|
reservation: 'reservation',
|
|
interval: 'interval',
|
|
intervalTemplate: 'intervalTemplate',
|
|
},
|
|
function: {
|
|
userinfo: 'userinfo',
|
|
},
|
|
};
|
|
|
|
const account = new Account(client);
|
|
const databases = new Databases(client);
|
|
const functions = new Functions(client);
|
|
const teams = new Teams(client);
|
|
|
|
export { client, account, databases, functions, teams, ID, AppwriteIds, initAppwriteClient };
|