25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import { BusinessRecord } from './classes.businessrecord.js';
|
|
import { GermanBusinessData } from './classes.germanbusinessdata.js';
|
|
import * as paths from './paths.js';
|
|
import * as plugins from './plugins.js';
|
|
|
|
export class OpenData {
|
|
db: plugins.smartdata.SmartdataDb;
|
|
germanBusinesses: GermanBusinessData;
|
|
private serviceQenv = new plugins.qenv.Qenv(paths.packageDir, paths.nogitDir);
|
|
|
|
public CBusinessRecord = plugins.smartdata.setDefaultManagerForDoc(this, BusinessRecord);
|
|
|
|
public async start() {
|
|
this.db = new plugins.smartdata.SmartdataDb({
|
|
mongoDbUrl: await this.serviceQenv.getEnvVarOnDemand('MONGODB_URL'),
|
|
mongoDbName: await this.serviceQenv.getEnvVarOnDemand('MONGODB_NAME'),
|
|
mongoDbUser: await this.serviceQenv.getEnvVarOnDemand('MONGODB_USER'),
|
|
mongoDbPass: await this.serviceQenv.getEnvVarOnDemand('MONGODB_PASS'),
|
|
});
|
|
await this.db.init();
|
|
this.germanBusinesses = new GermanBusinessData(this);
|
|
await this.germanBusinesses.start();
|
|
}
|
|
public async stop() {}
|
|
} |