fix(core): update
This commit is contained in:
parent
1e83f0a0ef
commit
ffa52a5883
@ -15,7 +15,7 @@ import * as mongoPlugin from 'mongodb-memory-server';
|
||||
// =======================================
|
||||
|
||||
let testDb: smartdata.SmartdataDb;
|
||||
let smartdataOptions: smartdata.ISmartdataOptions;
|
||||
let smartdataOptions: smartdata.IMongoDescriptor;
|
||||
let mongod: mongoPlugin.MongoMemoryServer;
|
||||
|
||||
tap.test('should create a testinstance as database', async () => {
|
||||
|
@ -1,5 +1,22 @@
|
||||
export interface IMongoDescriptor {
|
||||
mongoDbName: string;
|
||||
/**
|
||||
* the URL to connect to
|
||||
*/
|
||||
mongoDbUrl: string;
|
||||
mongoDbPass: string;
|
||||
|
||||
/**
|
||||
* the db to use for the project
|
||||
*/
|
||||
mongoDbName?: string;
|
||||
|
||||
/**
|
||||
* a username to use to connect to the database
|
||||
*/
|
||||
|
||||
mongoDbUser?: string;
|
||||
|
||||
/**
|
||||
* an optional password that will be replace <PASSWORD> in the connection string
|
||||
*/
|
||||
mongoDbPass?: string;
|
||||
}
|
||||
|
@ -4,43 +4,21 @@ import { ObjectMap } from '@pushrocks/lik';
|
||||
import { SmartdataCollection } from './smartdata.classes.collection';
|
||||
|
||||
import { logger } from './smartdata.logging';
|
||||
import { IMongoDescriptor } from './interfaces';
|
||||
|
||||
/**
|
||||
* interface - indicates the connection status of the db
|
||||
*/
|
||||
export type TConnectionStatus = 'initial' | 'disconnected' | 'connected' | 'failed';
|
||||
|
||||
export interface ISmartdataOptions {
|
||||
/**
|
||||
* the URL to connect to
|
||||
*/
|
||||
mongoDbUrl: string;
|
||||
|
||||
/**
|
||||
* the db to use for the project
|
||||
*/
|
||||
mongoDbName?: string;
|
||||
|
||||
/**
|
||||
* a username to use to connect to the database
|
||||
*/
|
||||
|
||||
mongoDbUser?: string;
|
||||
|
||||
/**
|
||||
* an optional password that will be replace <PASSWORD> in the connection string
|
||||
*/
|
||||
mongoDbPass?: string;
|
||||
}
|
||||
|
||||
export class SmartdataDb {
|
||||
smartdataOptions: ISmartdataOptions;
|
||||
smartdataOptions: IMongoDescriptor;
|
||||
mongoDbClient: plugins.mongodb.MongoClient;
|
||||
mongoDb: plugins.mongodb.Db;
|
||||
status: TConnectionStatus;
|
||||
smartdataCollectionMap = new ObjectMap<SmartdataCollection<any>>();
|
||||
|
||||
constructor(smartdataOptions: ISmartdataOptions) {
|
||||
constructor(smartdataOptions: IMongoDescriptor) {
|
||||
this.smartdataOptions = smartdataOptions;
|
||||
this.status = 'initial';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user