Skip to content

Commit

Permalink
Update document
Browse files Browse the repository at this point in the history
  • Loading branch information
melohagan committed Oct 18, 2022
1 parent 85ce148 commit a9a45f3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 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.1",
"version": "1.2.2",
"description": "Manage Databases, Collections, and Documents in Appwrite",
"main": "src/index.ts",
"license": "MIT",
Expand Down
23 changes: 22 additions & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"data": {
"type": "json",
"required": "true"
"required": true
}
}
},
Expand Down Expand Up @@ -93,6 +93,27 @@
}
}
},
"updateDocument": {
"type": "fields",
"fields": {
"databaseId": {
"type": "string",
"required": true
},
"collectionId": {
"type": "string",
"required": true
},
"documentId": {
"type": "string",
"required": true
},
"data": {
"type": "json",
"required": false
}
}
},
"delete": {
"type": "fields",
"fields": {
Expand Down
4 changes: 4 additions & 0 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class CustomIntegration implements IntegrationBase {
return await this.databases.update(query.databaseId, query.name)
}

async updateDocument(query: { databaseId: string; collectionId: string; documentId: string; data: object; extra: { [key:string]: string; } }) {
return await this.databases.updateDocument(query.databaseId, query.collectionId, query.documentId, query.data)
}

async delete(query: { databaseId: string; collectionId: string; extra: { [key:string]: string; } }) {
if (query.extra.type === "Collections") {
return await this.databases.deleteCollection(query.databaseId, query.collectionId)
Expand Down

0 comments on commit a9a45f3

Please sign in to comment.