diff --git a/package.json b/package.json index 25208c0..d959ecc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appwrite-databases", - "version": "1.2.2", + "version": "1.2.3", "description": "Manage Databases, Collections, and Documents in Appwrite", "main": "src/index.ts", "license": "MIT", diff --git a/schema.json b/schema.json index 084c62d..c78c021 100644 --- a/schema.json +++ b/schema.json @@ -124,6 +124,10 @@ "collectionId": { "type": "string", "required": false + }, + "documentId": { + "type": "string", + "required": false } } } @@ -149,7 +153,8 @@ ], "delete": [ "Databases", - "Collections" + "Collections", + "Documents" ] } } diff --git a/src/datasource.ts b/src/datasource.ts index e2b281d..c520638 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -55,7 +55,10 @@ class CustomIntegration implements IntegrationBase { return await this.databases.updateDocument(query.databaseId, query.collectionId, query.documentId, query.data) } - async delete(query: { databaseId: string; collectionId: string; extra: { [key:string]: string; } }) { + async delete(query: { databaseId: string; collectionId: string; documentId: string; extra: { [key:string]: string; } }) { + if (query.extra.type === "Documents") { + return await this.databases.deleteDocument(query.databaseId, query.collectionId, query.documentId) + } if (query.extra.type === "Collections") { return await this.databases.deleteCollection(query.databaseId, query.collectionId) }