fix(structure): format

This commit is contained in:
Philipp Kunz 2019-02-13 22:08:58 +01:00
parent 761b742e21
commit 3eeac7b936
8 changed files with 38 additions and 40 deletions

View File

@ -1,25 +1,19 @@
# @pushrocks/smartdata # @pushrocks/smartdata
do more with data
do more with data and RethinkDB ## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdata)
## Availabililty * [gitlab.com (source)](https://gitlab.com/pushrocks/smartdata)
* [github.com (source mirror)](https://github.com/pushrocks/smartdata)
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartdata) * [docs (typedoc)](https://pushrocks.gitlab.io/smartdata/)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartdata)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartdata)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartdata/)
## Status for master ## Status for master
[![build status](https://gitlab.com/pushrocks/smartdata/badges/master/build.svg)](https://gitlab.com/pushrocks/smartdata/commits/master)
[![build status](https://GitLab.com/pushrocks/smartdata/badges/master/build.svg)](https://GitLab.com/pushrocks/smartdata/commits/master) [![coverage report](https://gitlab.com/pushrocks/smartdata/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartdata/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartdata/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartdata/commits/master) [![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartdata.svg)](https://www.npmjs.com/package/@pushrocks/smartdata)
[![npm downloads per month](https://img.shields.io/npm/dm/smartdata.svg)](https://www.npmjs.com/package/smartdata) [![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartdata/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartdata)
[![Dependency Status](https://david-dm.org/pushrocks/smartdata.svg)](https://david-dm.org/pushrocks/smartdata) [![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartdata/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartdata/master/dependencies/npm) [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartdata/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartdata)
[![Known Vulnerabilities](https://snyk.io/test/npm/smartdata/badge.svg)](https://snyk.io/test/npm/smartdata)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage ## Usage
@ -121,9 +115,9 @@ you should get all the Intellisense and type checking you love when using smartd
smartdata itself also bundles typings. smartdata itself also bundles typings.
So you don't need to install any additional types when importing smartdata. So you don't need to install any additional types when importing smartdata.
For further information read the linked docs at the top of this README. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

View File

@ -8,5 +8,15 @@
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public", "npmAccessLevel": "public",
"npmRegistryUrl": "registry.npmjs.org" "npmRegistryUrl": "registry.npmjs.org"
},
"gitzone": {
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartdata",
"shortDescription": "do more with data",
"npmPackagename": "@pushrocks/smartdata",
"license": "MIT"
}
} }
} }

View File

@ -29,7 +29,6 @@ export function Collection(dbArg: SmartdataDb | TDelayedDbCreation) {
return new SmartdataCollection(constructor, dbArg()); return new SmartdataCollection(constructor, dbArg());
}; };
} }
}; };
} }
@ -124,7 +123,7 @@ export class SmartdataCollection<T> {
this.mongoDbCollection.updateOne(identifiableObject, saveableObject); this.mongoDbCollection.updateOne(identifiableObject, saveableObject);
} }
public async delete (dbDocArg: T & SmartDataDbDoc<T>): Promise<any> { public async delete(dbDocArg: T & SmartDataDbDoc<T>): Promise<any> {
await this.init(); await this.init();
await this.checkDoc(dbDocArg); await this.checkDoc(dbDocArg);
const identifiableObject = await dbDocArg.createIdentifiableObject(); const identifiableObject = await dbDocArg.createIdentifiableObject();

View File

@ -53,12 +53,9 @@ export class SmartdataDb {
); );
} }
console.log(finalConnectionUrl); console.log(finalConnectionUrl);
this.mongoDbClient = await plugins.mongodb.MongoClient.connect( this.mongoDbClient = await plugins.mongodb.MongoClient.connect(finalConnectionUrl, {
finalConnectionUrl, useNewUrlParser: true
{ });
useNewUrlParser: true
}
);
this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName); this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName);
this.status = 'connected'; this.status = 'connected';
console.log(`Connected to database ${this.smartdataOptions.mongoDbName}`); console.log(`Connected to database ${this.smartdataOptions.mongoDbName}`);

View File

@ -77,7 +77,7 @@ export class SmartDataDbDoc<T> {
*/ */
constructor() { constructor() {
this.name = this.constructor['name']; this.name = this.constructor['name'];
if(this.constructor['smartdataCollection']) { if (this.constructor['smartdataCollection']) {
// tslint:disable-next-line: no-string-literal // tslint:disable-next-line: no-string-literal
this.collection = this.constructor['smartdataCollection']; this.collection = this.constructor['smartdataCollection'];
// tslint:disable-next-line: no-string-literal // tslint:disable-next-line: no-string-literal
@ -97,7 +97,7 @@ export class SmartDataDbDoc<T> {
referenceMongoDBCollection = self.smartdataCollection; referenceMongoDBCollection = self.smartdataCollection;
} else if (self.smartdataDelayedCollection) { } else if (self.smartdataDelayedCollection) {
referenceMongoDBCollection = self.smartdataDelayedCollection(); referenceMongoDBCollection = self.smartdataDelayedCollection();
}; }
const foundDocs = await referenceMongoDBCollection.find(filterArg); const foundDocs = await referenceMongoDBCollection.find(filterArg);
const returnArray = []; const returnArray = [];
for (let item of foundDocs) { for (let item of foundDocs) {
@ -142,9 +142,7 @@ export class SmartDataDbDoc<T> {
/** /**
* deletes a document from the database * deletes a document from the database
*/ */
async delete() { async delete() {}
}
/** /**
* also store any referenced objects to DB * also store any referenced objects to DB