refactor: everything to nuxt.js
This commit is contained in:
41
app/utils/appwrite.ts
Normal file
41
app/utils/appwrite.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user