@cocreate/crud-server
Advanced tools
Comparing version
@@ -0,1 +1,8 @@ | ||
# [1.17.0](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.16.1...v1.17.0) (2022-12-07) | ||
### Features | ||
* database crud functions ([60ff480](https://github.com/CoCreate-app/CoCreate-crud-server/commit/60ff4809ed232a8a9b4b5ae95f2e0649773dec00)) | ||
## [1.16.1](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.16.0...v1.16.1) (2022-12-04) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@cocreate/crud-server", | ||
"version": "1.16.1", | ||
"version": "1.17.0", | ||
"description": "CoCreate-crud-server", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -37,3 +37,3 @@ const json2csv = require("json-2-csv") | ||
// const result = data.data; | ||
// const orgId = socket.config.orgId ; | ||
// const organization_id = socket.config.organization_id ; | ||
// if (export_type === 'csv') { | ||
@@ -47,5 +47,5 @@ // binaryData = await json2csv.json2csvAsync(JSON.parse(JSON.stringify(result)), { | ||
// this.wsManager.send(socket, 'downloadFileInfo', {file_name: `backup_${data['collection']}.${export_type}`, binaryData, export_type}, orgId); | ||
// this.wsManager.send(socket, 'downloadFileInfo', {file_name: `backup_${data['collection']}.${export_type}`, binaryData, export_type}, organization_id); | ||
// this.wsManager.sendBinary(socket, binaryData, orgId); | ||
// this.wsManager.sendBinary(socket, binaryData, organization_id); | ||
@@ -73,3 +73,3 @@ // } catch (error) { | ||
// var collection = this.dbClient.db(data['namespace']).collection(data["collection"]); | ||
// const orgId = socket.config.orgId | ||
// const organization_id = socket.config.organization_id | ||
@@ -81,3 +81,3 @@ // var query = {}; | ||
// let binaryData = null; | ||
// self.wsManager.send(socket, 'downloadFileInfo', {file_name: `backup_${data['collection']}.${export_type}`}, orgId); | ||
// self.wsManager.send(socket, 'downloadFileInfo', {file_name: `backup_${data['collection']}.${export_type}`}, organization_id); | ||
// if (export_type === 'csv') { | ||
@@ -91,3 +91,3 @@ // binaryData = await json2csv.json2csvAsync(JSON.parse(JSON.stringify(result)), { | ||
// self.wsManager.sendBinary(socket, binaryData, orgId); | ||
// self.wsManager.sendBinary(socket, binaryData, organization_id); | ||
// } | ||
@@ -114,3 +114,3 @@ // }); | ||
// const self = this; | ||
// // const orgId = socket.config.orgId | ||
// // const organization_id = socket.config.organization_id | ||
// if (!importCollection || !importType) { | ||
@@ -132,3 +132,3 @@ // return; | ||
// console.log('json: ', jsonData) | ||
// var collection = this.dbClient.db(orgId).collection(importCollection); | ||
// var collection = this.dbClient.db(organization_id).collection(importCollection); | ||
// // console.log(this.importCollection) | ||
@@ -138,7 +138,7 @@ // collection.insertMany(jsonData, function(err, result) { | ||
// self.wsManager.send(socket, 'importedFile2DB', { | ||
// 'database': orgId, | ||
// 'database': organization_id, | ||
// 'collection': importCollection, | ||
// 'import_type': importType, | ||
// 'data': result | ||
// }, orgId) | ||
// }, organization_id) | ||
// } | ||
@@ -145,0 +145,0 @@ // }) |
@@ -35,2 +35,22 @@ 'use strict'; | ||
async createDatabase(data) { | ||
data = await this.db('', 'createDatabase', data) | ||
return data | ||
} | ||
async readDatabase(data) { | ||
data = await this.db('', 'readDatabase', data) | ||
return data | ||
} | ||
async updateDatabase(data) { | ||
data = await this.db('', 'updateDatabase', data) | ||
return data | ||
} | ||
async deleteDatabase(data) { | ||
data = await this.db('', 'deleteDatabase', data) | ||
return data | ||
} | ||
async createCollection(data) { | ||
@@ -46,7 +66,2 @@ data = await this.db('', 'createCollection', data) | ||
async readCollections(data) { | ||
data = await this.db('', 'readCollections', data) | ||
return data | ||
} | ||
async updateCollection(data) { | ||
@@ -53,0 +68,0 @@ data = await this.db('', 'updateCollection', data) |
84227
0.82%348
3.57%