Skip to content

Commit

Permalink
Delete documents
Browse files Browse the repository at this point in the history
  • Loading branch information
melohagan committed Oct 18, 2022
1 parent a9a45f3 commit 5ba3fc0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 6 additions & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
"collectionId": {
"type": "string",
"required": false
},
"documentId": {
"type": "string",
"required": false
}
}
}
Expand All @@ -149,7 +153,8 @@
],
"delete": [
"Databases",
"Collections"
"Collections",
"Documents"
]
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 5ba3fc0

Please sign in to comment.